From 80a183a94bd344c3ac08109019fdc7d341a57a6e Mon Sep 17 00:00:00 2001 From: Sam Light Date: Fri, 28 Mar 2025 01:07:59 +0000 Subject: Setup categories table, model and factory --- .../2025_03_27_211321_create_categories_table.php | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 workbench/database/migrations/2025_03_27_211321_create_categories_table.php (limited to 'workbench/database/migrations') diff --git a/workbench/database/migrations/2025_03_27_211321_create_categories_table.php b/workbench/database/migrations/2025_03_27_211321_create_categories_table.php new file mode 100644 index 0000000..5a75f30 --- /dev/null +++ b/workbench/database/migrations/2025_03_27_211321_create_categories_table.php @@ -0,0 +1,38 @@ +id(); + $table->string('name'); + $table->timestamps(); + $table->softDeletes(); + }); + + Schema::table('products', function (Blueprint $table) { + $table->foreignId('category_id'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('categories'); + + Schema::table('products', function (Blueprint $table) { + $table->dropColumn('category_id'); + }); + + } +}; -- cgit v1.2.3