From fe22e5325c52dba2a633c18dbe14438b612c20b6 Mon Sep 17 00:00:00 2001 From: kerkness Date: Fri, 28 Feb 2025 22:14:40 -0600 Subject: [PATCH 1/2] add migration for base_url --- ...0000_add_base_url_to_magic_links_table.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 databases/migrations/2025_02_28_000000_add_base_url_to_magic_links_table.php diff --git a/databases/migrations/2025_02_28_000000_add_base_url_to_magic_links_table.php b/databases/migrations/2025_02_28_000000_add_base_url_to_magic_links_table.php new file mode 100644 index 0000000..cec9a39 --- /dev/null +++ b/databases/migrations/2025_02_28_000000_add_base_url_to_magic_links_table.php @@ -0,0 +1,34 @@ +string('base_url')->nullable()->after('action'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + if (Schema::hasColumn('magic_links', 'base_url')) { + Schema::table('magic_links', function (Blueprint $table) { + $table->dropColumn('base_url'); + }); + } + } +}; From 1f5c6503680753625332bebfa94ca3715f989655 Mon Sep 17 00:00:00 2001 From: Ryan Mayberry Date: Thu, 6 Mar 2025 11:40:01 -0600 Subject: [PATCH 2/2] don't add column if exists --- ...025_02_28_000000_add_base_url_to_magic_links_table.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/databases/migrations/2025_02_28_000000_add_base_url_to_magic_links_table.php b/databases/migrations/2025_02_28_000000_add_base_url_to_magic_links_table.php index cec9a39..6ea95b9 100644 --- a/databases/migrations/2025_02_28_000000_add_base_url_to_magic_links_table.php +++ b/databases/migrations/2025_02_28_000000_add_base_url_to_magic_links_table.php @@ -13,9 +13,11 @@ */ public function up() { - Schema::table('magic_links', function (Blueprint $table) { - $table->string('base_url')->nullable()->after('action'); - }); + if (!Schema::hasColumn('magic_links', 'base_url')) { + Schema::table('magic_links', function (Blueprint $table) { + $table->string('base_url')->nullable()->after('action'); + }); + } } /**