saveCollection method Null safety
- CollectionData collection,
- List<
FieldData> fields
saveCollection upserts the provided CollectionData model and updates its related records table schema.
Implementation
Future saveCollection(CollectionData collection, List<FieldData> fields) =>
transaction(() async {
await into(attachedDatabase.collection)
.insertOnConflictUpdate(collection);
for (final field in fields) {
await into(attachedDatabase.field).insertOnConflictUpdate(field);
}
await _migrator.createTable(collection.toOrm(
attachedDatabase, fields.map((e) => e.toOrm()).toList()));
});