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

Migration commands refactoring #83

Merged
merged 3 commits into from
Nov 21, 2023
Merged

Migration commands refactoring #83

merged 3 commits into from
Nov 21, 2023

Conversation

butschster
Copy link
Member

@butschster butschster commented Nov 16, 2023

We've made some exciting improvements to the Spiral Framework's Cycle Bridge! Check out what's new:

1. Separate Migrations for Each Entity:

We've added a split option to the cycle:migrate command. Now, when you run

php app.php cycle:migrate -p

it will create individual migrations for each entity.

This means if you have changes in different entity schemas, each entity will get its own specific migration. Super handy for organizing your database updates!

2. Prompt for Pending Migrations:

If there are migrations you haven't completed yet, using cycle:migrate will now prompt you with a choice.

When you run

php app.php cycle:migrate

it will ask if you want to execute these outstanding migrations right away like in the example below:

Outstanding migrations found.

Do you want to run `migrate` now? (yes/no) [yes]:
>

You can use option --no-interaction or -n to omit this question.

php app.php cycle:migrate --no-interaction

3. Safety Check for cycle:sync:

To prevent accidental execution in production, we've added a confirmation step for the cycle:sync command.

When you try

php app.php cycle:sync

in a production environment, it will now ask for your confirmation before proceeding:

This operation is not recommended for production environment.

Would you like to continue? (yes/no) [no]:
>

This extra step helps avoid unintended changes in your live environment.

4. Default 'No' for Critical Commands in Production:

For added security, commands that require environmental checks and confirmations to continue in a production setting will now have no as the default option. This means if you accidentally hit enter, it won't proceed unless you explicitly type yes. A small change, but a big win for avoiding unintended actions!

5. Improved Console Messages:

We've also tweaked some of the messages you see in the console for better clarity and user experience.


We're excited about these updates and believe they will make managing your Spiral projects even smoother. As always, we appreciate your feedback and contributions!

issue #82

1. Added `split` option to the `cycle:migrate` command. This lets you break up changes into several migrations, each for a different table.
2. Now, if there are migrations you haven't done yet and you use the `cycle:migrate` command, it will ask if you want to run these migrations.
3. Put in a check for the `cycle:sync` command to stop it from running by mistake.
4. Made some changes to the messages you see in the console.

issue #82
@butschster butschster added the enhancement New feature or request label Nov 16, 2023
@butschster butschster self-assigned this Nov 16, 2023
@butschster butschster linked an issue Nov 16, 2023 that may be closed by this pull request
@butschster butschster added this to the v2.x milestone Nov 16, 2023
@msmakouz
Copy link
Member

@butschster Pay attention to the tests. (All checks have failed)

@butschster butschster merged commit 56f1aa8 into 2.x Nov 21, 2023
5 checks passed
@butschster butschster deleted the feature/82 branch November 21, 2023 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add cycle:migrate --split option
2 participants