From 2bd5e3bcc5e9b1ec8bf28f3ef36726c0c0b124ed Mon Sep 17 00:00:00 2001 From: Daniel Klabbers Date: Tue, 17 Apr 2018 11:41:55 +0200 Subject: [PATCH] restarted the branch using the already created migrations --- ...093900_change_access_tokens_b8_columns.php | 33 ++++++++++ ...okens_make_activity_at_column_datetime.php | 27 ++++++++ ...94900_change_api_keys_rename_id_to_key.php | 29 +++++++++ ...1_11_095000_change_api_keys_b8_columns.php | 35 +++++++++++ ...ame_auth_tokens_to_registration_tokens.php | 14 +++++ ...registration_tokens_rename_id_to_token.php | 27 ++++++++ ...1_155200_change_discussions_b8_columns.php | 45 +++++++++++++ ...nge_user_discussions_discussions_users.php | 22 +++++++ ...00_change_discussions_users_b8_columns.php | 29 +++++++++ ..._072600_change_email_tokens_b8_columns.php | 27 ++++++++ ...ename_permissions_to_group_permissions.php | 14 +++++ ...00_rename_users_groups_to_groups_users.php | 14 +++++ ...132900_create_notifications_from_table.php | 40 ++++++++++++ ...133000_change_notifications_b8_columns.php | 63 +++++++++++++++++++ ...400_change_password_tokens_id_to_token.php | 14 +++++ ...8_01_18_135000_change_posts_b8_columns.php | 42 +++++++++++++ ..._084700_change_settings_value_longblob.php | 26 ++++++++ ..._01_30_220100_create_posts_users_table.php | 29 +++++++++ ...8_01_30_222900_change_users_b8_columns.php | 44 +++++++++++++ ..._01_30_223700_create_users_users_table.php | 29 +++++++++ 20 files changed, 603 insertions(+) create mode 100644 framework/core/migrations/2018_01_11_093900_change_access_tokens_b8_columns.php create mode 100644 framework/core/migrations/2018_01_11_094800_change_access_tokens_make_activity_at_column_datetime.php create mode 100644 framework/core/migrations/2018_01_11_094900_change_api_keys_rename_id_to_key.php create mode 100644 framework/core/migrations/2018_01_11_095000_change_api_keys_b8_columns.php create mode 100644 framework/core/migrations/2018_01_11_101800_rename_auth_tokens_to_registration_tokens.php create mode 100644 framework/core/migrations/2018_01_11_102000_change_registration_tokens_rename_id_to_token.php create mode 100644 framework/core/migrations/2018_01_11_155200_change_discussions_b8_columns.php create mode 100644 framework/core/migrations/2018_01_15_071700_change_user_discussions_discussions_users.php create mode 100644 framework/core/migrations/2018_01_15_071800_change_discussions_users_b8_columns.php create mode 100644 framework/core/migrations/2018_01_15_072600_change_email_tokens_b8_columns.php create mode 100644 framework/core/migrations/2018_01_18_130400_rename_permissions_to_group_permissions.php create mode 100644 framework/core/migrations/2018_01_18_130400_rename_users_groups_to_groups_users.php create mode 100644 framework/core/migrations/2018_01_18_132900_create_notifications_from_table.php create mode 100644 framework/core/migrations/2018_01_18_133000_change_notifications_b8_columns.php create mode 100644 framework/core/migrations/2018_01_18_134400_change_password_tokens_id_to_token.php create mode 100644 framework/core/migrations/2018_01_18_135000_change_posts_b8_columns.php create mode 100644 framework/core/migrations/2018_01_19_084700_change_settings_value_longblob.php create mode 100644 framework/core/migrations/2018_01_30_220100_create_posts_users_table.php create mode 100644 framework/core/migrations/2018_01_30_222900_change_users_b8_columns.php create mode 100644 framework/core/migrations/2018_01_30_223700_create_users_users_table.php diff --git a/framework/core/migrations/2018_01_11_093900_change_access_tokens_b8_columns.php b/framework/core/migrations/2018_01_11_093900_change_access_tokens_b8_columns.php new file mode 100644 index 000000000..9fd9df5fb --- /dev/null +++ b/framework/core/migrations/2018_01_11_093900_change_access_tokens_b8_columns.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Schema\Builder; + +return [ + 'up' => function (Builder $schema) { + $schema->table('access_tokens', function (Blueprint $table) { + $table->renameColumn('id', 'token'); + $table->renameColumn('lifetime', 'lifetime_seconds'); + $table->renameColumn('last_activity', 'last_activity_at'); + $table->dateTime('created_at'); + }); + }, + + 'down' => function (Builder $schema) { + $schema->table('access_tokens', function (Blueprint $table) { + $table->renameColumn('lifetime_seconds', 'lifetime'); + $table->renameColumn('last_activity_at', 'last_activity'); + $table->dropColumn('created_at'); + $table->renameColumn('token', 'id'); + }); + } +]; diff --git a/framework/core/migrations/2018_01_11_094800_change_access_tokens_make_activity_at_column_datetime.php b/framework/core/migrations/2018_01_11_094800_change_access_tokens_make_activity_at_column_datetime.php new file mode 100644 index 000000000..3e555f1ca --- /dev/null +++ b/framework/core/migrations/2018_01_11_094800_change_access_tokens_make_activity_at_column_datetime.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Schema\Builder; + +return [ + 'up' => function (Builder $schema) { + $schema->table('access_tokens', function (Blueprint $table) { + $table->dateTime('last_activity_at')->change(); + }); + }, + + 'down' => function (Builder $schema) { + $schema->table('access_tokens', function (Blueprint $table) { + $table->integer('last_activity_at')->change(); + }); + } +]; diff --git a/framework/core/migrations/2018_01_11_094900_change_api_keys_rename_id_to_key.php b/framework/core/migrations/2018_01_11_094900_change_api_keys_rename_id_to_key.php new file mode 100644 index 000000000..7135025a7 --- /dev/null +++ b/framework/core/migrations/2018_01_11_094900_change_api_keys_rename_id_to_key.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Schema\Builder; + +return [ + 'up' => function (Builder $schema) { + $schema->table('api_keys', function (Blueprint $table) { + $table->renameColumn('id', 'key'); + $table->dropPrimary(['id', 'key']); + }); + }, + + 'down' => function (Builder $schema) { + $schema->table('api_keys', function (Blueprint $table) { + $table->renameColumn('key', 'id'); + $table->primary('id'); + }); + } +]; diff --git a/framework/core/migrations/2018_01_11_095000_change_api_keys_b8_columns.php b/framework/core/migrations/2018_01_11_095000_change_api_keys_b8_columns.php new file mode 100644 index 000000000..478c578cf --- /dev/null +++ b/framework/core/migrations/2018_01_11_095000_change_api_keys_b8_columns.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Schema\Builder; + +return [ + 'up' => function (Builder $schema) { + $schema->table('api_keys', function (Blueprint $table) { + $table->increments('id'); + $table->string('allowed_ips')->nullable(); + $table->string('scopes')->nullable(); + $table->integer('user_id')->unsigned()->nullable(); + $table->dateTime('created_at'); + $table->dateTime('last_activity_at')->nullable(); + + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + }); + }, + + 'down' => function (Builder $schema) { + $schema->table('api_keys', function (Blueprint $table) { + $table->dropForeign(['user_id']); + $table->dropColumn('id', 'allowed_ips', 'user_id', 'scopes', 'created_at'); + }); + } +]; diff --git a/framework/core/migrations/2018_01_11_101800_rename_auth_tokens_to_registration_tokens.php b/framework/core/migrations/2018_01_11_101800_rename_auth_tokens_to_registration_tokens.php new file mode 100644 index 000000000..eaf176a0d --- /dev/null +++ b/framework/core/migrations/2018_01_11_101800_rename_auth_tokens_to_registration_tokens.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Flarum\Database\Migration; + +return Migration::renameTable('auth_tokens', 'registration_tokens'); diff --git a/framework/core/migrations/2018_01_11_102000_change_registration_tokens_rename_id_to_token.php b/framework/core/migrations/2018_01_11_102000_change_registration_tokens_rename_id_to_token.php new file mode 100644 index 000000000..6a538622b --- /dev/null +++ b/framework/core/migrations/2018_01_11_102000_change_registration_tokens_rename_id_to_token.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Schema\Builder; + +return [ + 'up' => function (Builder $schema) { + $schema->table('registration_tokens', function (Blueprint $table) { + $table->renameColumn('id', 'token'); + }); + }, + + 'down' => function (Builder $schema) { + $schema->table('registration_tokens', function (Blueprint $table) { + $table->renameColumn('token', 'id'); + }); + } +]; diff --git a/framework/core/migrations/2018_01_11_155200_change_discussions_b8_columns.php b/framework/core/migrations/2018_01_11_155200_change_discussions_b8_columns.php new file mode 100644 index 000000000..c88fa528a --- /dev/null +++ b/framework/core/migrations/2018_01_11_155200_change_discussions_b8_columns.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Schema\Builder; + +return [ + 'up' => function (Builder $schema) { + $schema->table('discussions', function (Blueprint $table) { + $table->renameColumn('comments_count', 'comment_count'); + $table->renameColumn('participants_count', 'participant_count'); + $table->renameColumn('number_index', 'post_number_index'); + $table->renameColumn('start_time', 'created_at'); + $table->renameColumn('start_user_id', 'user_id'); + $table->renameColumn('start_post_id', 'first_post_id'); + $table->renameColumn('last_time', 'last_posted_at'); + $table->renameColumn('last_user_id', 'last_posted_user_id'); + $table->renameColumn('hide_time', 'hidden_at'); + $table->renameColumn('hide_user_id', 'hidden_user_id'); + }); + }, + + 'down' => function (Builder $schema) { + $schema->table('discussions', function (Blueprint $table) { + $table->renameColumn('comment_count', 'comments_count'); + $table->renameColumn('participant_count', 'participants_count'); + $table->renameColumn('post_number_index', 'number_index'); + $table->renameColumn('created_at', 'start_time'); + $table->renameColumn('user_id', 'start_user_id'); + $table->renameColumn('first_post_id', 'start_post_id'); + $table->renameColumn('last_posted_at', 'last_time'); + $table->renameColumn('last_posted_user_id', 'last_user_id'); + $table->renameColumn('hidden_at', 'hide_time'); + $table->renameColumn('hidden_user_id', 'hide_user_id'); + }); + } +]; diff --git a/framework/core/migrations/2018_01_15_071700_change_user_discussions_discussions_users.php b/framework/core/migrations/2018_01_15_071700_change_user_discussions_discussions_users.php new file mode 100644 index 000000000..c0e48bb91 --- /dev/null +++ b/framework/core/migrations/2018_01_15_071700_change_user_discussions_discussions_users.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Illuminate\Database\Schema\Builder; + +return [ + 'up' => function (Builder $schema) { + $schema->rename('users_discussions', 'discussions_users'); + }, + + 'down' => function (Builder $schema) { + $schema->rename('discussions_users', 'users_discussions'); + } +]; diff --git a/framework/core/migrations/2018_01_15_071800_change_discussions_users_b8_columns.php b/framework/core/migrations/2018_01_15_071800_change_discussions_users_b8_columns.php new file mode 100644 index 000000000..5797a033f --- /dev/null +++ b/framework/core/migrations/2018_01_15_071800_change_discussions_users_b8_columns.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Schema\Builder; + +return [ + 'up' => function (Builder $schema) { + $schema->table('discussions_users', function (Blueprint $table) { + $table->renameColumn('read_time', 'last_read_at'); + $table->renameColumn('read_number', 'last_read_post_number'); + }); + }, + + 'down' => function (Builder $schema) { + $schema->table('discussions_users', function (Blueprint $table) { + $table->renameColumn('last_read_at', 'read_time'); + $table->renameColumn('last_read_post_number', 'read_number'); + }); + } +]; diff --git a/framework/core/migrations/2018_01_15_072600_change_email_tokens_b8_columns.php b/framework/core/migrations/2018_01_15_072600_change_email_tokens_b8_columns.php new file mode 100644 index 000000000..4bb891a1f --- /dev/null +++ b/framework/core/migrations/2018_01_15_072600_change_email_tokens_b8_columns.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Schema\Builder; + +return [ + 'up' => function (Builder $schema) { + $schema->table('email_tokens', function (Blueprint $table) { + $table->renameColumn('id', 'token'); + }); + }, + + 'down' => function (Builder $schema) { + $schema->table('email_tokens', function (Blueprint $table) { + $table->renameColumn('token', 'id'); + }); + } +]; diff --git a/framework/core/migrations/2018_01_18_130400_rename_permissions_to_group_permissions.php b/framework/core/migrations/2018_01_18_130400_rename_permissions_to_group_permissions.php new file mode 100644 index 000000000..8d8761878 --- /dev/null +++ b/framework/core/migrations/2018_01_18_130400_rename_permissions_to_group_permissions.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Flarum\Database\Migration; + +return Migration::renameTable('permissions', 'groups_permissions'); diff --git a/framework/core/migrations/2018_01_18_130400_rename_users_groups_to_groups_users.php b/framework/core/migrations/2018_01_18_130400_rename_users_groups_to_groups_users.php new file mode 100644 index 000000000..40f4178f9 --- /dev/null +++ b/framework/core/migrations/2018_01_18_130400_rename_users_groups_to_groups_users.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Flarum\Database\Migration; + +return Migration::renameTable('users_groups', 'group_user'); diff --git a/framework/core/migrations/2018_01_18_132900_create_notifications_from_table.php b/framework/core/migrations/2018_01_18_132900_create_notifications_from_table.php new file mode 100644 index 000000000..83fad7b64 --- /dev/null +++ b/framework/core/migrations/2018_01_18_132900_create_notifications_from_table.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Schema\Builder; + +return [ + 'up' => function (Builder $schema) { + $schema->create('notifications_from', function (Blueprint $table) { + $table->integer('id')->unsigned(); + $table->integer('from_user_id')->unsigned(); + + $table->foreign('id')->references('id')->on('notifications')->onDelete('cascade'); + $table->foreign('from_user_id')->references('id')->on('users')->onDelete('cascade'); + }); + + $schema->getConnection()->table('notifications')->chunkById(100, function ($notifications) use ($schema) { + foreach ($notifications as $notification) { + $insert = [ + 'id' => $notification->id, + 'from_user_id' => $notification->sender_id + ]; + + $schema->getConnection()->table('notifications_from')->updateOrInsert($insert, $insert); + } + }); + }, + + 'down' => function (Builder $schema) { + $schema->drop('notifications_from'); + } +]; diff --git a/framework/core/migrations/2018_01_18_133000_change_notifications_b8_columns.php b/framework/core/migrations/2018_01_18_133000_change_notifications_b8_columns.php new file mode 100644 index 000000000..2261b0248 --- /dev/null +++ b/framework/core/migrations/2018_01_18_133000_change_notifications_b8_columns.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Schema\Builder; + +return [ + 'up' => function (Builder $schema) { + $schema->table('notifications', function (Blueprint $table) { + $table->dropColumn('sender_id', 'subject_type'); + + $table->renameColumn('time', 'created_at'); + + $table->timestamp('read_at')->nullable(); + $table->timestamp('deleted_at')->nullable(); + }); + + $schema->getConnection()->table('notifications') + ->where('is_read', 1) + ->update(['read_at' => time()]); + + $schema->getConnection()->table('notifications') + ->where('is_deleted', 1) + ->update(['deleted_at' => time()]); + + $schema->table('notifications', function (Blueprint $table) { + $table->dropColumn('is_read'); + $table->dropColumn('is_deleted'); + }); + }, + + 'down' => function (Builder $schema) { + $schema->table('notifications', function (Blueprint $table) { + $table->integer('sender_id')->unsigned()->nullable(); + $table->string('subject_type', 200)->nullable(); + + $table->renameColumn('created_at', 'time'); + + $table->boolean('is_read'); + $table->boolean('is_deleted'); + }); + + $schema->getConnection()->table('notifications') + ->whereNotNull('read_at') + ->update(['is_read' => 1]); + $schema->getConnection()->table('notifications') + ->whereNotNull('deleted_at') + ->update(['is_deleted' => 1]); + + $schema->table('notifications', function (Blueprint $table) { + $table->dropColumn('read_at'); + $table->dropColumn('deleted_at'); + }); + } +]; diff --git a/framework/core/migrations/2018_01_18_134400_change_password_tokens_id_to_token.php b/framework/core/migrations/2018_01_18_134400_change_password_tokens_id_to_token.php new file mode 100644 index 000000000..e83f8692a --- /dev/null +++ b/framework/core/migrations/2018_01_18_134400_change_password_tokens_id_to_token.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Flarum\Database\Migration; + +return Migration::renameColumn('password_tokens', 'id', 'token'); diff --git a/framework/core/migrations/2018_01_18_135000_change_posts_b8_columns.php b/framework/core/migrations/2018_01_18_135000_change_posts_b8_columns.php new file mode 100644 index 000000000..03b44f92c --- /dev/null +++ b/framework/core/migrations/2018_01_18_135000_change_posts_b8_columns.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Schema\Builder; + +return [ + 'up' => function (Builder $schema) { + $schema->table('posts', function (Blueprint $table) { + $table->renameColumn('time', 'created_at'); + $table->renameColumn('edit_time', 'edited_at'); + $table->renameColumn('hide_time', 'hidden_at'); + + $table->renameColumn('edit_user_id', 'edited_user_id'); + $table->renameColumn('hide_user_id', 'hidden_user_id'); + + $table->longText('content')->change(); + }); + }, + + 'down' => function (Builder $schema) { + $schema->table('posts', function (Blueprint $table) { + $table->renameColumn('created_at', 'time'); + $table->renameColumn('edited_at', 'edit_time'); + $table->renameColumn('hidden_at', 'hide_time'); + + $table->renameColumn('edited_user_id', 'edit_user_id'); + $table->renameColumn('edited_user_id', 'hidden_user_id'); + }); + + $prefix = $schema->getConnection()->getTablePrefix(); + $schema->getConnection()->statement('ALTER TABLE '.$prefix.'posts MODIFY content FULLTEXT'); + } +]; diff --git a/framework/core/migrations/2018_01_19_084700_change_settings_value_longblob.php b/framework/core/migrations/2018_01_19_084700_change_settings_value_longblob.php new file mode 100644 index 000000000..b6493cfc4 --- /dev/null +++ b/framework/core/migrations/2018_01_19_084700_change_settings_value_longblob.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Schema\Builder; + +return [ + 'up' => function (Builder $schema) { + $prefix = $schema->getConnection()->getTablePrefix(); +// $schema->getConnection()->statement('ALTER TABLE '.$prefix.'settings MODIFY "value" LONGBLOB'); + }, + + 'down' => function (Builder $schema) { + $schema->table('posts', function (Blueprint $table) { +// $table->longText('value')->nullable()->change(); + }); + } +]; diff --git a/framework/core/migrations/2018_01_30_220100_create_posts_users_table.php b/framework/core/migrations/2018_01_30_220100_create_posts_users_table.php new file mode 100644 index 000000000..ba1d3e952 --- /dev/null +++ b/framework/core/migrations/2018_01_30_220100_create_posts_users_table.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Schema\Builder; + +return [ + 'up' => function (Builder $schema) { + $schema->create('posts_users', function (Blueprint $table) { + $table->integer('post_id')->unsigned(); + $table->integer('user_id')->unsigned(); + + $table->foreign('post_id')->references('id')->on('posts')->onDelete('cascade'); + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + }); + }, + + 'down' => function (Builder $schema) { + $schema->drop('posts_users'); + } +]; diff --git a/framework/core/migrations/2018_01_30_222900_change_users_b8_columns.php b/framework/core/migrations/2018_01_30_222900_change_users_b8_columns.php new file mode 100644 index 000000000..1826ea34b --- /dev/null +++ b/framework/core/migrations/2018_01_30_222900_change_users_b8_columns.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Schema\Builder; + +return [ + 'up' => function (Builder $schema) { + $schema->table('users', function (Blueprint $table) { + $table->renameColumn('is_activated', 'is_email_confirmed'); + $table->renameColumn('join_time', 'joined_at'); + $table->renameColumn('last_seen_time', 'last_seen_at'); + $table->renameColumn('discussions_count', 'discussion_count'); + $table->renameColumn('comments_count', 'comment_count'); + $table->renameColumn('read_time', 'marked_all_as_read_at'); + $table->renameColumn('notifications_read_time', 'read_notifications_at'); + $table->renameColumn('avatar_path', 'avatar_url'); + $table->dropColumn('bio', 'preferences'); + }); + }, + + 'down' => function (Builder $schema) { + $schema->table('users', function (Blueprint $table) { + $table->renameColumn('is_email_confirmed', 'is_activated'); + $table->renameColumn('joined_at', 'join_time'); + $table->renameColumn('last_seen_at', 'last_seen_time'); + $table->renameColumn('discussion_count', 'discussions_count'); + $table->renameColumn('comment_count', 'comments_count'); + $table->renameColumn('marked_all_as_read_at', 'read_time'); + $table->renameColumn('read_notifications_at', 'notifications_read_time'); + $table->renameColumn('avatar_url', 'avatar_path'); + $table->text('bio')->nullable(); + $table->binary('preferences')->nullable(); + }); + } +]; diff --git a/framework/core/migrations/2018_01_30_223700_create_users_users_table.php b/framework/core/migrations/2018_01_30_223700_create_users_users_table.php new file mode 100644 index 000000000..ed74651c1 --- /dev/null +++ b/framework/core/migrations/2018_01_30_223700_create_users_users_table.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Schema\Builder; + +return [ + 'up' => function (Builder $schema) { + $schema->create('users_users', function (Blueprint $table) { + $table->integer('user_id')->unsigned(); + $table->integer('other_user_id')->unsigned(); + + $table->foreign('user_id')->references('id')->on('posts')->onDelete('cascade'); + $table->foreign('other_user_id')->references('id')->on('users')->onDelete('cascade'); + }); + }, + + 'down' => function (Builder $schema) { + $schema->drop('users_users'); + } +];