1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-10-29 23:22:34 +01:00

Migrations: Added prefix support to schema inspection

This commit is contained in:
Dan Brown 2024-03-19 10:30:26 +00:00
parent 83913af68b
commit c221a00e1e
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
3 changed files with 15 additions and 9 deletions

View 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) {

View 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) {

View 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) {