mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-09-18 23:38:02 +00:00
41 lines
1 KiB
PHP
41 lines
1 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*/
|
|
public function up(): void
|
|
{
|
|
Schema::table('users', function (Blueprint $table) {
|
|
$table->boolean('has_roles')->default(false);
|
|
$table->unsignedInteger('parent_id')->nullable();
|
|
$table->tinyInteger('role_id')->unsigned()->nullable()->index();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::table('users', function (Blueprint $table) {
|
|
if (Schema::hasColumn('users', 'has_roles')) {
|
|
$table->dropColumn('has_roles');
|
|
}
|
|
|
|
if (Schema::hasColumn('users', 'role_id')) {
|
|
$table->dropColumn('role_id');
|
|
}
|
|
|
|
if (Schema::hasColumn('users', 'parent_id')) {
|
|
$table->dropColumn('parent_id');
|
|
}
|
|
});
|
|
}
|
|
};
|