Skip to content

Commit bee6ada

Browse files
committed
Update SearchTest.php
1 parent 3da32d2 commit bee6ada

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tests/SearchTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,19 @@ public function it_respects_table_prefixes()
8282
$originalPrefix = $connection->getTablePrefix();
8383

8484
try {
85-
// Drop existing tables first
85+
// Set prefix FIRST before creating tables
86+
$connection->setTablePrefix('prefix_');
87+
88+
// Drop existing unprefixed tables
89+
$connection->setTablePrefix($originalPrefix);
8690
Schema::dropIfExists('posts');
8791
Schema::dropIfExists('videos');
8892
Schema::dropIfExists('comments');
8993
Schema::dropIfExists('blogs');
9094
Schema::dropIfExists('pages');
91-
92-
// Set prefix and create prefixed tables
93-
$connection->setTablePrefix('prefix_');
9495

96+
// Set prefix back and create prefixed tables
97+
$connection->setTablePrefix('prefix_');
9598
include_once __DIR__ . '/create_tables.php';
9699
(new \CreateTables)->up();
97100

0 commit comments

Comments
 (0)