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

sql:migrate --force shouldn't prompt #7208

Merged
merged 3 commits into from
May 22, 2024
Merged

sql:migrate --force shouldn't prompt #7208

merged 3 commits into from
May 22, 2024

Conversation

fredzqm
Copy link
Contributor

@fredzqm fredzqm commented May 22, 2024

Description

firebase dataconnect:sql:migrate --force should never prompt.

firebase dataconnect:sql:migrate should prompt for schema migrations and then abort if there is invalid connectors. This way developers can see the SQL before taking the suggesting and run it with --force.

Scenarios Tested

Sample Commands

Without invalid connectors

firebase dataconnect:sql:migrate
Screenshot 2024-05-22 at 12 20 37 PM

firebase dataconnect:sql:migrate --force
Screenshot 2024-05-22 at 12 21 27 PM

With invalid connectors

firebase dataconnect:sql:migrate
Screenshot 2024-05-22 at 12 23 41 PM

firebase dataconnect:sql:migrate --force
Screenshot 2024-05-22 at 12 24 44 PM

@fredzqm fredzqm changed the title Prompt for schema migration before invalid connectors sql:migrate --force shouldn't prompt May 22, 2024
): Promise<"none" | "safe" | "all"> {
err: IncompatibleSqlSchemaError | undefined,
validateOnly: boolean,
): Promise<"none" | "all"> {
Copy link
Member

Choose a reason for hiding this comment

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

Since there's only two options now, should this return Promise<false | true>? Also does maybeExecuteSchemaMigration better describe what this method does?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method doesn't execute schema migration. It determines whether to execute it later.

Well, keeping it as string merely because we will have a "compatible" mode soon. At least 3 value enum is needed here.

@fredzqm
Copy link
Contributor Author

fredzqm commented May 22, 2024

Thanks!

@fredzqm fredzqm enabled auto-merge (squash) May 22, 2024 22:46
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 10 lines in your changes are missing coverage. Please review.

Project coverage is 54.06%. Comparing base (c94b5ab) to head (1ab7ed2).
Report is 43 commits behind head on master.

Files Patch % Lines
src/dataconnect/schemaMigration.ts 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7208      +/-   ##
==========================================
- Coverage   54.10%   54.06%   -0.05%     
==========================================
  Files         387      386       -1     
  Lines       26094    26108      +14     
  Branches     5358     5361       +3     
==========================================
- Hits        14119    14115       -4     
- Misses      10715    10733      +18     
  Partials     1260     1260              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fredzqm fredzqm merged commit ddb40f5 into master May 22, 2024
35 checks passed
@fredzqm fredzqm deleted the fz/migrate-force branch October 7, 2024 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants