Skip to content

Commit

Permalink
chore: add new column for storing the self destruction timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Geraghty committed Apr 10, 2022
1 parent 2e7d965 commit 07f3ddb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/storage/database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class StorageDatabase extends _$StorageDatabase {

// you should bump this number whenever you change or add a table definition.
@override
int get schemaVersion => 8;
int get schemaVersion => 9;

@override
MigrationStrategy get migration => MigrationStrategy(
Expand All @@ -237,6 +237,9 @@ class StorageDatabase extends _$StorageDatabase {
},
onUpgrade: (Migrator m, int from, int to) async {
printInfo('[MIGRATION] VERSION $from to $to');
if (from == 8) {
await m.addColumn(messages, messages.selfDestructAfter);
}
if (from == 7) {
await m.createTable(keySessions);
await m.createTable(messageSessions);
Expand Down
1 change: 1 addition & 0 deletions lib/store/events/messages/schema.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Messages extends Table {
// Message timestamps
IntColumn get timestamp => integer()();
IntColumn get received => integer()();
IntColumn get selfDestructAfter => integer()();

// Message Only
TextColumn get body => text().nullable()();
Expand Down

0 comments on commit 07f3ddb

Please sign in to comment.