mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-29 09:43:16 +00:00
Add new migration
This commit is contained in:
parent
1236f902cf
commit
9eb94bc9bb
1 changed files with 75 additions and 0 deletions
|
@ -0,0 +1,75 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class AddAccountStatusToProfilesTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
// Drop old columns, fix stories
|
||||||
|
if(Schema::hasColumn('profiles', 'hub_url')) {
|
||||||
|
Schema::table('profiles', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('verify_token');
|
||||||
|
$table->dropColumn('secret');
|
||||||
|
$table->dropColumn('salmon_url');
|
||||||
|
$table->dropColumn('hub_url');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Schema::hasColumn('stories', 'bigIncrements')) {
|
||||||
|
Schema::table('stories', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('bigIncrements');
|
||||||
|
});
|
||||||
|
Schema::table('stories', function (Blueprint $table) {
|
||||||
|
$table->bigIncrements('id')->first();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add account status to profile and user tables
|
||||||
|
|
||||||
|
Schema::table('profiles', function (Blueprint $table) {
|
||||||
|
$table->string('status')->nullable()->index()->after('username');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
$table->string('status')->nullable()->index()->after('email');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('profiles', function (Blueprint $table) {
|
||||||
|
$table->string('verify_token')->nullable();
|
||||||
|
$table->string('secret')->nullable();
|
||||||
|
$table->string('salmon_url')->nullable();
|
||||||
|
$table->string('hub_url')->nullable();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('stories', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('id');
|
||||||
|
});
|
||||||
|
Schema::table('stories', function (Blueprint $table) {
|
||||||
|
$table->bigIncrements('bigIncrements')->first();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('profiles', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('status');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('status');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue