mirror of
https://github.com/flarum/framework.git
synced 2025-04-27 23:24:03 +08:00
Rename column for consistency
This commit is contained in:
parent
efca923d30
commit
8937050aed
@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
### Changed
|
### Changed
|
||||||
- Migrations must be namespaced under `Flarum\Migrations\{Core|ExtensionName}`. ([#422](https://github.com/flarum/core/issues/422))
|
- Migrations must be namespaced under `Flarum\Migrations\{Core|ExtensionName}`. ([#422](https://github.com/flarum/core/issues/422))
|
||||||
- More compact post layout, with all controls grouped over to the right.
|
- More compact post layout, with all controls grouped over to the right.
|
||||||
|
- Rename `notification_read_time` column in discussions table to `notifications_read_time`.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Output forum description in meta description tag. ([#506](https://github.com/flarum/core/issues/506))
|
- Output forum description in meta description tag. ([#506](https://github.com/flarum/core/issues/506))
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Flarum\Migrations\Core;
|
||||||
|
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Flarum\Migrations\Migration;
|
||||||
|
|
||||||
|
class RenameNotificationReadTime extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->schema->table('users', function (Blueprint $table) {
|
||||||
|
$table->renameColumn('notification_read_time', 'notifications_read_time');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$this->schema->table('users', function (Blueprint $table) {
|
||||||
|
$table->renameColumn('notifications_read_time', 'notification_read_time');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -71,7 +71,7 @@ class User extends Model
|
|||||||
'join_time',
|
'join_time',
|
||||||
'last_seen_time',
|
'last_seen_time',
|
||||||
'read_time',
|
'read_time',
|
||||||
'notification_read_time'
|
'notifications_read_time'
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -295,7 +295,7 @@ class User extends Model
|
|||||||
*/
|
*/
|
||||||
public function markNotificationsAsRead()
|
public function markNotificationsAsRead()
|
||||||
{
|
{
|
||||||
$this->notification_read_time = time();
|
$this->notifications_read_time = time();
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -432,7 +432,7 @@ class User extends Model
|
|||||||
{
|
{
|
||||||
return $this->notifications()
|
return $this->notifications()
|
||||||
->whereIn('type', $this->getAlertableNotificationTypes())
|
->whereIn('type', $this->getAlertableNotificationTypes())
|
||||||
->where('time', '>', $this->notification_read_time ?: 0)
|
->where('time', '>', $this->notifications_read_time ?: 0)
|
||||||
->where('is_read', 0)
|
->where('is_read', 0)
|
||||||
->where('is_deleted', 0)
|
->where('is_deleted', 0)
|
||||||
->count($this->getConnection()->raw('DISTINCT type, subject_id'));
|
->count($this->getConnection()->raw('DISTINCT type, subject_id'));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user