]> BookStack Code Mirror - bookstack/commitdiff
Migrations: Added prefix support to schema inspection
authorDan Brown <redacted>
Tue, 19 Mar 2024 10:30:26 +0000 (10:30 +0000)
committerDan Brown <redacted>
Tue, 19 Mar 2024 10:30:26 +0000 (10:30 +0000)
database/migrations/2015_08_31_175240_add_search_indexes.php
database/migrations/2015_12_05_145049_fulltext_weighting.php
database/migrations/2017_03_19_091553_create_search_index_table.php

index 3382b2d5495f9043c5fe2d095a5c213e042a5f96..4d58d940959fe954b4abe2d16895868ee465217c 100644 (file)
@@ -2,6 +2,7 @@
 
 use Illuminate\Database\Migrations\Migration;
 use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Schema;
 
 return new class extends Migration
@@ -26,9 +27,10 @@ return new class extends Migration
     public function down(): void
     {
         $sm = Schema::getConnection()->getDoctrineSchemaManager();
-        $pages = $sm->introspectTable('pages');
-        $books = $sm->introspectTable('books');
-        $chapters = $sm->introspectTable('chapters');
+        $prefix = DB::getTablePrefix();
+        $pages = $sm->introspectTable($prefix . 'pages');
+        $books = $sm->introspectTable($prefix . 'books');
+        $chapters = $sm->introspectTable($prefix . 'chapters');
 
         if ($pages->hasIndex('search')) {
             Schema::table('pages', function (Blueprint $table) {
index 33163e8544606dd3527535605dd0d59d946c0306..b20c04520cb6306321e482ea9dc25655f3968545 100644 (file)
@@ -2,6 +2,7 @@
 
 use Illuminate\Database\Migrations\Migration;
 use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Schema;
 
 return new class extends Migration
@@ -26,9 +27,10 @@ return new class extends Migration
     public function down(): void
     {
         $sm = Schema::getConnection()->getDoctrineSchemaManager();
-        $pages = $sm->introspectTable('pages');
-        $books = $sm->introspectTable('books');
-        $chapters = $sm->introspectTable('chapters');
+        $prefix = DB::getTablePrefix();
+        $pages = $sm->introspectTable($prefix . 'pages');
+        $books = $sm->introspectTable($prefix . 'books');
+        $chapters = $sm->introspectTable($prefix . 'chapters');
 
         if ($pages->hasIndex('name_search')) {
             Schema::table('pages', function (Blueprint $table) {
index 71f93fa2d6214715a8f62ba84899bf81220a0c9e..56281741e3c9f220e9108802c244eb2dc10141b8 100644 (file)
@@ -2,6 +2,7 @@
 
 use Illuminate\Database\Migrations\Migration;
 use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Schema;
 
 return new class extends Migration
@@ -25,9 +26,10 @@ return new class extends Migration
         });
 
         $sm = Schema::getConnection()->getDoctrineSchemaManager();
-        $pages = $sm->introspectTable('pages');
-        $books = $sm->introspectTable('books');
-        $chapters = $sm->introspectTable('chapters');
+        $prefix = DB::getTablePrefix();
+        $pages = $sm->introspectTable($prefix . 'pages');
+        $books = $sm->introspectTable($prefix . 'books');
+        $chapters = $sm->introspectTable($prefix . 'chapters');
 
         if ($pages->hasIndex('search')) {
             Schema::table('pages', function (Blueprint $table) {