Skip to content
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

Upgrade Drift to 2.23.0; start using new features #1248

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

PIG208
Copy link
Member

@PIG208 PIG208 commented Jan 3, 2025

This prepares for #97 (PR #1167).

@PIG208 PIG208 added the maintainer review PR ready for review by Zulip maintainers label Jan 3, 2025
@PIG208 PIG208 requested a review from chrisbobbe January 3, 2025 04:05
Signed-off-by: Zixuan James Li <[email protected]>
… 2.23.0

We will start requiring the more recent features added in releases
since 2.5.0.

Signed-off-by: Zixuan James Li <[email protected]>
The tests are adapted from the test template generated from
`dart run drift_dev make-migrations`.

This saves us from writing the simple migration tests between schemas
without data in the future. For the test that upgrade the schema with
data, with the helper, while it ended up having more lines than the
original, the test becomes more structured this way.

Signed-off-by: Zixuan James Li <[email protected]>
An alternative to this is `dart run drift_dev make-migrations`, which is
essentially a wrapper for the `schema {dump,generate,steps}`
subcommands.  `make-migrations` let us manage multiple database schemas
by configuring them with `build.yaml`, and it dictates the
which subdirectories the generated files will be created at.

Because `make-migrations` does not offer the same level of customizations
to designate exactly where the output files will be, opting out from it
for now.

We can revisit this if it starts to offer features that are not
available with the subcommands, or that we find the need for managing
multiple databases.

See also:
  https://drift.simonbinder.eu/migrations/step_by_step/#manual-generation

Signed-off-by: Zixuan James Li <[email protected]>
We previously missed tables that are not known to the schema.  This
becomes an issue if a new table is added at a newer schema level. When
we go back to an earlier schema, that new table remains in the database,
so subsequent attempts to upgrade to the later schema level that adds
the table will fail, because it already exists.

Testing for this is blocked until zulip#1172.

Signed-off-by: Zixuan James Li <[email protected]>
Copy link
Collaborator

@chrisbobbe chrisbobbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Small comments below, and I'll defer to Greg for a more detailed review of the substantive changes, as I'm not yet up-to-speed on this system. 🙂

// on iOS, -> "Library/Application Support" via https://developer.apple.com/documentation/foundation/nssearchpathdirectory/nsapplicationsupportdirectory
// on Linux, -> "${XDG_DATA_HOME:-~/.local/share}/com.zulip.flutter/"
//
// This is reasonable for iOS per Apple's recommendation:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about "This is the best fit for iOS per Apple's recommendation", if that's true? That would feel more satisfying than just saying it's a reasonable option, because then you wonder if there are other reasonable options and what those look like.

Same for Android and Linux below, and I don't yet follow your reasoning about Android. (Linux is clear from the removed line "That Linux answer is definitely not a fit.")

// $ tools/check --fix drift
// and generate database code with build_runner.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific command we can put here, or perhaps refer the reader to some documentation, even if it's just dart run build_runner --help? (The dart run seems helpful to a contributor arriving here for the first time.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't include the command for this as there are different ways to generate them, and some are more efficient the the others. We should point to the relevant piece of documentation ("Generated files" in README.md), or move this section to the README.

drift: ^2.5.0
drift: ^2.23.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need help checking if podfiles need an update; deps: Upgrade drift to 2.23.0

Confirmed by running tools/upgrade pod at this commit, on a Mac, that no changes to ios/Podfile.lock or macos/Podfile.lock are needed.

Copy link
Member Author

@PIG208 PIG208 Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for confirming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintainer review PR ready for review by Zulip maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants