Fix schema tests

We don't support executors changing their dialect at runtime.
This commit is contained in:
Simon Binder 2024-02-08 21:58:30 +01:00
parent 4912bad292
commit dc595eb3a2
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
1 changed files with 16 additions and 10 deletions

View File

@ -109,20 +109,26 @@ void main() {
[]));
});
test('creates tables with custom types', () async {
await db.createMigrator().createTable(db.withCustomType);
group('creates tables with custom types', () {
test('sqlite3', () async {
await db.createMigrator().createTable(db.withCustomType);
verify(mockExecutor.runCustom(
'CREATE TABLE IF NOT EXISTS "with_custom_type" ("id" text NOT NULL);',
[]));
verify(mockExecutor.runCustom(
'CREATE TABLE IF NOT EXISTS "with_custom_type" ("id" text NOT NULL);',
[]));
});
when(mockExecutor.dialect).thenReturn(SqlDialect.postgres);
await db.createMigrator().createTable(db.withCustomType);
verify(mockExecutor.runCustom(
'CREATE TABLE IF NOT EXISTS "with_custom_type" ("id" uuid NOT NULL);',
[]));
test('postgres', () async {
when(mockExecutor.dialect).thenReturn(SqlDialect.postgres);
await db.createMigrator().createTable(db.withCustomType);
verify(mockExecutor.runCustom(
'CREATE TABLE IF NOT EXISTS "with_custom_type" ("id" uuid NOT NULL);',
[]));
});
});
test('creates tables with custom types', () async {});
test('creates views through create()', () async {
await db.createMigrator().create(db.categoryTodoCountView);