From 45142c688897d900688cb23c61b7b75fb2ea5ae6 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 13 Apr 2023 11:06:49 -0700 Subject: [PATCH] Migration to add supplier ID to components and consumables Signed-off-by: snipe --- ...4_12_135822_add_supplier_to_components.php | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 database/migrations/2023_04_12_135822_add_supplier_to_components.php diff --git a/database/migrations/2023_04_12_135822_add_supplier_to_components.php b/database/migrations/2023_04_12_135822_add_supplier_to_components.php new file mode 100644 index 0000000000..447c7850a9 --- /dev/null +++ b/database/migrations/2023_04_12_135822_add_supplier_to_components.php @@ -0,0 +1,48 @@ +integer('supplier_id')->after('user_id')->nullable()->default(null); + } + }); + + Schema::table('consumables', function (Blueprint $table) { + if (!Schema::hasColumn('consumables', 'supplier_id')) { + $table->integer('supplier_id')->after('user_id')->nullable()->default(null); + } + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('components', function (Blueprint $table) { + if (Schema::hasColumn('components', 'supplier_id')) { + $table->dropColumn('supplier_id'); + } + }); + + Schema::table('consumables', function (Blueprint $table) { + if (Schema::hasColumn('consumables', 'supplier_id')) { + $table->dropColumn('supplier_id'); + } + }); + } +}