-
Notifications
You must be signed in to change notification settings - Fork 342
Track realmName
and realmIcon
in database
#1860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
66a0c17
8b7ee0f
d4d844a
32557ca
c29934a
a8b236d
673ff5b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,7 @@ class GetServerSettingsResult { | |
final Uri realmUrl; | ||
|
||
final String realmName; | ||
final String realmIcon; | ||
final Uri realmIcon; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: do this before adding the corresponding field on InitialSnapshot; that way they agree from the beginning |
||
final String realmDescription; | ||
final bool realmWebPublicAccessEnabled; | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ import 'package:drift/internal/versioned_schema.dart'; | |
import 'package:drift/remote.dart'; | ||
import 'package:sqlite3/common.dart'; | ||
|
||
import '../api/route/realm.dart'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Hmm I haven't seen an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I just meant to relate to the issue that this commit partly fixes. I guess |
||
import '../log.dart'; | ||
import 'legacy_app_data.dart'; | ||
import 'schema_versions.g.dart'; | ||
|
@@ -128,6 +129,20 @@ class Accounts extends Table { | |
/// It never changes for a given account. | ||
Column<String> get realmUrl => text().map(const UriConverter())(); | ||
|
||
/// The name of the Zulip realm this account is on. | ||
/// | ||
/// This corresponds to [GetServerSettingsResult.realmName]. | ||
/// | ||
/// Nullable just because older versions of the app didn't store this. | ||
Column<String> get realmName => text().nullable()(); | ||
|
||
/// The icon URL of the Zulip realm this account is on. | ||
/// | ||
/// This corresponds to [GetServerSettingsResult.realmIcon]. | ||
/// | ||
/// Nullable just because older versions of the app didn't store this. | ||
Column<String> get realmIcon => text().map(const UriConverter()).nullable()(); | ||
|
||
/// The Zulip user ID of this account. | ||
/// | ||
/// This is the identifier the server uses for the account. | ||
|
@@ -169,7 +184,7 @@ class AppDatabase extends _$AppDatabase { | |
// information on using the build_runner. | ||
// * Write a migration in `_migrationSteps` below. | ||
// * Write tests. | ||
static const int latestSchemaVersion = 11; // See note. | ||
static const int latestSchemaVersion = 12; // See note. | ||
|
||
@override | ||
int get schemaVersion => latestSchemaVersion; | ||
|
@@ -264,6 +279,10 @@ class AppDatabase extends _$AppDatabase { | |
'value': Variable(firstAccountId), | ||
})); | ||
}, | ||
from11To12: (Migrator m, Schema12 schema) async { | ||
await m.addColumn(schema.accounts, schema.accounts.realmName); | ||
await m.addColumn(schema.accounts, schema.accounts.realmIcon); | ||
}, | ||
); | ||
|
||
Future<void> _createLatestSchema(Migrator m) async { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: realmIconUrl in commit message, right?