0
0
Fork 0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-04-18 10:28:43 +00:00

Migrations: Updated with type hints instead of php doc

Also updated code to properly import used facades.
For 
This commit is contained in:
Dan Brown 2024-03-17 15:29:09 +00:00
parent d6b7717985
commit 45d52f27ae
No known key found for this signature in database
GPG key ID: 46D9F943C24A2EF9
83 changed files with 241 additions and 523 deletions
database/migrations
2014_10_12_000000_create_users_table.php2014_10_12_100000_create_password_resets_table.php2015_07_12_114933_create_books_table.php2015_07_12_190027_create_pages_table.php2015_07_13_172121_create_images_table.php2015_07_27_172342_create_chapters_table.php2015_08_08_200447_add_users_to_entities.php2015_08_09_093534_create_page_revisions_table.php2015_08_16_142133_create_activities_table.php2015_08_29_105422_add_roles_and_permissions.php2015_08_30_125859_create_settings_table.php2015_08_31_175240_add_search_indexes.php2015_09_04_165821_create_social_accounts_table.php2015_09_05_164707_add_email_confirmation_table.php2015_11_21_145609_create_views_table.php2015_11_26_221857_add_entity_indexes.php2015_12_05_145049_fulltext_weighting.php2015_12_07_195238_add_image_upload_types.php2015_12_09_195748_add_user_avatars.php2016_01_11_210908_add_external_auth_to_users.php2016_02_25_184030_add_slug_to_revisions.php2016_02_27_120329_update_permissions_and_roles.php2016_02_28_084200_add_entity_access_controls.php2016_03_09_203143_add_page_revision_types.php2016_03_13_082138_add_page_drafts.php2016_03_25_123157_add_markdown_support.php2016_04_09_100730_add_view_permissions_to_roles.php2016_04_20_192649_create_joint_permissions_table.php2016_05_06_185215_create_tags_table.php2016_07_07_181521_add_summary_to_page_revisions.php2016_09_29_101449_remove_hidden_roles.php2016_10_09_142037_create_attachments_table.php2017_01_21_163556_create_cache_table.php2017_01_21_163602_create_sessions_table.php2017_03_19_091553_create_search_index_table.php2017_04_20_185112_add_revision_counts.php2017_07_02_152834_update_db_encoding_to_ut8mb4.php2017_08_01_130541_create_comments_table.php2017_08_29_102650_add_cover_image_display.php2018_07_15_173514_add_role_external_auth_id.php2018_08_04_115700_create_bookshelves_table.php2019_07_07_112515_add_template_support.php2019_08_17_140214_add_user_invites_table.php2019_12_29_120917_add_api_auth.php2020_08_04_111754_drop_joint_permissions_id.php2020_08_04_131052_remove_role_name_field.php2020_09_19_094251_add_activity_indexes.php2020_09_27_210059_add_entity_soft_deletes.php2020_09_27_210528_create_deletions_table.php2020_11_07_232321_simplify_activities_table.php2020_12_30_173528_add_owned_by_field_to_entities.php2021_01_30_225441_add_settings_type_column.php2021_03_08_215138_add_user_slug.php2021_05_15_173110_create_favourites_table.php2021_06_30_173111_create_mfa_values_table.php2021_07_03_085038_add_mfa_enforced_to_roles_table.php2021_08_28_161743_add_export_role_permission.php2021_09_26_044614_add_activities_ip_column.php2021_11_26_070438_add_index_for_user_ip.php2021_12_07_111343_create_webhooks_table.php2021_12_13_152024_create_jobs_table.php2021_12_13_152120_create_failed_jobs_table.php2022_01_03_154041_add_webhooks_timeout_error_columns.php2022_04_17_101741_add_editor_change_field_and_permission.php2022_04_25_140741_update_polymorphic_types.php2022_07_16_170051_drop_joint_permission_type.php2022_08_17_092941_create_references_table.php2022_09_02_082910_fix_shelf_cover_image_types.php2022_10_07_091406_flatten_entity_permissions_table.php2022_10_08_104202_drop_entity_restricted_field.php2023_01_24_104625_refactor_joint_permissions_storage.php2023_01_28_141230_copy_color_settings_for_dark_mode.php2023_02_20_093655_increase_attachments_path_length.php2023_02_23_200227_add_updated_at_index_to_pages.php2023_06_10_071823_remove_guest_user_secondary_roles.php2023_06_25_181952_remove_bookshelf_create_entity_permissions.php2023_07_25_124945_add_receive_notifications_role_permissions.php2023_07_31_104430_create_watches_table.php2023_08_21_174248_increase_cache_size.php2023_12_02_104541_add_default_template_to_books.php2023_12_17_140913_add_description_html_to_entities.php2024_01_01_104542_add_default_template_to_chapters.php2024_02_04_141358_add_views_updated_index.php

View file

@ -1,16 +1,17 @@
<?php <?php
use Carbon\Carbon;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('users', function (Blueprint $table) { Schema::create('users', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -26,17 +27,15 @@ return new class extends Migration
'name' => 'Admin', 'name' => 'Admin',
'email' => 'admin@admin.com', 'email' => 'admin@admin.com',
'password' => bcrypt('password'), 'password' => bcrypt('password'),
'created_at' => \Carbon\Carbon::now()->toDateTimeString(), 'created_at' => Carbon::now()->toDateTimeString(),
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(),
]); ]);
} }
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::drop('users'); Schema::drop('users');
} }

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('password_resets', function (Blueprint $table) { Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index(); $table->string('email')->index();
@ -21,10 +20,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::drop('password_resets'); Schema::drop('password_resets');
} }

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('books', function (Blueprint $table) { Schema::create('books', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -23,10 +22,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::drop('books'); Schema::drop('books');
} }

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('pages', function (Blueprint $table) { Schema::create('pages', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -27,10 +26,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::drop('pages'); Schema::drop('pages');
} }

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('images', function (Blueprint $table) { Schema::create('images', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -22,10 +21,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::drop('images'); Schema::drop('images');
} }

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('chapters', function (Blueprint $table) { Schema::create('chapters', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -25,10 +24,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::drop('chapters'); Schema::drop('chapters');
} }

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('pages', function (Blueprint $table) { Schema::table('pages', function (Blueprint $table) {
$table->integer('created_by'); $table->integer('created_by');
@ -32,10 +31,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('pages', function (Blueprint $table) { Schema::table('pages', function (Blueprint $table) {
$table->dropColumn('created_by'); $table->dropColumn('created_by');

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('page_revisions', function (Blueprint $table) { Schema::create('page_revisions', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -25,10 +24,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::drop('page_revisions'); Schema::drop('page_revisions');
} }

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('activities', function (Blueprint $table) { Schema::create('activities', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -26,10 +25,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::drop('activities'); Schema::drop('activities');
} }

View file

@ -10,17 +10,18 @@
* @url https://github.com/Zizaco/entrust * @url https://github.com/Zizaco/entrust
*/ */
use Carbon\Carbon;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
// Create table for storing roles // Create table for storing roles
Schema::create('roles', function (Blueprint $table) { Schema::create('roles', function (Blueprint $table) {
@ -71,22 +72,22 @@ return new class extends Migration
'name' => 'admin', 'name' => 'admin',
'display_name' => 'Admin', 'display_name' => 'Admin',
'description' => 'Administrator of the whole application', 'description' => 'Administrator of the whole application',
'created_at' => \Carbon\Carbon::now()->toDateTimeString(), 'created_at' => Carbon::now()->toDateTimeString(),
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(),
]); ]);
$editorId = DB::table('roles')->insertGetId([ $editorId = DB::table('roles')->insertGetId([
'name' => 'editor', 'name' => 'editor',
'display_name' => 'Editor', 'display_name' => 'Editor',
'description' => 'User can edit Books, Chapters & Pages', 'description' => 'User can edit Books, Chapters & Pages',
'created_at' => \Carbon\Carbon::now()->toDateTimeString(), 'created_at' => Carbon::now()->toDateTimeString(),
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(),
]); ]);
$viewerId = DB::table('roles')->insertGetId([ $viewerId = DB::table('roles')->insertGetId([
'name' => 'viewer', 'name' => 'viewer',
'display_name' => 'Viewer', 'display_name' => 'Viewer',
'description' => 'User can view books & their content behind authentication', 'description' => 'User can view books & their content behind authentication',
'created_at' => \Carbon\Carbon::now()->toDateTimeString(), 'created_at' => Carbon::now()->toDateTimeString(),
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(),
]); ]);
// Create default CRUD permissions and allocate to admins and editors // Create default CRUD permissions and allocate to admins and editors
@ -97,8 +98,8 @@ return new class extends Migration
$newPermId = DB::table('permissions')->insertGetId([ $newPermId = DB::table('permissions')->insertGetId([
'name' => strtolower($entity) . '-' . strtolower($op), 'name' => strtolower($entity) . '-' . strtolower($op),
'display_name' => $op . ' ' . $entity . 's', 'display_name' => $op . ' ' . $entity . 's',
'created_at' => \Carbon\Carbon::now()->toDateTimeString(), 'created_at' => Carbon::now()->toDateTimeString(),
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(),
]); ]);
DB::table('permission_role')->insert([ DB::table('permission_role')->insert([
['permission_id' => $newPermId, 'role_id' => $adminId], ['permission_id' => $newPermId, 'role_id' => $adminId],
@ -115,8 +116,8 @@ return new class extends Migration
$newPermId = DB::table('permissions')->insertGetId([ $newPermId = DB::table('permissions')->insertGetId([
'name' => strtolower($entity) . '-' . strtolower($op), 'name' => strtolower($entity) . '-' . strtolower($op),
'display_name' => $op . ' ' . $entity, 'display_name' => $op . ' ' . $entity,
'created_at' => \Carbon\Carbon::now()->toDateTimeString(), 'created_at' => Carbon::now()->toDateTimeString(),
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(),
]); ]);
DB::table('permission_role')->insert([ DB::table('permission_role')->insert([
'permission_id' => $newPermId, 'permission_id' => $newPermId,
@ -138,10 +139,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::drop('permission_role'); Schema::drop('permission_role');
Schema::drop('permissions'); Schema::drop('permissions');

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('settings', function (Blueprint $table) { Schema::create('settings', function (Blueprint $table) {
$table->string('setting_key')->primary()->indexed(); $table->string('setting_key')->primary()->indexed();
@ -21,10 +20,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::drop('settings'); Schema::drop('settings');
} }

View file

@ -2,13 +2,12 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up()
{ {
@ -23,10 +22,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
$sm = Schema::getConnection()->getDoctrineSchemaManager(); $sm = Schema::getConnection()->getDoctrineSchemaManager();
$pages = $sm->listTableDetails('pages'); $pages = $sm->listTableDetails('pages');

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('social_accounts', function (Blueprint $table) { Schema::create('social_accounts', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -24,10 +23,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::drop('social_accounts'); Schema::drop('social_accounts');
} }

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('users', function (Blueprint $table) { Schema::table('users', function (Blueprint $table) {
$table->boolean('email_confirmed')->default(true); $table->boolean('email_confirmed')->default(true);
@ -26,10 +25,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('users', function (Blueprint $table) { Schema::table('users', function (Blueprint $table) {
$table->dropColumn('email_confirmed'); $table->dropColumn('email_confirmed');

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('views', function (Blueprint $table) { Schema::create('views', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -24,10 +23,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::drop('views'); Schema::drop('views');
} }

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('books', function (Blueprint $table) { Schema::table('books', function (Blueprint $table) {
$table->index('slug'); $table->index('slug');
@ -48,10 +47,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('books', function (Blueprint $table) { Schema::table('books', function (Blueprint $table) {
$table->dropIndex('books_slug_index'); $table->dropIndex('books_slug_index');

View file

@ -2,13 +2,12 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up()
{ {
@ -23,10 +22,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
$sm = Schema::getConnection()->getDoctrineSchemaManager(); $sm = Schema::getConnection()->getDoctrineSchemaManager();
$pages = $sm->listTableDetails('pages'); $pages = $sm->listTableDetails('pages');

View file

@ -3,15 +3,14 @@
use BookStack\Uploads\Image; use BookStack\Uploads\Image;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('images', function (Blueprint $table) { Schema::table('images', function (Blueprint $table) {
$table->string('path', 400); $table->string('path', 400);
@ -27,10 +26,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('images', function (Blueprint $table) { Schema::table('images', function (Blueprint $table) {
$table->dropColumn('type'); $table->dropColumn('type');

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('users', function (Blueprint $table) { Schema::table('users', function (Blueprint $table) {
$table->integer('image_id')->default(0); $table->integer('image_id')->default(0);
@ -19,10 +18,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('users', function (Blueprint $table) { Schema::table('users', function (Blueprint $table) {
$table->dropColumn('image_id'); $table->dropColumn('image_id');

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('users', function (Blueprint $table) { Schema::table('users', function (Blueprint $table) {
$table->string('external_auth_id')->index(); $table->string('external_auth_id')->index();
@ -19,10 +18,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('users', function (Blueprint $table) { Schema::table('users', function (Blueprint $table) {
$table->dropColumn('external_auth_id'); $table->dropColumn('external_auth_id');

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('page_revisions', function (Blueprint $table) { Schema::table('page_revisions', function (Blueprint $table) {
$table->string('slug'); $table->string('slug');
@ -22,10 +21,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('page_revisions', function (Blueprint $table) { Schema::table('page_revisions', function (Blueprint $table) {
$table->dropColumn('slug'); $table->dropColumn('slug');

View file

@ -1,15 +1,15 @@
<?php <?php
use Carbon\Carbon;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
// Get roles with permissions we need to change // Get roles with permissions we need to change
$adminRoleId = DB::table('roles')->where('name', '=', 'admin')->first()->id; $adminRoleId = DB::table('roles')->where('name', '=', 'admin')->first()->id;
@ -30,8 +30,8 @@ return new class extends Migration
$permissionId = DB::table('permissions')->insertGetId([ $permissionId = DB::table('permissions')->insertGetId([
'name' => $name, 'name' => $name,
'display_name' => $displayName, 'display_name' => $displayName,
'created_at' => \Carbon\Carbon::now()->toDateTimeString(), 'created_at' => Carbon::now()->toDateTimeString(),
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(),
]); ]);
DB::table('permission_role')->insert([ DB::table('permission_role')->insert([
'role_id' => $adminRoleId, 'role_id' => $adminRoleId,
@ -47,8 +47,8 @@ return new class extends Migration
$permissionId = DB::table('permissions')->insertGetId([ $permissionId = DB::table('permissions')->insertGetId([
'name' => strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op)), 'name' => strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op)),
'display_name' => $op . ' ' . $entity . 's', 'display_name' => $op . ' ' . $entity . 's',
'created_at' => \Carbon\Carbon::now()->toDateTimeString(), 'created_at' => Carbon::now()->toDateTimeString(),
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(),
]); ]);
DB::table('permission_role')->insert([ DB::table('permission_role')->insert([
'role_id' => $adminRoleId, 'role_id' => $adminRoleId,
@ -66,10 +66,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
// Get roles with permissions we need to change // Get roles with permissions we need to change
$adminRoleId = DB::table('roles')->where('name', '=', 'admin')->first()->id; $adminRoleId = DB::table('roles')->where('name', '=', 'admin')->first()->id;
@ -85,8 +83,8 @@ return new class extends Migration
$permissionId = DB::table('permissions')->insertGetId([ $permissionId = DB::table('permissions')->insertGetId([
'name' => strtolower($entity) . '-' . strtolower($op), 'name' => strtolower($entity) . '-' . strtolower($op),
'display_name' => $op . ' ' . $entity . 's', 'display_name' => $op . ' ' . $entity . 's',
'created_at' => \Carbon\Carbon::now()->toDateTimeString(), 'created_at' => Carbon::now()->toDateTimeString(),
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(),
]); ]);
DB::table('permission_role')->insert([ DB::table('permission_role')->insert([
'role_id' => $adminRoleId, 'role_id' => $adminRoleId,
@ -103,8 +101,8 @@ return new class extends Migration
$permissionId = DB::table('permissions')->insertGetId([ $permissionId = DB::table('permissions')->insertGetId([
'name' => strtolower($entity) . '-' . strtolower($op), 'name' => strtolower($entity) . '-' . strtolower($op),
'display_name' => $op . ' ' . $entity, 'display_name' => $op . ' ' . $entity,
'created_at' => \Carbon\Carbon::now()->toDateTimeString(), 'created_at' => Carbon::now()->toDateTimeString(),
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(),
]); ]);
DB::table('permission_role')->insert([ DB::table('permission_role')->insert([
'role_id' => $adminRoleId, 'role_id' => $adminRoleId,

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('images', function (Blueprint $table) { Schema::table('images', function (Blueprint $table) {
$table->integer('uploaded_to')->default(0); $table->integer('uploaded_to')->default(0);
@ -46,10 +45,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('images', function (Blueprint $table) { Schema::table('images', function (Blueprint $table) {
$table->dropColumn('uploaded_to'); $table->dropColumn('uploaded_to');

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('page_revisions', function (Blueprint $table) { Schema::table('page_revisions', function (Blueprint $table) {
$table->string('type')->default('version'); $table->string('type')->default('version');
@ -20,10 +19,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('page_revisions', function (Blueprint $table) { Schema::table('page_revisions', function (Blueprint $table) {
$table->dropColumn('type'); $table->dropColumn('type');

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('pages', function (Blueprint $table) { Schema::table('pages', function (Blueprint $table) {
$table->boolean('draft')->default(false); $table->boolean('draft')->default(false);
@ -20,10 +19,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('pages', function (Blueprint $table) { Schema::table('pages', function (Blueprint $table) {
$table->dropColumn('draft'); $table->dropColumn('draft');

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('pages', function (Blueprint $table) { Schema::table('pages', function (Blueprint $table) {
$table->longText('markdown')->default(''); $table->longText('markdown')->default('');
@ -23,10 +22,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('pages', function (Blueprint $table) { Schema::table('pages', function (Blueprint $table) {
$table->dropColumn('markdown'); $table->dropColumn('markdown');

View file

@ -1,15 +1,15 @@
<?php <?php
use Carbon\Carbon;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
$currentRoles = DB::table('roles')->get(); $currentRoles = DB::table('roles')->get();
@ -21,8 +21,8 @@ return new class extends Migration
$permId = DB::table('permissions')->insertGetId([ $permId = DB::table('permissions')->insertGetId([
'name' => strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op)), 'name' => strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op)),
'display_name' => $op . ' ' . $entity . 's', 'display_name' => $op . ' ' . $entity . 's',
'created_at' => \Carbon\Carbon::now()->toDateTimeString(), 'created_at' => Carbon::now()->toDateTimeString(),
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(),
]); ]);
// Assign view permission to all current roles // Assign view permission to all current roles
foreach ($currentRoles as $role) { foreach ($currentRoles as $role) {
@ -37,10 +37,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
// Delete the new view permission // Delete the new view permission
$entities = ['Book', 'Page', 'Chapter']; $entities = ['Book', 'Page', 'Chapter'];

View file

@ -1,17 +1,18 @@
<?php <?php
use Carbon\Carbon;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str; use Illuminate\Support\Str;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('joint_permissions', function (Blueprint $table) { Schema::create('joint_permissions', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -48,8 +49,8 @@ return new class extends Migration
'description' => 'The role given to public visitors if allowed', 'description' => 'The role given to public visitors if allowed',
'system_name' => 'public', 'system_name' => 'public',
'hidden' => true, 'hidden' => true,
'created_at' => \Carbon\Carbon::now()->toDateTimeString(), 'created_at' => Carbon::now()->toDateTimeString(),
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(),
]; ];
// Ensure unique name // Ensure unique name
@ -79,10 +80,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::drop('joint_permissions'); Schema::drop('joint_permissions');

View file

@ -2,15 +2,14 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('tags', function (Blueprint $table) { Schema::create('tags', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -30,10 +29,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::drop('tags'); Schema::drop('tags');
} }

View file

@ -1,15 +1,14 @@
<?php <?php
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('page_revisions', function ($table) { Schema::table('page_revisions', function ($table) {
$table->string('summary')->nullable(); $table->string('summary')->nullable();
@ -18,10 +17,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('page_revisions', function ($table) { Schema::table('page_revisions', function ($table) {
$table->dropColumn('summary'); $table->dropColumn('summary');

View file

@ -1,17 +1,17 @@
<?php <?php
use Carbon\Carbon;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
// Remove the hidden property from roles // Remove the hidden property from roles
Schema::table('roles', function (Blueprint $table) { Schema::table('roles', function (Blueprint $table) {
@ -29,8 +29,8 @@ return new class extends Migration
'name' => 'Guest', 'name' => 'Guest',
'system_name' => 'public', 'system_name' => 'public',
'email_confirmed' => true, 'email_confirmed' => true,
'created_at' => \Carbon\Carbon::now(), 'created_at' => Carbon::now(),
'updated_at' => \Carbon\Carbon::now(), 'updated_at' => Carbon::now(),
]); ]);
// Get the public role // Get the public role
@ -45,10 +45,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('roles', function (Blueprint $table) { Schema::table('roles', function (Blueprint $table) {
$table->boolean('hidden')->default(false); $table->boolean('hidden')->default(false);

View file

@ -1,17 +1,17 @@
<?php <?php
use Carbon\Carbon;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('attachments', function (Blueprint $table) { Schema::create('attachments', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -40,8 +40,8 @@ return new class extends Migration
$permissionId = DB::table('role_permissions')->insertGetId([ $permissionId = DB::table('role_permissions')->insertGetId([
'name' => strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op)), 'name' => strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op)),
'display_name' => $op . ' ' . $entity . 's', 'display_name' => $op . ' ' . $entity . 's',
'created_at' => \Carbon\Carbon::now()->toDateTimeString(), 'created_at' => Carbon::now()->toDateTimeString(),
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(),
]); ]);
DB::table('permission_role')->insert([ DB::table('permission_role')->insert([
'role_id' => $adminRoleId, 'role_id' => $adminRoleId,
@ -52,10 +52,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::dropIfExists('attachments'); Schema::dropIfExists('attachments');

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('cache', function (Blueprint $table) { Schema::create('cache', function (Blueprint $table) {
$table->string('key')->unique(); $table->string('key')->unique();
@ -22,10 +20,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::dropIfExists('cache'); Schema::dropIfExists('cache');
} }

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('sessions', function (Blueprint $table) { Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->unique(); $table->string('id')->unique();
@ -25,10 +23,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::dropIfExists('sessions'); Schema::dropIfExists('sessions');
} }

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('search_terms', function (Blueprint $table) { Schema::create('search_terms', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -55,10 +53,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
// This was removed for v0.24 since these indexes are removed anyway // This was removed for v0.24 since these indexes are removed anyway
// and will cause issues for db engines that don't support such indexes. // and will cause issues for db engines that don't support such indexes.

View file

@ -2,16 +2,15 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('pages', function (Blueprint $table) { Schema::table('pages', function (Blueprint $table) {
$table->integer('revision_count'); $table->integer('revision_count');
@ -29,10 +28,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('pages', function (Blueprint $table) { Schema::table('pages', function (Blueprint $table) {
$table->dropColumn('revision_count'); $table->dropColumn('revision_count');

View file

@ -6,8 +6,6 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up()
{ {
@ -18,8 +16,6 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down()
{ {

View file

@ -1,17 +1,17 @@
<?php <?php
use Carbon\Carbon;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('comments', function (Blueprint $table) { Schema::create('comments', function (Blueprint $table) {
$table->increments('id')->unsigned(); $table->increments('id')->unsigned();
@ -37,8 +37,8 @@ return new class extends Migration
$permissionId = DB::table('role_permissions')->insertGetId([ $permissionId = DB::table('role_permissions')->insertGetId([
'name' => strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op)), 'name' => strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op)),
'display_name' => $op . ' ' . $entity . 's', 'display_name' => $op . ' ' . $entity . 's',
'created_at' => \Carbon\Carbon::now()->toDateTimeString(), 'created_at' => Carbon::now()->toDateTimeString(),
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(),
]); ]);
DB::table('permission_role')->insert([ DB::table('permission_role')->insert([
'role_id' => $adminRoleId, 'role_id' => $adminRoleId,
@ -50,10 +50,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::dropIfExists('comments'); Schema::dropIfExists('comments');
// Delete comment role permissions // Delete comment role permissions

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('books', function (Blueprint $table) { Schema::table('books', function (Blueprint $table) {
$table->integer('image_id')->nullable()->default(null); $table->integer('image_id')->nullable()->default(null);
@ -20,10 +18,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('books', function (Blueprint $table) { Schema::table('books', function (Blueprint $table) {
$table->dropColumn('image_id'); $table->dropColumn('image_id');

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('roles', function (Blueprint $table) { Schema::table('roles', function (Blueprint $table) {
$table->string('external_auth_id', 180)->default(''); $table->string('external_auth_id', 180)->default('');
@ -21,10 +19,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('roles', function (Blueprint $table) { Schema::table('roles', function (Blueprint $table) {
$table->dropColumn('external_auth_id'); $table->dropColumn('external_auth_id');

View file

@ -1,5 +1,6 @@
<?php <?php
use Carbon\Carbon;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
@ -9,10 +10,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
// Convert the existing entity tables to InnoDB. // Convert the existing entity tables to InnoDB.
@ -83,8 +82,8 @@ return new class extends Migration
$permId = DB::table('role_permissions')->insertGetId([ $permId = DB::table('role_permissions')->insertGetId([
'name' => 'bookshelf-' . $dbOpName, 'name' => 'bookshelf-' . $dbOpName,
'display_name' => $op . ' ' . 'BookShelves', 'display_name' => $op . ' ' . 'BookShelves',
'created_at' => \Carbon\Carbon::now()->toDateTimeString(), 'created_at' => Carbon::now()->toDateTimeString(),
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(),
]); ]);
$rowsToInsert = $roleIdsWithBookPermission->filter(function ($roleId) { $rowsToInsert = $roleIdsWithBookPermission->filter(function ($roleId) {
@ -103,10 +102,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
// Drop created permissions // Drop created permissions
$ops = ['bookshelf-create-all', 'bookshelf-create-own', 'bookshelf-delete-all', 'bookshelf-delete-own', 'bookshelf-update-all', 'bookshelf-update-own', 'bookshelf-view-all', 'bookshelf-view-own']; $ops = ['bookshelf-create-all', 'bookshelf-create-own', 'bookshelf-delete-all', 'bookshelf-delete-own', 'bookshelf-update-all', 'bookshelf-update-own', 'bookshelf-view-all', 'bookshelf-view-own'];

View file

@ -3,16 +3,15 @@
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('pages', function (Blueprint $table) { Schema::table('pages', function (Blueprint $table) {
$table->boolean('template')->default(false); $table->boolean('template')->default(false);
@ -35,10 +34,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('pages', function (Blueprint $table) { Schema::table('pages', function (Blueprint $table) {
$table->dropColumn('template'); $table->dropColumn('template');

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('user_invites', function (Blueprint $table) { Schema::create('user_invites', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -23,10 +21,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::dropIfExists('user_invites'); Schema::dropIfExists('user_invites');
} }

View file

@ -3,16 +3,15 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
// Add API tokens table // Add API tokens table
@ -42,10 +41,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
// Remove API tokens table // Remove API tokens table
Schema::dropIfExists('api_tokens'); Schema::dropIfExists('api_tokens');

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('joint_permissions', function (Blueprint $table) { Schema::table('joint_permissions', function (Blueprint $table) {
$table->dropColumn('id'); $table->dropColumn('id');
@ -21,10 +19,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('joint_permissions', function (Blueprint $table) { Schema::table('joint_permissions', function (Blueprint $table) {
$table->dropPrimary(['role_id', 'entity_type', 'entity_id', 'action']); $table->dropPrimary(['role_id', 'entity_type', 'entity_id', 'action']);

View file

@ -9,10 +9,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('roles', function (Blueprint $table) { Schema::table('roles', function (Blueprint $table) {
$table->dropColumn('name'); $table->dropColumn('name');
@ -21,10 +19,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('roles', function (Blueprint $table) { Schema::table('roles', function (Blueprint $table) {
$table->string('name')->index(); $table->string('name')->index();

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('activities', function (Blueprint $table) { Schema::table('activities', function (Blueprint $table) {
$table->index('key'); $table->index('key');
@ -21,10 +19,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('activities', function (Blueprint $table) { Schema::table('activities', function (Blueprint $table) {
$table->dropIndex('activities_key_index'); $table->dropIndex('activities_key_index');

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('bookshelves', function (Blueprint $table) { Schema::table('bookshelves', function (Blueprint $table) {
$table->softDeletes(); $table->softDeletes();
@ -29,10 +27,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('bookshelves', function (Blueprint $table) { Schema::table('bookshelves', function (Blueprint $table) {
$table->dropSoftDeletes(); $table->dropSoftDeletes();

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('deletions', function (Blueprint $table) { Schema::create('deletions', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -28,10 +26,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::dropIfExists('deletions'); Schema::dropIfExists('deletions');
} }

View file

@ -9,10 +9,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('activities', function (Blueprint $table) { Schema::table('activities', function (Blueprint $table) {
$table->renameColumn('key', 'type'); $table->renameColumn('key', 'type');
@ -32,10 +30,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
DB::table('activities') DB::table('activities')
->whereNull('entity_id') ->whereNull('entity_id')

View file

@ -9,10 +9,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
$tables = ['pages', 'books', 'chapters', 'bookshelves']; $tables = ['pages', 'books', 'chapters', 'bookshelves'];
foreach ($tables as $table) { foreach ($tables as $table) {
@ -30,10 +28,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
$tables = ['pages', 'books', 'chapters', 'bookshelves']; $tables = ['pages', 'books', 'chapters', 'bookshelves'];
foreach ($tables as $table) { foreach ($tables as $table) {

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('settings', function (Blueprint $table) { Schema::table('settings', function (Blueprint $table) {
$table->string('type', 50)->default('string'); $table->string('type', 50)->default('string');
@ -20,10 +18,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('settings', function (Blueprint $table) { Schema::table('settings', function (Blueprint $table) {
$table->dropColumn('type'); $table->dropColumn('type');

View file

@ -2,6 +2,7 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str; use Illuminate\Support\Str;
@ -9,10 +10,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('users', function (Blueprint $table) { Schema::table('users', function (Blueprint $table) {
$table->string('slug', 180); $table->string('slug', 180);
@ -38,10 +37,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('users', function (Blueprint $table) { Schema::table('users', function (Blueprint $table) {
$table->dropColumn('slug'); $table->dropColumn('slug');

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('favourites', function (Blueprint $table) { Schema::create('favourites', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -26,10 +24,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::dropIfExists('favourites'); Schema::dropIfExists('favourites');
} }

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('mfa_values', function (Blueprint $table) { Schema::create('mfa_values', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -24,10 +22,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::dropIfExists('mfa_values'); Schema::dropIfExists('mfa_values');
} }

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('roles', function (Blueprint $table) { Schema::table('roles', function (Blueprint $table) {
$table->boolean('mfa_enforced'); $table->boolean('mfa_enforced');
@ -20,10 +18,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('roles', function (Blueprint $table) { Schema::table('roles', function (Blueprint $table) {
$table->dropColumn('mfa_enforced'); $table->dropColumn('mfa_enforced');

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
// Create new templates-manage permission and assign to admin role // Create new templates-manage permission and assign to admin role
$roles = DB::table('roles')->get('id'); $roles = DB::table('roles')->get('id');
@ -34,10 +32,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
// Remove content-export permission // Remove content-export permission
$contentExportPermission = DB::table('role_permissions') $contentExportPermission = DB::table('role_permissions')

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('activities', function (Blueprint $table) { Schema::table('activities', function (Blueprint $table) {
$table->string('ip', 45)->after('user_id'); $table->string('ip', 45)->after('user_id');
@ -20,10 +18,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('activities', function (Blueprint $table) { Schema::table('activities', function (Blueprint $table) {
$table->dropColumn('ip'); $table->dropColumn('ip');

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('activities', function (Blueprint $table) { Schema::table('activities', function (Blueprint $table) {
$table->index('ip', 'activities_ip_index'); $table->index('ip', 'activities_ip_index');
@ -20,10 +18,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('activities', function (Blueprint $table) { Schema::table('activities', function (Blueprint $table) {
$table->dropIndex('activities_ip_index'); $table->dropIndex('activities_ip_index');

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('webhooks', function (Blueprint $table) { Schema::create('webhooks', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -37,10 +35,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::dropIfExists('webhooks'); Schema::dropIfExists('webhooks');
Schema::dropIfExists('webhook_tracked_events'); Schema::dropIfExists('webhook_tracked_events');

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('jobs', function (Blueprint $table) { Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id'); $table->bigIncrements('id');
@ -26,10 +24,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::dropIfExists('jobs'); Schema::dropIfExists('jobs');
} }

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('failed_jobs', function (Blueprint $table) { Schema::create('failed_jobs', function (Blueprint $table) {
$table->id(); $table->id();
@ -26,10 +24,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::dropIfExists('failed_jobs'); Schema::dropIfExists('failed_jobs');
} }

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('webhooks', function (Blueprint $table) { Schema::table('webhooks', function (Blueprint $table) {
$table->unsignedInteger('timeout')->default(3); $table->unsignedInteger('timeout')->default(3);
@ -23,10 +21,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('webhooks', function (Blueprint $table) { Schema::table('webhooks', function (Blueprint $table) {
$table->dropColumn('timeout'); $table->dropColumn('timeout');

View file

@ -10,10 +10,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
// Add the new 'editor' column to the pages table // Add the new 'editor' column to the pages table
Schema::table('pages', function (Blueprint $table) { Schema::table('pages', function (Blueprint $table) {
@ -46,10 +44,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
// Drop the new column from the pages table // Drop the new column from the pages table
Schema::table('pages', function (Blueprint $table) { Schema::table('pages', function (Blueprint $table) {

View file

@ -32,10 +32,8 @@ return new class extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
foreach ($this->columnsByTable as $table => $column) { foreach ($this->columnsByTable as $table => $column) {
foreach ($this->changeMap as $oldVal => $newVal) { foreach ($this->changeMap as $oldVal => $newVal) {
@ -48,10 +46,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
foreach ($this->columnsByTable as $table => $column) { foreach ($this->columnsByTable as $table => $column) {
foreach ($this->changeMap as $oldVal => $newVal) { foreach ($this->changeMap as $oldVal => $newVal) {

View file

@ -9,10 +9,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
DB::table('joint_permissions') DB::table('joint_permissions')
->where('action', '!=', 'view') ->where('action', '!=', 'view')
@ -27,10 +25,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('joint_permissions', function (Blueprint $table) { Schema::table('joint_permissions', function (Blueprint $table) {
$table->string('action'); $table->string('action');

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('references', function (Blueprint $table) { Schema::create('references', function (Blueprint $table) {
$table->id(); $table->id();
@ -24,10 +22,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::dropIfExists('references'); Schema::dropIfExists('references');
} }

View file

@ -7,10 +7,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
// This updates the 'type' field for images, uploaded as shelf cover images, // This updates the 'type' field for images, uploaded as shelf cover images,
// to be cover_bookshelf instead of cover_book. // to be cover_bookshelf instead of cover_book.
@ -32,10 +30,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
DB::table('images') DB::table('images')
->where('type', '=', 'cover_bookshelf') ->where('type', '=', 'cover_bookshelf')

View file

@ -10,10 +10,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
// Remove entries for non-existing roles (Caused by previous lack of deletion handling) // Remove entries for non-existing roles (Caused by previous lack of deletion handling)
$roleIds = DB::table('roles')->pluck('id'); $roleIds = DB::table('roles')->pluck('id');
@ -63,10 +61,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
// Create old table structure for entity_permissions // Create old table structure for entity_permissions
Schema::create('old_entity_permissions', function (Blueprint $table) { Schema::create('old_entity_permissions', function (Blueprint $table) {

View file

@ -11,10 +11,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
// Remove entity-permissions on non-restricted entities // Remove entity-permissions on non-restricted entities
$deleteInactiveEntityPermissions = function (string $table, string $morphClass) { $deleteInactiveEntityPermissions = function (string $table, string $morphClass) {
@ -61,10 +59,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
// Create restricted columns // Create restricted columns
$createRestrictedColumn = fn(Blueprint $table) => $table->boolean('restricted')->index()->default(0); $createRestrictedColumn = fn(Blueprint $table) => $table->boolean('restricted')->index()->default(0);

View file

@ -10,10 +10,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
// Truncate before schema changes to avoid performance issues // Truncate before schema changes to avoid performance issues
// since we'll need to rebuild anyway. // since we'll need to rebuild anyway.
@ -34,10 +32,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
DB::table('joint_permissions')->truncate(); DB::table('joint_permissions')->truncate();

View file

@ -7,10 +7,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
$colorSettings = [ $colorSettings = [
'app-color', 'app-color',
@ -45,10 +43,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
$colorSettings = [ $colorSettings = [
'app-color-dark', 'app-color-dark',

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('attachments', function (Blueprint $table) { Schema::table('attachments', function (Blueprint $table) {
$table->text('path')->change(); $table->text('path')->change();
@ -20,10 +18,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('attachments', function (Blueprint $table) { Schema::table('attachments', function (Blueprint $table) {
$table->string('path')->change(); $table->string('path')->change();

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('pages', function (Blueprint $table) { Schema::table('pages', function (Blueprint $table) {
$table->index('updated_at', 'pages_updated_at_index'); $table->index('updated_at', 'pages_updated_at_index');
@ -20,10 +18,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('pages', function (Blueprint $table) { Schema::table('pages', function (Blueprint $table) {
$table->dropIndex('pages_updated_at_index'); $table->dropIndex('pages_updated_at_index');

View file

@ -7,10 +7,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
$guestUserId = DB::table('users') $guestUserId = DB::table('users')
->where('system_name', '=', 'public') ->where('system_name', '=', 'public')
@ -36,8 +34,6 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down()
{ {

View file

@ -7,8 +7,6 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up()
{ {
@ -20,8 +18,6 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down()
{ {

View file

@ -2,15 +2,14 @@
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
// Create new receive-notifications permission and assign to admin role // Create new receive-notifications permission and assign to admin role
$permissionId = DB::table('role_permissions')->insertGetId([ $permissionId = DB::table('role_permissions')->insertGetId([
@ -29,10 +28,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
$permission = DB::table('role_permissions') $permission = DB::table('role_permissions')
->where('name', '=', 'receive-notifications') ->where('name', '=', 'receive-notifications')

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::create('watches', function (Blueprint $table) { Schema::create('watches', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -27,10 +25,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::dropIfExists('watches'); Schema::dropIfExists('watches');
} }

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('cache', function (Blueprint $table) { Schema::table('cache', function (Blueprint $table) {
$table->mediumText('value')->change(); $table->mediumText('value')->change();
@ -20,10 +18,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('cache', function (Blueprint $table) { Schema::table('cache', function (Blueprint $table) {
$table->text('value')->change(); $table->text('value')->change();

View file

@ -8,10 +8,8 @@ class AddDefaultTemplateToBooks extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('books', function (Blueprint $table) { Schema::table('books', function (Blueprint $table) {
$table->integer('default_template_id')->nullable()->default(null); $table->integer('default_template_id')->nullable()->default(null);
@ -20,10 +18,8 @@ class AddDefaultTemplateToBooks extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('books', function (Blueprint $table) { Schema::table('books', function (Blueprint $table) {
$table->dropColumn('default_template_id'); $table->dropColumn('default_template_id');

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
$addColumn = fn(Blueprint $table) => $table->text('description_html'); $addColumn = fn(Blueprint $table) => $table->text('description_html');
@ -22,10 +20,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
$removeColumn = fn(Blueprint $table) => $table->removeColumn('description_html'); $removeColumn = fn(Blueprint $table) => $table->removeColumn('description_html');

View file

@ -8,10 +8,8 @@ class AddDefaultTemplateToChapters extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('chapters', function (Blueprint $table) { Schema::table('chapters', function (Blueprint $table) {
$table->integer('default_template_id')->nullable()->default(null); $table->integer('default_template_id')->nullable()->default(null);
@ -20,10 +18,8 @@ class AddDefaultTemplateToChapters extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('chapters', function (Blueprint $table) { Schema::table('chapters', function (Blueprint $table) {
$table->dropColumn('default_template_id'); $table->dropColumn('default_template_id');

View file

@ -8,10 +8,8 @@ return new class extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*
* @return void
*/ */
public function up() public function up(): void
{ {
Schema::table('views', function (Blueprint $table) { Schema::table('views', function (Blueprint $table) {
$table->index(['updated_at'], 'views_updated_at_index'); $table->index(['updated_at'], 'views_updated_at_index');
@ -20,10 +18,8 @@ return new class extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down() public function down(): void
{ {
Schema::table('views', function (Blueprint $table) { Schema::table('views', function (Blueprint $table) {
$table->dropIndex('views_updated_at_index'); $table->dropIndex('views_updated_at_index');