mirror of https://github.com/AMT-Cheif/drift.git
Fixes related to the new dialects feature
This commit is contained in:
parent
634b1adb72
commit
b48970d9ef
|
@ -39,7 +39,7 @@ class GenerationContext {
|
|||
GenerationContext.fromDb(QueryEngine database)
|
||||
: typeSystem = database.typeSystem,
|
||||
executor = database.executor,
|
||||
dialect = database.executor.dialect;
|
||||
dialect = database.executor?.dialect ?? SqlDialect.sqlite;
|
||||
|
||||
GenerationContext(this.typeSystem, this.executor,
|
||||
{this.dialect = SqlDialect.sqlite});
|
||||
|
|
|
@ -193,17 +193,7 @@ class GeneratedIntColumn extends GeneratedColumn<int, IntType>
|
|||
void writeColumnDefinition(GenerationContext into) {
|
||||
// todo make this work with custom constraints, default values, etc.
|
||||
if (hasAutoIncrement) {
|
||||
String autoIncrementKeyword;
|
||||
switch (into.dialect) {
|
||||
case SqlDialect.sqlite:
|
||||
autoIncrementKeyword = 'AUTOINCREMENT';
|
||||
break;
|
||||
case SqlDialect.mysql:
|
||||
autoIncrementKeyword = 'AUTO INCREMENT';
|
||||
break;
|
||||
}
|
||||
|
||||
into.buffer.write('${$name} $typeName PRIMARY $autoIncrementKeyword');
|
||||
into.buffer.write('${$name} $typeName PRIMARY KEY AUTOINCREMENT');
|
||||
} else {
|
||||
super.writeColumnDefinition(into);
|
||||
}
|
||||
|
|
|
@ -58,7 +58,9 @@ void main() {
|
|||
expect(second, emits(isEmpty));
|
||||
|
||||
await pumpEventQueue(times: 1);
|
||||
verifyZeroInteractions(executor);
|
||||
// calling executor.dialect is ok, it's needed to construct the statement
|
||||
verify(executor.dialect);
|
||||
verifyNoMoreInteractions(executor);
|
||||
});
|
||||
|
||||
test('every stream instance can be listened to', () async {
|
||||
|
|
Loading…
Reference in New Issue