mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-22 13:44:47 +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\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
|
||||||
|
@ -26,9 +27,10 @@ return new class extends Migration
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
||||||
$pages = $sm->introspectTable('pages');
|
$prefix = DB::getTablePrefix();
|
||||||
$books = $sm->introspectTable('books');
|
$pages = $sm->introspectTable($prefix . 'pages');
|
||||||
$chapters = $sm->introspectTable('chapters');
|
$books = $sm->introspectTable($prefix . 'books');
|
||||||
|
$chapters = $sm->introspectTable($prefix . 'chapters');
|
||||||
|
|
||||||
if ($pages->hasIndex('search')) {
|
if ($pages->hasIndex('search')) {
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
|
@ -26,9 +27,10 @@ return new class extends Migration
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
||||||
$pages = $sm->introspectTable('pages');
|
$prefix = DB::getTablePrefix();
|
||||||
$books = $sm->introspectTable('books');
|
$pages = $sm->introspectTable($prefix . 'pages');
|
||||||
$chapters = $sm->introspectTable('chapters');
|
$books = $sm->introspectTable($prefix . 'books');
|
||||||
|
$chapters = $sm->introspectTable($prefix . 'chapters');
|
||||||
|
|
||||||
if ($pages->hasIndex('name_search')) {
|
if ($pages->hasIndex('name_search')) {
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
|
@ -25,9 +26,10 @@ return new class extends Migration
|
||||||
});
|
});
|
||||||
|
|
||||||
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
||||||
$pages = $sm->introspectTable('pages');
|
$prefix = DB::getTablePrefix();
|
||||||
$books = $sm->introspectTable('books');
|
$pages = $sm->introspectTable($prefix . 'pages');
|
||||||
$chapters = $sm->introspectTable('chapters');
|
$books = $sm->introspectTable($prefix . 'books');
|
||||||
|
$chapters = $sm->introspectTable($prefix . 'chapters');
|
||||||
|
|
||||||
if ($pages->hasIndex('search')) {
|
if ($pages->hasIndex('search')) {
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user