forked from mirror/pixelfed
Merge pull request #1013 from pixelfed/frontend-ui-refactor
Add snowflake ids to statuses
This commit is contained in:
commit
650ef477c5
|
@ -3,13 +3,21 @@
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
use Auth, Cache, Hashids, Storage;
|
use Auth, Cache, Hashids, Storage;
|
||||||
use App\Http\Controllers\StatusController;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Pixelfed\Snowflake\HasSnowflakePrimary;
|
||||||
|
use App\Http\Controllers\StatusController;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class Status extends Model
|
class Status extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes;
|
use HasSnowflakePrimary, SoftDeletes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the IDs are auto-incrementing.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $incrementing = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be mutated to dates.
|
* The attributes that should be mutated to dates.
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?php
|
||||||
|
return [
|
||||||
|
'epoch' => 1549756800000,
|
||||||
|
'worker_id' => 1,
|
||||||
|
'datacenter_id' => 1,
|
||||||
|
];
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class AddSnowflakeidsToUsersTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('statuses', function (Blueprint $table) {
|
||||||
|
$table->dropPrimary('id');
|
||||||
|
$table->bigInteger('id')->unsigned()->primary()->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('statuses', function (Blueprint $table) {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue