diff --git a/app-modules/events/database/migrations/2026_05_13_224916_recreate_events_table_with_uuid.php b/app-modules/events/database/migrations/2026_05_13_224916_recreate_events_table_with_uuid.php new file mode 100644 index 00000000..d0b344a6 --- /dev/null +++ b/app-modules/events/database/migrations/2026_05_13_224916_recreate_events_table_with_uuid.php @@ -0,0 +1,128 @@ +dropForeign('events_talks_event_id_foreign'); + $table->dropColumn('event_id'); + }); + + Schema::table('events_attendees', function (Blueprint $table): void { + $table->dropForeign('events_attendees_event_id_foreign'); + $table->dropColumn('event_id'); + }); + + Schema::table('events_sponsors', function (Blueprint $table): void { + $table->dropForeign('events_sponsors_event_id_foreign'); + $table->dropColumn('event_id'); + }); + + Schema::table('events_agenda', function (Blueprint $table): void { + $table->dropForeign('events_agenda_event_id_foreign'); + $table->dropColumn('event_id'); + }); + + Schema::dropIfExists('events'); + + Schema::create('events', function (Blueprint $table): void { + $table->uuid('id')->primary(); + $table->foreignId('tenant_id')->nullable()->constrained('tenants')->nullOnDelete(); + $table->string('event_type'); + $table->boolean('active')->default(true); + $table->string('slug')->unique(); + $table->string('title'); + $table->text('description'); + $table->timestamp('event_at'); + $table->timestamp('start_at'); + $table->timestamp('end_at'); + $table->string('location'); + $table->integer('max_attendees'); + $table->integer('attendees_count')->default(0); + $table->integer('waitlist_count')->default(0); + $table->timestamps(); + }); + + Schema::table('events_talks', function (Blueprint $table): void { + $table->foreignUuid('event_id')->constrained('events')->cascadeOnDelete(); + }); + + Schema::table('events_attendees', function (Blueprint $table): void { + $table->foreignUuid('event_id')->constrained('events')->cascadeOnDelete(); + }); + + Schema::table('events_sponsors', function (Blueprint $table): void { + $table->foreignUuid('event_id')->constrained('events')->cascadeOnDelete(); + }); + + Schema::table('events_agenda', function (Blueprint $table): void { + $table->foreignUuid('event_id')->constrained('events')->cascadeOnDelete(); + }); + } + + public function down(): void + { + Schema::table('events_talks', function (Blueprint $table): void { + $table->dropForeign('events_talks_event_id_foreign'); + $table->dropColumn('event_id'); + }); + + Schema::table('events_attendees', function (Blueprint $table): void { + $table->dropForeign('events_attendees_event_id_foreign'); + $table->dropColumn('event_id'); + }); + + Schema::table('events_sponsors', function (Blueprint $table): void { + $table->dropForeign('events_sponsors_event_id_foreign'); + $table->dropColumn('event_id'); + }); + + Schema::table('events_agenda', function (Blueprint $table): void { + $table->dropForeign('events_agenda_event_id_foreign'); + $table->dropColumn('event_id'); + }); + + Schema::dropIfExists('events'); + + Schema::create('events', function (Blueprint $table): void { + $table->id(); + $table->foreignId('tenant_id')->nullable()->constrained('tenants')->nullOnDelete(); + $table->string('event_type'); + $table->boolean('active'); + $table->string('slug'); + $table->string('title'); + $table->text('description'); + $table->timestamp('event_at'); + $table->timestamp('start_at'); + $table->timestamp('end_at'); + $table->string('location'); + $table->integer('max_attendees'); + $table->integer('attendees_count')->default(0); + $table->integer('waitlist_count')->default(0); + $table->timestamps(); + }); + + Schema::table('events_talks', function (Blueprint $table): void { + $table->foreignId('event_id')->constrained('events')->cascadeOnDelete(); + }); + + Schema::table('events_attendees', function (Blueprint $table): void { + $table->foreignId('event_id')->constrained('events')->cascadeOnDelete(); + }); + + Schema::table('events_sponsors', function (Blueprint $table): void { + $table->foreignId('event_id')->constrained('events')->cascadeOnDelete(); + }); + + Schema::table('events_agenda', function (Blueprint $table): void { + $table->foreignId('event_id')->constrained('events')->cascadeOnDelete(); + }); + } +}; diff --git a/app-modules/events/database/migrations/2026_05_13_225144_create_event_enrollment_policies_table.php b/app-modules/events/database/migrations/2026_05_13_225144_create_event_enrollment_policies_table.php new file mode 100644 index 00000000..c8abcbb4 --- /dev/null +++ b/app-modules/events/database/migrations/2026_05_13_225144_create_event_enrollment_policies_table.php @@ -0,0 +1,37 @@ +uuid('id')->primary(); + $table->timestamps(); + $table->foreignUuid('event_id')->constrained('events')->cascadeOnDelete(); + $table->unique('event_id'); + $table->string('enrollment_method'); + $table->string('check_in_method'); + $table->integer('capacity'); + $table->boolean('has_waitlist')->default(false); + $table->integer('cancellation_deadline_h'); + $table->jsonb('application_form')->nullable(); + $table->boolean('requires_approval')->default(false); + $table->integer('xp_reward_rsvp')->default(0); + $table->integer('xp_reward_checkin')->default(0); + $table->integer('xp_reward_referral')->default(0); + $table->decimal('venue_lat', 11, 7)->nullable(); + $table->decimal('venue_lng', 12, 10)->nullable(); + }); + } + + public function down(): void + { + Schema::dropIfExists('event_enrollment_policies'); + } +}; diff --git a/app-modules/events/database/migrations/2026_05_13_225145_create_check_in_codes_table.php b/app-modules/events/database/migrations/2026_05_13_225145_create_check_in_codes_table.php new file mode 100644 index 00000000..6b25761e --- /dev/null +++ b/app-modules/events/database/migrations/2026_05_13_225145_create_check_in_codes_table.php @@ -0,0 +1,29 @@ +uuid('id')->primary(); + $table->timestamps(); + $table->foreignUuid('event_id')->constrained('events')->cascadeOnDelete(); + $table->string('code'); + $table->timestamp('valid_from')->nullable(); + $table->timestamp('valid_until')->nullable(); + $table->integer('max_uses')->nullable(); + $table->unique(['event_id', 'code']); + }); + } + + public function down(): void + { + Schema::dropIfExists('check_in_codes'); + } +}; diff --git a/app-modules/events/database/migrations/2026_05_13_225145_create_event_enrollments_table.php b/app-modules/events/database/migrations/2026_05_13_225145_create_event_enrollments_table.php new file mode 100644 index 00000000..4f994d55 --- /dev/null +++ b/app-modules/events/database/migrations/2026_05_13_225145_create_event_enrollments_table.php @@ -0,0 +1,39 @@ +uuid('id')->primary(); + $table->timestamps(); + $table->foreignUuid('event_id')->constrained('events')->cascadeOnDelete(); + $table->foreignUuid('user_id')->constrained('users')->cascadeOnDelete(); + $table->string('status')->index(); + $table->integer('waitlist_position')->nullable(); + $table->string('source')->nullable(); + $table->uuid('referral_id')->nullable(); + $table->jsonb('application_data')->nullable(); + $table->boolean('is_public')->default(false); + $table->string('rejection_reason')->nullable(); + $table->timestamp('enrolled_at')->nullable(); + $table->timestamp('approved_at')->nullable(); + $table->timestamp('confirmed_at')->nullable(); + $table->timestamp('cancelled_at')->nullable(); + $table->timestamp('checked_in_at')->nullable(); + $table->timestamp('completed_at')->nullable(); + $table->unique(['event_id', 'user_id']); + }); + } + + public function down(): void + { + Schema::dropIfExists('event_enrollments'); + } +}; diff --git a/app-modules/events/database/migrations/2026_05_13_225146_create_enrollment_transitions_table.php b/app-modules/events/database/migrations/2026_05_13_225146_create_enrollment_transitions_table.php new file mode 100644 index 00000000..0648ae3b --- /dev/null +++ b/app-modules/events/database/migrations/2026_05_13_225146_create_enrollment_transitions_table.php @@ -0,0 +1,30 @@ +uuid('id')->primary(); + $table->timestamps(); + $table->foreignUuid('enrollment_id')->constrained('event_enrollments')->cascadeOnDelete(); + $table->string('from_status')->nullable(); + $table->string('to_status'); + $table->string('triggered_by'); + $table->foreignUuid('actor_user_id')->nullable()->constrained('users')->nullOnDelete(); + $table->text('reason')->nullable(); + $table->index(['enrollment_id', 'created_at']); + }); + } + + public function down(): void + { + Schema::dropIfExists('enrollment_transitions'); + } +}; diff --git a/app-modules/events/database/migrations/2026_05_13_225146_create_event_check_ins_table.php b/app-modules/events/database/migrations/2026_05_13_225146_create_event_check_ins_table.php new file mode 100644 index 00000000..949414fa --- /dev/null +++ b/app-modules/events/database/migrations/2026_05_13_225146_create_event_check_ins_table.php @@ -0,0 +1,28 @@ +uuid('id')->primary(); + $table->timestamps(); + $table->foreignUuid('enrollment_id')->constrained('event_enrollments')->cascadeOnDelete(); + $table->string('method'); + $table->jsonb('payload')->nullable(); + $table->foreignUuid('verified_by_user_id')->nullable()->constrained('users')->nullOnDelete(); + $table->unique('enrollment_id'); + }); + } + + public function down(): void + { + Schema::dropIfExists('event_check_ins'); + } +}; diff --git a/app-modules/events/database/migrations/2026_05_13_225146_create_event_xp_rewards_table.php b/app-modules/events/database/migrations/2026_05_13_225146_create_event_xp_rewards_table.php new file mode 100644 index 00000000..6d8b7e7f --- /dev/null +++ b/app-modules/events/database/migrations/2026_05_13_225146_create_event_xp_rewards_table.php @@ -0,0 +1,31 @@ +uuid('id')->primary(); + $table->timestamps(); + $table->foreignUuid('user_id')->constrained('users')->cascadeOnDelete(); + $table->foreignUuid('event_id')->constrained('events')->cascadeOnDelete(); + $table->foreignUuid('enrollment_id')->constrained('event_enrollments')->cascadeOnDelete(); + $table->string('reason'); + $table->integer('xp_amount'); + $table->string('source_type'); + $table->uuid('source_id'); + $table->unique(['enrollment_id', 'reason']); + }); + } + + public function down(): void + { + Schema::dropIfExists('event_xp_rewards'); + } +}; diff --git a/app-modules/events/database/migrations/2026_05_13_225146_create_magic_links_table.php b/app-modules/events/database/migrations/2026_05_13_225146_create_magic_links_table.php new file mode 100644 index 00000000..93c4f7f2 --- /dev/null +++ b/app-modules/events/database/migrations/2026_05_13_225146_create_magic_links_table.php @@ -0,0 +1,28 @@ +uuid('id')->primary(); + $table->timestamps(); + $table->foreignUuid('enrollment_id')->constrained('event_enrollments')->cascadeOnDelete(); + $table->string('token')->unique(); + $table->timestamp('expires_at')->nullable(); + $table->timestamp('used_at')->nullable(); + $table->string('sent_to_email'); + }); + } + + public function down(): void + { + Schema::dropIfExists('magic_links'); + } +}; diff --git a/app-modules/events/database/migrations/2026_05_13_225146_create_qr_tokens_table.php b/app-modules/events/database/migrations/2026_05_13_225146_create_qr_tokens_table.php new file mode 100644 index 00000000..4c40133e --- /dev/null +++ b/app-modules/events/database/migrations/2026_05_13_225146_create_qr_tokens_table.php @@ -0,0 +1,27 @@ +uuid('id')->primary(); + $table->timestamps(); + $table->foreignUuid('enrollment_id')->constrained('event_enrollments')->cascadeOnDelete(); + $table->string('token')->unique(); + $table->timestamp('expires_at')->nullable(); + $table->timestamp('used_at')->nullable(); + }); + } + + public function down(): void + { + Schema::dropIfExists('qr_tokens'); + } +}; diff --git a/app-modules/events/database/migrations/2026_05_13_225147_create_event_referrals_table.php b/app-modules/events/database/migrations/2026_05_13_225147_create_event_referrals_table.php new file mode 100644 index 00000000..4291b63d --- /dev/null +++ b/app-modules/events/database/migrations/2026_05_13_225147_create_event_referrals_table.php @@ -0,0 +1,30 @@ +uuid('id')->primary(); + $table->timestamps(); + $table->foreignUuid('event_id')->constrained('events')->cascadeOnDelete(); + $table->foreignUuid('user_id')->constrained('users')->cascadeOnDelete(); + $table->string('code')->unique(); + $table->integer('clicks_count')->default(0); + $table->integer('conversions')->default(0); + $table->integer('xp_earned')->default(0); + $table->unique(['event_id', 'user_id']); + }); + } + + public function down(): void + { + Schema::dropIfExists('event_referrals'); + } +}; diff --git a/app-modules/events/database/migrations/2026_05_13_225147_create_networking_connections_table.php b/app-modules/events/database/migrations/2026_05_13_225147_create_networking_connections_table.php new file mode 100644 index 00000000..689a78d3 --- /dev/null +++ b/app-modules/events/database/migrations/2026_05_13_225147_create_networking_connections_table.php @@ -0,0 +1,29 @@ +uuid('id')->primary(); + $table->timestamps(); + $table->foreignUuid('event_id')->constrained('events')->cascadeOnDelete(); + $table->foreignUuid('initiator_user_id')->constrained('users')->cascadeOnDelete(); + $table->foreignUuid('target_user_id')->constrained('users')->cascadeOnDelete(); + $table->string('status'); + $table->text('message')->nullable(); + $table->unique(['event_id', 'initiator_user_id', 'target_user_id']); + }); + } + + public function down(): void + { + Schema::dropIfExists('networking_connections'); + } +}; diff --git a/app-modules/events/database/migrations/2026_05_13_225147_create_networking_profiles_table.php b/app-modules/events/database/migrations/2026_05_13_225147_create_networking_profiles_table.php new file mode 100644 index 00000000..e3fe6080 --- /dev/null +++ b/app-modules/events/database/migrations/2026_05_13_225147_create_networking_profiles_table.php @@ -0,0 +1,30 @@ +uuid('id')->primary(); + $table->timestamps(); + $table->foreignUuid('enrollment_id')->constrained('event_enrollments')->cascadeOnDelete(); + $table->text('bio')->nullable(); + $table->jsonb('skills')->nullable(); + $table->jsonb('looking_for')->nullable(); + $table->jsonb('interests')->nullable(); + $table->boolean('contact_visible')->default(false); + $table->unique('enrollment_id'); + }); + } + + public function down(): void + { + Schema::dropIfExists('networking_profiles'); + } +}; diff --git a/app-modules/events/database/migrations/2026_05_13_225148_create_event_referral_clicks_table.php b/app-modules/events/database/migrations/2026_05_13_225148_create_event_referral_clicks_table.php new file mode 100644 index 00000000..022fb531 --- /dev/null +++ b/app-modules/events/database/migrations/2026_05_13_225148_create_event_referral_clicks_table.php @@ -0,0 +1,28 @@ +uuid('id')->primary(); + $table->timestamps(); + $table->foreignUuid('referral_id')->constrained('event_referrals')->cascadeOnDelete(); + $table->string('ip_hash')->nullable(); + $table->string('user_agent')->nullable(); + $table->string('referrer_url')->nullable(); + $table->timestamp('clicked_at'); + }); + } + + public function down(): void + { + Schema::dropIfExists('event_referral_clicks'); + } +}; diff --git a/app-modules/events/database/migrations/2026_05_13_225149_add_referral_foreign_key_to_event_enrollments_table.php b/app-modules/events/database/migrations/2026_05_13_225149_add_referral_foreign_key_to_event_enrollments_table.php new file mode 100644 index 00000000..5854a65e --- /dev/null +++ b/app-modules/events/database/migrations/2026_05_13_225149_add_referral_foreign_key_to_event_enrollments_table.php @@ -0,0 +1,26 @@ +foreign('referral_id') + ->references('id')->on('event_referrals') + ->nullOnDelete(); + }); + } + + public function down(): void + { + Schema::table('event_enrollments', function (Blueprint $table): void { + $table->dropForeign(['referral_id']); + }); + } +}; diff --git a/app-modules/identity/database/migrations/2026_04_19_000001_change_external_identities_metadata_to_jsonb.php b/app-modules/identity/database/migrations/2026_04_19_000001_change_external_identities_metadata_to_jsonb.php index eb6b8abc..f09b4b8d 100644 --- a/app-modules/identity/database/migrations/2026_04_19_000001_change_external_identities_metadata_to_jsonb.php +++ b/app-modules/identity/database/migrations/2026_04_19_000001_change_external_identities_metadata_to_jsonb.php @@ -9,11 +9,15 @@ { public function up(): void { - DB::statement('ALTER TABLE external_identities ALTER COLUMN metadata TYPE jsonb USING metadata::jsonb'); + if (DB::getDriverName() === 'pgsql') { + DB::statement('ALTER TABLE external_identities ALTER COLUMN metadata TYPE jsonb USING metadata::jsonb'); + } } public function down(): void { - DB::statement('ALTER TABLE external_identities ALTER COLUMN metadata TYPE json USING metadata::json'); + if (DB::getDriverName() === 'pgsql') { + DB::statement('ALTER TABLE external_identities ALTER COLUMN metadata TYPE json USING metadata::json'); + } } };