You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Documents extends Table {
IntColumn get id => integer().autoIncrement()();
TextColumn get anchor => text()();
TextColumn get label => text()();
TextColumn get path => text()();
IntColumn get sectionId => integer().nullable()();
IntColumn get createdDate => integer().nullable()();
}
class WordDocument extends Table {
IntColumn get id => integer().autoIncrement()();
IntColumn get wordId =>
integer().references(Words, #id, onDelete: KeyAction.cascade)();
IntColumn get docId =>
integer().references(Documents, #id, onDelete: KeyAction.cascade)();
}
class Words extends Table {
IntColumn get id => integer().autoIncrement()();
TextColumn get word => text()();
TextColumn get content => text()();
}
I have created services to delete the data. Item is deleted but related items are not deleting
example code
final documentService = DocumentService(dbHelper.database);
final wordService = WordService(dbHelper.database);
final wordDocumentService = WordDocumentService(dbHelper.database);
final docs = await documentService.selectByAttribute(
attribute: 'sectionId',
value: sectionIdToDelete,
);
for (final element in docs) {
await wordDocumentService.deleteByAttribute(
'docId',
element.id,
);
}
I am using latest version of drift and flutter.
The text was updated successfully, but these errors were encountered:
My tables are below
Tables
I have created services to delete the data. Item is deleted but related items are not deleting
example code
I am using latest version of drift and flutter.
The text was updated successfully, but these errors were encountered: