mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-28 19:23:11 +01:00
Revert to generic migration changes
This commit is contained in:
parent
227b2b2870
commit
9751f9f648
@ -16,24 +16,29 @@ class SplitTwofaccountsUriInMultipleColumns extends Migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
// as SQLITE disallow to add a not nullable column without default
|
||||
// value when altering a table we add all columns as nullable and
|
||||
// change them right after to not nullable column
|
||||
$driver = Schema::connection($this->getConnection())->getConnection()->getDriverName();
|
||||
|
||||
Schema::table('twofaccounts', function (Blueprint $table) {
|
||||
$table->string('otp_type', 10)->nullable();
|
||||
$table->text('secret')->nullable();
|
||||
$table->string('algorithm', 20)->nullable();
|
||||
$table->unsignedTinyInteger('digits')->default(6);
|
||||
$table->string('otp_type', 10);
|
||||
$table->text('secret');
|
||||
$table->string('algorithm', 20);
|
||||
$table->unsignedTinyInteger('digits');
|
||||
$table->unsignedInteger('period')->nullable();
|
||||
$table->unsignedBigInteger('counter')->nullable();
|
||||
});
|
||||
|
||||
// Apply previous migration 'AlterEncryptedColumnsToText' even to sqlite base
|
||||
if ('sqlite' === $driver) {
|
||||
|
||||
Schema::table('twofaccounts', function (Blueprint $table) {
|
||||
$table->string('otp_type', 10)->nullable(false)->change();
|
||||
$table->text('secret')->nullable(false)->change();
|
||||
$table->string('algorithm', 20)->nullable(false)->change();
|
||||
$table->text('account')->change();
|
||||
});
|
||||
|
||||
Schema::table('twofaccounts', function (Blueprint $table) {
|
||||
$table->text('uri')->change();
|
||||
});
|
||||
}
|
||||
|
||||
Schema::table('twofaccounts', function (Blueprint $table) {
|
||||
$table->renameColumn('uri', 'legacy_uri');
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user