-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f395d9
commit 2351a8f
Showing
1 changed file
with
3 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,30 +13,22 @@ class SchemaStateTest extends DatabaseTestCase | |
'database/schema', | ||
]; | ||
|
||
protected function createSqliteDatabase(): void | ||
{ | ||
DB::connection('sqlite')->getSchemaBuilder()->createDatabase( | ||
DB::connection('sqlite')->getConfig('database') | ||
); | ||
} | ||
|
||
public function testSchemaDumpOnSqlite() | ||
{ | ||
if ($this->driver !== 'sqlite') { | ||
$this->markTestSkipped('Test requires a SQLite connection.'); | ||
} | ||
|
||
$connection = DB::connection('sqlite'); | ||
|
||
$this->createSqliteDatabase(); | ||
|
||
$this->app['files']->ensureDirectoryExists(database_path('schema')); | ||
$connection->getSchemaBuilder()->createDatabase($connection->getConfig('database')); | ||
|
||
$connection->statement('CREATE TABLE users(id integer primary key autoincrement not null, email varchar not null, name varchar not null);'); | ||
$connection->statement('CREATE UNIQUE INDEX users_email_unique on users (email);'); | ||
$connection->statement('INSERT INTO users (email, name) VALUES ("[email protected]", "Taylor Otwell");'); | ||
$connection->statement('PRAGMA optimize;'); | ||
|
||
$this->app['files']->ensureDirectoryExists(database_path('schema')); | ||
|
||
$connection->getSchemaState()->dump($connection, database_path('schema/sqlite-schema.sql')); | ||
|
||
$this->assertFileDoesNotContains([ | ||
|