@@ -3,6 +3,7 @@ import 'package:drift/internal/versioned_schema.dart';
33import 'package:drift/remote.dart' ;
44import 'package:sqlite3/common.dart' ;
55
6+ import '../api/route/realm.dart' ;
67import '../log.dart' ;
78import 'legacy_app_data.dart' ;
89import 'schema_versions.g.dart' ;
@@ -123,6 +124,20 @@ class Accounts extends Table {
123124 /// It never changes for a given account.
124125 Column <String > get realmUrl => text ().map (const UriConverter ())();
125126
127+ /// The name of the Zulip realm this account is on.
128+ ///
129+ /// This corresponds to [GetServerSettingsResult.realmName] .
130+ ///
131+ /// Nullable just because older versions of the app didn't store this.
132+ Column <String > get realmName => text ().nullable ()();
133+
134+ /// The icon URL of the Zulip realm this account is on.
135+ ///
136+ /// This corresponds to [GetServerSettingsResult.realmIcon] .
137+ ///
138+ /// Nullable just because older versions of the app didn't store this.
139+ Column <String > get realmIcon => text ().map (const UriConverter ()).nullable ()();
140+
126141 /// The Zulip user ID of this account.
127142 ///
128143 /// This is the identifier the server uses for the account.
@@ -164,7 +179,7 @@ class AppDatabase extends _$AppDatabase {
164179 // information on using the build_runner.
165180 // * Write a migration in `_migrationSteps` below.
166181 // * Write tests.
167- static const int latestSchemaVersion = 11 ; // See note.
182+ static const int latestSchemaVersion = 12 ; // See note.
168183
169184 @override
170185 int get schemaVersion => latestSchemaVersion;
@@ -259,6 +274,10 @@ class AppDatabase extends _$AppDatabase {
259274 'value' : Variable (firstAccountId),
260275 }));
261276 },
277+ from11To12: (Migrator m, Schema12 schema) async {
278+ await m.addColumn (schema.accounts, schema.accounts.realmName);
279+ await m.addColumn (schema.accounts, schema.accounts.realmIcon);
280+ },
262281 );
263282
264283 Future <void > _createLatestSchema (Migrator m) async {
0 commit comments