From 4d05a1541e2977af379ccd486c98414de38e1b6a Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Wed, 27 May 2026 19:39:36 +0300 Subject: [PATCH] condense backend migrations --- ai/backend-context.md | 9 ++++ .../2026_05_24_000001_elements_table.php | 1 + ...0000_add_description_to_elements_table.php | 22 ---------- ...6_000001_backfill_element_descriptions.php | 41 ------------------- 4 files changed, 10 insertions(+), 63 deletions(-) delete mode 100644 backend/database/migrations/2026_05_26_000000_add_description_to_elements_table.php delete mode 100644 backend/database/migrations/2026_05_26_000001_backfill_element_descriptions.php diff --git a/ai/backend-context.md b/ai/backend-context.md index f3b5ddd..dd69678 100644 --- a/ai/backend-context.md +++ b/ai/backend-context.md @@ -35,6 +35,15 @@ intentionally omitted here - update this section as entities land. `new Set(...)`) instead of creating them through their fake repositories +## Migrations + +- This project is not in production. By default, schema changes should update + the relevant create-table migration so migrations describe the current desired + schema from scratch. +- Do not add alter-table or data-backfill migrations unless the user explicitly + asks for production-style migration safety. +- Put seed data in seeders, not migrations. + ## PHP rules - Imports: always put `use` statements at the top of the file, never use diff --git a/backend/database/migrations/2026_05_24_000001_elements_table.php b/backend/database/migrations/2026_05_24_000001_elements_table.php index 377ba38..f09b3b0 100644 --- a/backend/database/migrations/2026_05_24_000001_elements_table.php +++ b/backend/database/migrations/2026_05_24_000001_elements_table.php @@ -12,6 +12,7 @@ return new class extends Migration $table->id(); $table->foreignId('set_id')->constrained('sets'); $table->string('title'); + $table->text('description')->default(''); $table->foreignId('parent_element_id') ->nullable() ->constrained('elements'); diff --git a/backend/database/migrations/2026_05_26_000000_add_description_to_elements_table.php b/backend/database/migrations/2026_05_26_000000_add_description_to_elements_table.php deleted file mode 100644 index 704311b..0000000 --- a/backend/database/migrations/2026_05_26_000000_add_description_to_elements_table.php +++ /dev/null @@ -1,22 +0,0 @@ -text('description')->default(''); - }); - } - - public function down(): void - { - Schema::table('elements', function (Blueprint $table) { - $table->dropColumn('description'); - }); - } -}; diff --git a/backend/database/migrations/2026_05_26_000001_backfill_element_descriptions.php b/backend/database/migrations/2026_05_26_000001_backfill_element_descriptions.php deleted file mode 100644 index 68ee685..0000000 --- a/backend/database/migrations/2026_05_26_000001_backfill_element_descriptions.php +++ /dev/null @@ -1,41 +0,0 @@ - 'Baderech HaAvodah is a way of living - ' - . 'a structured path for inner and outer growth, ' - . 'spiritual refinement, and personal development.', - 'Avodah Foundations' => 'Core foundations for building a steady ' - . 'avodah practice.', - 'Daily Practice' => 'Practical steps for consistent daily growth.', - ]; - - foreach ($descriptionsByTitle as $title => $description) { - DB::table('elements') - ->where('title', $title) - ->where('description', '') - ->update(['description' => $description]); - } - } - - public function down(): void - { - $titles = [ - 'Baderech HaAvodah', - 'Avodah Foundations', - 'Daily Practice', - ]; - - foreach ($titles as $title) { - DB::table('elements') - ->where('title', $title) - ->update(['description' => '']); - } - } -};