Skip to content

Added create-migration command line instruction #943

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

Merged
merged 4 commits into from
Jun 25, 2025

Conversation

andrewsinnovations
Copy link
Contributor

This update adds a command line interface to create migrations directly with sqlpage, and have it manage the timestamps and uniqueness of migration names.

This is an implementation in rust of #915 that I had previously implemented as a separate system written in nodejs.

You can run "sqlpage create-migration example_migration_1" or "sqlpage create-migration "My Test Migration"" for instance, and it will create a migration under sqlpage/migrations with the filename [timestamp]_example_migration_1.sql or [timestamp]_my_test_migration.sql.

The code handles special characters, and collisions in migration names.

This update adds a command line interface to create migrations directly with sqlpage, and have it manage the timestamps and uniqueness of migration names.
Copy link
Collaborator

@lovasoa lovasoa left a comment

Choose a reason for hiding this comment

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

Useful feature, thank you ! I made a few comments; I can merge once they are addressed.

andrewsinnovations and others added 3 commits June 24, 2025 15:13
Now respects the configuration_directory environment variable.

It also outputs the path of the new migration created when it is created, and takes care to display that path relative to the current working directory.

Lastly, the execution of create-migration command was moved above the rest of the initialization, so that creating a new migration does not run existing migrations. This allows you to create multiple migrations before you run sqlpage normally again to execute them.
@lovasoa lovasoa merged commit 453701c into sqlpage:main Jun 25, 2025
10 checks passed
@lovasoa
Copy link
Collaborator

lovasoa commented Jun 25, 2025

Thank you @andrewsinnovations ! This will be in the next sqlpage !

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.

2 participants