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

Ensure --force-reset drops previous tables #10506

Merged
merged 3 commits into from
Mar 20, 2024
Merged

Ensure --force-reset drops previous tables #10506

merged 3 commits into from
Mar 20, 2024

Conversation

matthewp
Copy link
Contributor

@matthewp matthewp commented Mar 20, 2024

Changes

Testing

  • Added new unit tests for this.

Docs

N/A, bug fix

Copy link

changeset-bot bot commented Mar 20, 2024

🦋 Changeset detected

Latest commit: 6ba223a

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

// When doing a reset, first create DROP TABLE statements, then treat everything
// else as creation.
if(reset) {
const curSnapshot = oldSnapshot;
Copy link
Member

Choose a reason for hiding this comment

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

nit current > cur

Copy link
Member

Choose a reason for hiding this comment

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

actually, this name is a bit confusing, since it's not really the current snapshot right? Maybe like originalOldSnapshot?

}): Promise<{ queries: string[]; confirmations: string[] }> {
const queries: string[] = [];
let queries: string[] = [];
Copy link
Member

Choose a reason for hiding this comment

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

nit: can we keep this as a const, and instead of overwriting the array do queries.push(...getDropTableQueriesForSnapshot(curSnapshot))? My fear is that future devs blow away existing queries accidentally by re-assigning

]);
});

it('should not drop table when previous snapshot did not have it', async () => {
Copy link
Member

Choose a reason for hiding this comment

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

good test 👍

Copy link
Member

@FredKSchott FredKSchott left a comment

Choose a reason for hiding this comment

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

overall strong +1 !!! Left a few nit comments but resolve them at will

@matthewp matthewp merged commit 980020c into main Mar 20, 2024
13 checks passed
@matthewp matthewp deleted the fix-force-reset branch March 20, 2024 18:42
@astrobot-houston astrobot-houston mentioned this pull request Mar 20, 2024
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.

Unable to create indexes on astro db
2 participants