mirror of https://github.com/AMT-Cheif/drift.git
Fix syntax error in generated code with empty primary key
This commit is contained in:
parent
211bf56ae7
commit
cd520e5d1e
|
@ -1,6 +1,6 @@
|
||||||
name: moor
|
name: moor
|
||||||
description: Moor is a safe and reactive persistence library for Dart applications
|
description: Moor is a safe and reactive persistence library for Dart applications
|
||||||
version: 1.3.0
|
version: 1.3.1
|
||||||
homepage: https://github.com/simolus3/moor
|
homepage: https://github.com/simolus3/moor
|
||||||
authors:
|
authors:
|
||||||
- Simon Binder <simolus3@gmail.com>
|
- Simon Binder <simolus3@gmail.com>
|
||||||
|
|
|
@ -47,9 +47,7 @@ class SharedTodos extends Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
class TableWithoutPK extends Table {
|
class TableWithoutPK extends Table {
|
||||||
|
|
||||||
IntColumn get notReallyAnId => integer()();
|
IntColumn get notReallyAnId => integer()();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseMoor(tables: [TodosTable, Categories, Users, SharedTodos, TableWithoutPK])
|
@UseMoor(tables: [TodosTable, Categories, Users, SharedTodos, TableWithoutPK])
|
||||||
|
|
|
@ -716,7 +716,7 @@ class $TableWithoutPKTable extends TableWithoutPK
|
||||||
bool validateIntegrity(TableWithoutPKData instance, bool isInserting) =>
|
bool validateIntegrity(TableWithoutPKData instance, bool isInserting) =>
|
||||||
notReallyAnId.isAcceptableValue(instance.notReallyAnId, isInserting);
|
notReallyAnId.isAcceptableValue(instance.notReallyAnId, isInserting);
|
||||||
@override
|
@override
|
||||||
Set<GeneratedColumn> get $primaryKey => {};
|
Set<GeneratedColumn> get $primaryKey => <GeneratedColumn>{};
|
||||||
@override
|
@override
|
||||||
TableWithoutPKData map(Map<String, dynamic> data, {String tablePrefix}) {
|
TableWithoutPKData map(Map<String, dynamic> data, {String tablePrefix}) {
|
||||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : null;
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : null;
|
||||||
|
|
|
@ -175,8 +175,8 @@ class TableWriter {
|
||||||
// explicitly defined as PK, but with AI this happens implicitly.
|
// explicitly defined as PK, but with AI this happens implicitly.
|
||||||
primaryKey ??= table.columns.where((c) => c.hasAI).toSet();
|
primaryKey ??= table.columns.where((c) => c.hasAI).toSet();
|
||||||
|
|
||||||
if (primaryKey == null) {
|
if (primaryKey.isEmpty) {
|
||||||
buffer.write('null;');
|
buffer.write('<GeneratedColumn>{};');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: moor_generator
|
name: moor_generator
|
||||||
description: Dev-dependency to generate table and dataclasses together with the moor package.
|
description: Dev-dependency to generate table and dataclasses together with the moor package.
|
||||||
version: 1.3.0
|
version: 1.3.1
|
||||||
homepage: https://github.com/simolus3/moor
|
homepage: https://github.com/simolus3/moor
|
||||||
authors:
|
authors:
|
||||||
- Simon Binder <simolus3@gmail.com>
|
- Simon Binder <simolus3@gmail.com>
|
||||||
|
|
Loading…
Reference in New Issue