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
|
||||
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
|
||||
authors:
|
||||
- Simon Binder <simolus3@gmail.com>
|
||||
|
|
|
@ -47,9 +47,7 @@ class SharedTodos extends Table {
|
|||
}
|
||||
|
||||
class TableWithoutPK extends Table {
|
||||
|
||||
IntColumn get notReallyAnId => integer()();
|
||||
|
||||
}
|
||||
|
||||
@UseMoor(tables: [TodosTable, Categories, Users, SharedTodos, TableWithoutPK])
|
||||
|
|
|
@ -716,7 +716,7 @@ class $TableWithoutPKTable extends TableWithoutPK
|
|||
bool validateIntegrity(TableWithoutPKData instance, bool isInserting) =>
|
||||
notReallyAnId.isAcceptableValue(instance.notReallyAnId, isInserting);
|
||||
@override
|
||||
Set<GeneratedColumn> get $primaryKey => {};
|
||||
Set<GeneratedColumn> get $primaryKey => <GeneratedColumn>{};
|
||||
@override
|
||||
TableWithoutPKData map(Map<String, dynamic> data, {String tablePrefix}) {
|
||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : null;
|
||||
|
|
|
@ -175,8 +175,8 @@ class TableWriter {
|
|||
// explicitly defined as PK, but with AI this happens implicitly.
|
||||
primaryKey ??= table.columns.where((c) => c.hasAI).toSet();
|
||||
|
||||
if (primaryKey == null) {
|
||||
buffer.write('null;');
|
||||
if (primaryKey.isEmpty) {
|
||||
buffer.write('<GeneratedColumn>{};');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: moor_generator
|
||||
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
|
||||
authors:
|
||||
- Simon Binder <simolus3@gmail.com>
|
||||
|
|
Loading…
Reference in New Issue