diff --git a/database/migrations/2019_05_16_162730_create_twofaccounts_table.php b/database/migrations/2019_05_16_162730_create_twofaccounts_table.php index 2a73190f..4a89d5b2 100644 --- a/database/migrations/2019_05_16_162730_create_twofaccounts_table.php +++ b/database/migrations/2019_05_16_162730_create_twofaccounts_table.php @@ -17,7 +17,7 @@ public function up() $table->increments('id'); $table->string('service'); $table->string('uri'); - $table->string('account')->nullable();; + $table->string('account')->nullable(); $table->string('icon')->nullable(); $table->timestamps(); }); diff --git a/database/migrations/2020_12_04_073605_alter_encrypted_columns_to_text_for_sqlite.php b/database/migrations/2020_12_04_073605_alter_encrypted_columns_to_text_for_sqlite.php new file mode 100644 index 00000000..10be2de1 --- /dev/null +++ b/database/migrations/2020_12_04_073605_alter_encrypted_columns_to_text_for_sqlite.php @@ -0,0 +1,38 @@ +getConnection())->getConnection()->getDriverName(); + + if ('sqlite' === $driver) { + + Schema::table('twofaccounts', function (Blueprint $table) { + $table->text('account')->change(); + $table->text('uri')->change(); + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('twofaccounts', function (Blueprint $table) { + // + }); + } +} diff --git a/database/migrations/2021_09_08_191140_rename_uri_to_legacy_uri.php b/database/migrations/2021_09_08_191140_rename_uri_to_legacy_uri.php new file mode 100644 index 00000000..dcb8196e --- /dev/null +++ b/database/migrations/2021_09_08_191140_rename_uri_to_legacy_uri.php @@ -0,0 +1,32 @@ +renameColumn('uri', 'legacy_uri'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('twofaccounts', function (Blueprint $table) { + $table->renameColumn('legacy_uri', 'uri'); + }); + } +} diff --git a/database/migrations/2021_09_14_195451_change_account_not_nullable_twofaccounts_table.php b/database/migrations/2021_09_14_195451_change_nullable_in_twofaccounts_table.php similarity index 72% rename from database/migrations/2021_09_14_195451_change_account_not_nullable_twofaccounts_table.php rename to database/migrations/2021_09_14_195451_change_nullable_in_twofaccounts_table.php index e019e069..5958f51e 100644 --- a/database/migrations/2021_09_14_195451_change_account_not_nullable_twofaccounts_table.php +++ b/database/migrations/2021_09_14_195451_change_nullable_in_twofaccounts_table.php @@ -7,7 +7,7 @@ use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Facades\Log; -class ChangeAccountNotNullableTwofaccountsTable extends Migration +class ChangeNullableInTwofaccountsTable extends Migration { /** * Run the migrations. @@ -16,13 +16,6 @@ class ChangeAccountNotNullableTwofaccountsTable extends Migration */ public function up() { - - $driver = Schema::connection($this->getConnection())->getConnection()->getDriverName(); - - Schema::table('twofaccounts', function (Blueprint $table) { - $table->renameColumn('uri', 'legacy_uri'); - }); - Schema::table('twofaccounts', function (Blueprint $table) { $table->text('account')->nullable(false)->change(); $table->string('service')->nullable()->change(); @@ -31,18 +24,6 @@ public function up() $table->string('algorithm', 20)->nullable(false)->change(); $table->unsignedSmallInteger('digits')->nullable(false)->change(); }); - - // Apply migration 'AlterEncryptedColumnsToText' even to sqlite base - if ('sqlite' === $driver) { - - Schema::table('twofaccounts', function (Blueprint $table) { - $table->text('account')->change(); - }); - - Schema::table('twofaccounts', function (Blueprint $table) { - $table->text('legacy_uri')->change(); - }); - } $twofaccounts = DB::table('twofaccounts')->select('id', 'legacy_uri')->get(); @@ -78,8 +59,5 @@ public function up() */ public function down() { - Schema::table('twofaccounts', function (Blueprint $table) { - $table->renameColumn('legacy_uri', 'uri'); - }); } }