mirror of
https://github.com/flarum/core.git
synced 2025-01-17 22:29:15 +01:00
No need for deleted_at in notifications table
This commit is contained in:
parent
9d790c18d6
commit
d0115de771
@ -9,6 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
|
||||
@ -19,21 +20,15 @@ return [
|
||||
|
||||
$table->renameColumn('time', 'created_at');
|
||||
|
||||
$table->timestamp('read_at')->nullable();
|
||||
$table->timestamp('deleted_at')->nullable();
|
||||
$table->dateTime('read_at')->nullable();
|
||||
});
|
||||
|
||||
$schema->getConnection()->table('notifications')
|
||||
->where('is_read', 1)
|
||||
->update(['read_at' => time()]);
|
||||
|
||||
$schema->getConnection()->table('notifications')
|
||||
->where('is_deleted', 1)
|
||||
->update(['deleted_at' => time()]);
|
||||
->update(['read_at' => Carbon::now()]);
|
||||
|
||||
$schema->table('notifications', function (Blueprint $table) {
|
||||
$table->dropColumn('is_read');
|
||||
$table->dropColumn('is_deleted');
|
||||
});
|
||||
},
|
||||
|
||||
@ -45,20 +40,14 @@ return [
|
||||
$table->renameColumn('created_at', 'time');
|
||||
|
||||
$table->boolean('is_read');
|
||||
$table->boolean('is_deleted');
|
||||
});
|
||||
|
||||
$schema->getConnection()->table('notifications')
|
||||
->whereNotNull('read_at')
|
||||
->update(['is_read' => 1]);
|
||||
|
||||
$schema->getConnection()->table('notifications')
|
||||
->whereNotNull('deleted_at')
|
||||
->update(['is_deleted' => 1]);
|
||||
|
||||
$schema->table('notifications', function (Blueprint $table) {
|
||||
$table->dropColumn('read_at');
|
||||
$table->dropColumn('deleted_at');
|
||||
});
|
||||
}
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user