Skip to content

Commit

Permalink
Wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bakerkretzmar committed Jul 15, 2024
1 parent 6f395d9 commit 2351a8f
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions tests/Integration/Database/SchemaStateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down

0 comments on commit 2351a8f

Please sign in to comment.