♻️ Refactor post draft with drift db

This commit is contained in:
2025-06-24 23:39:09 +08:00
parent 2287995cb4
commit 568d70fffb
11 changed files with 2263 additions and 639 deletions

26
lib/database/draft.dart Normal file
View File

@ -0,0 +1,26 @@
import 'package:drift/drift.dart';
class ComposeDrafts extends Table {
TextColumn get id => text()();
TextColumn get title => text().withDefault(const Constant(''))();
TextColumn get description => text().withDefault(const Constant(''))();
TextColumn get content => text().withDefault(const Constant(''))();
TextColumn get attachmentIds => text().withDefault(const Constant('[]'))(); // JSON array as string
TextColumn get visibility => text().withDefault(const Constant('public'))();
DateTimeColumn get lastModified => dateTime()();
@override
Set<Column> get primaryKey => {id};
}
class ArticleDrafts extends Table {
TextColumn get id => text()();
TextColumn get title => text().withDefault(const Constant(''))();
TextColumn get description => text().withDefault(const Constant(''))();
TextColumn get content => text().withDefault(const Constant(''))();
TextColumn get visibility => text().withDefault(const Constant('public'))();
DateTimeColumn get lastModified => dateTime()();
@override
Set<Column> get primaryKey => {id};
}