mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-22 05:21:22 +08:00
Migrations: Added prefix support to schema inspection
This commit is contained in:
parent
83913af68b
commit
c221a00e1e
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user