feat: add historical data
This commit is contained in:
@@ -187,6 +187,23 @@ class ProcessedRemoteCommands extends Table {
|
||||
Set<Column> get primaryKey => {commandId};
|
||||
}
|
||||
|
||||
/// Outbox of tab events (lines added/removed, settlements) waiting to be
|
||||
/// sent to the server for sales statistics. Rows are deleted once the server
|
||||
/// acknowledges or rejects them.
|
||||
@DataClassName('TabEventRow')
|
||||
class TabEvents extends Table {
|
||||
/// The event's UUID.
|
||||
TextColumn get id => text()();
|
||||
|
||||
/// The event as JSON, exactly as it is sent.
|
||||
TextColumn get payload => text()();
|
||||
|
||||
DateTimeColumn get createdAt => dateTime()();
|
||||
|
||||
@override
|
||||
Set<Column> get primaryKey => {id};
|
||||
}
|
||||
|
||||
@DriftDatabase(
|
||||
tables: [
|
||||
Products,
|
||||
@@ -198,13 +215,14 @@ class ProcessedRemoteCommands extends Table {
|
||||
AppSettingsTable,
|
||||
RemoteSyncState,
|
||||
ProcessedRemoteCommands,
|
||||
TabEvents,
|
||||
],
|
||||
)
|
||||
class AppDatabase extends _$AppDatabase {
|
||||
AppDatabase([QueryExecutor? executor]) : super(executor ?? _openConnection());
|
||||
|
||||
@override
|
||||
int get schemaVersion => 14;
|
||||
int get schemaVersion => 15;
|
||||
|
||||
@override
|
||||
MigrationStrategy get migration {
|
||||
@@ -303,6 +321,10 @@ class AppDatabase extends _$AppDatabase {
|
||||
if (from < 14 && !await hasTableColumn('products', 'infinite_stock')) {
|
||||
await migrator.addColumn(products, products.infiniteStock);
|
||||
}
|
||||
|
||||
if (from < 15) {
|
||||
await migrator.createTable(tabEvents);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user