diff --git a/app/migrations/20180920202100_rename_password_link_to_user_activation.php b/app/migrations/20180920202100_rename_password_link_to_user_activation.php new file mode 100644 index 0000000..65e41f5 --- /dev/null +++ b/app/migrations/20180920202100_rename_password_link_to_user_activation.php @@ -0,0 +1,32 @@ +table('password_link') + ->rename('user_activation') + ->changeColumn('public_id', 'string', [ + 'limit' => 40 + ]) + ->addColumn('used', 'integer', [ + 'limit' => 1, + 'default' => 0, + 'after' => 'user_id' + ])->save(); + + $this->table('user_activation') + ->renameColumn('public_id', 'activation_key') + ->save(); + + // Set used = 1 on all rows where password = null + $this->getQueryBuilder() + ->update('user_activation') + ->set('used', 1) + ->where('password IS NULL OR LENGTH(password) < 1') + ->execute(); + } +}