-
Notifications
You must be signed in to change notification settings - Fork 17
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
FORNO-1704: SQL Import - Improve handling of compressed files #1533
Merged
t-wright
merged 11 commits into
trunk
from
forno-1704/add/validate-sql-compressed-file-error
Oct 24, 2023
Merged
FORNO-1704: SQL Import - Improve handling of compressed files #1533
t-wright
merged 11 commits into
trunk
from
forno-1704/add/validate-sql-compressed-file-error
Oct 24, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VIP and local environments only support importing sql and gz files. This adds validations accordingly.
t-wright
force-pushed
the
forno-1704/add/validate-sql-compressed-file-error
branch
from
October 20, 2023 02:31
63310e4
to
4c3be57
Compare
saroshaga
approved these changes
Oct 20, 2023
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.
Code looks good! Haven't tested all flows yet
saroshaga
reviewed
Oct 23, 2023
t-wright
added
the
[Status] Needs Docs
The feature or update requires an update to our public VIP Documentation
label
Oct 23, 2023
saroshaga
approved these changes
Oct 24, 2023
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.
thanks for working on this!
t-wright
deleted the
forno-1704/add/validate-sql-compressed-file-error
branch
October 24, 2023 22:52
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR aims to address some inconsistencies around how compressed files are handled during SQL imports.
gz
files can be successfully imported to a VIP environment usingvip import sql
, but we don't validate extensions in the CLI.vip import validate-sql
on a compressed file will return normal validation errors likeError: SQL Error: DROP TABLE was not found.
even if the uncompressed file is valid.vip dev-env import sql
; compressed files are attempted to be validated and encounter the same issue as described in 2 above.This PR addresses these issues by:
.sql
and.gz
extensions for bothvip import sql
andvip dev-env import sql
.gz
archives invip dev-env import sql
, extracting the archive to a temp directory before importing the resulting SQL file as normalvip import validate-sql
to explain that compressed files can't be validatedSteps to Test
.sql
: https://transfer.sh/5L7MiLwtQH/test.sql.sql.gz
: https://transfer.sh/1t712ht7JL/test.sql.gz.zip
: https://transfer.sh/KJOzR1paS9/test.zipnpm run build
Validation flow:
node ./dist/bin/vip-import-validate-sql.js test.zip
node ./dist/bin/vip-import-validate-sql.js test.sql.gz
node ./dist/bin/vip-import-validate-sql.js test.sql
Dev Env flow:
vip dev-env start --slug <your slug>
to start your local development environmentnode ./dist/bin/vip-dev-env-import-sql.js test.zip --slug <your slug>
node ./dist/bin/vip-dev-env-import-sql.js test.sql.gz --slug <your slug>
node ./dist/bin/vip-dev-env-import-sql.js test.sql --slug <your slug>
Import flow:
node ./dist/bin/vip-import-sql.js test.zip @<id>.production
node ./dist/bin/vip-import-sql.js test.sql @<id>.production
(don't confirm)node ./dist/bin/vip-import-sql.js test.sql.gz @<id>.production
(don't confirm)