@@ -8,6 +8,7 @@ import 'package:drift/internal/versioned_schema.dart';
88import 'package:drift/remote.dart' ;
99import 'package:sqlite3/common.dart' ;
1010
11+ import '../api/route/realm.dart' ;
1112import '../log.dart' ;
1213import 'legacy_app_data.dart' ;
1314import 'schema_versions.g.dart' ;
@@ -128,6 +129,20 @@ class Accounts extends Table {
128129 /// It never changes for a given account.
129130 Column <String > get realmUrl => text ().map (const UriConverter ())();
130131
132+ /// The name of the Zulip realm this account is on.
133+ ///
134+ /// This corresponds to [GetServerSettingsResult.realmName] .
135+ ///
136+ /// Nullable just because older versions of the app didn't store this.
137+ Column <String > get realmName => text ().nullable ()();
138+
139+ /// The icon URL of the Zulip realm this account is on.
140+ ///
141+ /// This corresponds to [GetServerSettingsResult.realmIcon] .
142+ ///
143+ /// Nullable just because older versions of the app didn't store this.
144+ Column <String > get realmIcon => text ().map (const UriConverter ()).nullable ()();
145+
131146 /// The Zulip user ID of this account.
132147 ///
133148 /// This is the identifier the server uses for the account.
@@ -169,7 +184,7 @@ class AppDatabase extends _$AppDatabase {
169184 // information on using the build_runner.
170185 // * Write a migration in `_migrationSteps` below.
171186 // * Write tests.
172- static const int latestSchemaVersion = 11 ; // See note.
187+ static const int latestSchemaVersion = 12 ; // See note.
173188
174189 @override
175190 int get schemaVersion => latestSchemaVersion;
@@ -264,6 +279,10 @@ class AppDatabase extends _$AppDatabase {
264279 'value' : Variable (firstAccountId),
265280 }));
266281 },
282+ from11To12: (Migrator m, Schema12 schema) async {
283+ await m.addColumn (schema.accounts, schema.accounts.realmName);
284+ await m.addColumn (schema.accounts, schema.accounts.realmIcon);
285+ },
267286 );
268287
269288 Future <void > _createLatestSchema (Migrator m) async {
0 commit comments