diff --git a/app/Status.php b/app/Status.php index 1e729cf35..6736e49b2 100644 --- a/app/Status.php +++ b/app/Status.php @@ -3,13 +3,21 @@ namespace App; use Auth, Cache, Hashids, Storage; -use App\Http\Controllers\StatusController; use Illuminate\Database\Eloquent\Model; +use Pixelfed\Snowflake\HasSnowflakePrimary; +use App\Http\Controllers\StatusController; use Illuminate\Database\Eloquent\SoftDeletes; 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. diff --git a/config/snowflake.php b/config/snowflake.php new file mode 100644 index 000000000..7f7134158 --- /dev/null +++ b/config/snowflake.php @@ -0,0 +1,6 @@ + 1549756800000, + 'worker_id' => 1, + 'datacenter_id' => 1, +]; diff --git a/database/migrations/2019_03_12_043935_add_snowflakeids_to_users_table.php b/database/migrations/2019_03_12_043935_add_snowflakeids_to_users_table.php new file mode 100644 index 000000000..e5d32f2db --- /dev/null +++ b/database/migrations/2019_03_12_043935_add_snowflakeids_to_users_table.php @@ -0,0 +1,33 @@ +dropPrimary('id'); + $table->bigInteger('id')->unsigned()->primary()->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('statuses', function (Blueprint $table) { + // + }); + } +}