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

migrate:clean bakery command #1007

Merged

Conversation

Projects
None yet
2 participants
@amosfolz
Copy link
Contributor

commented Jul 2, 2019

This command removes stale migrations from the database. These missing migration classes prevent other migrate:* commands from running until the missing class files are either added back to the file system or manually dropped from the migrations table.

I also added a note about the new command when "Unable to find migration..." error messages are given in two of the Migrator classes.

Issue #1002

amosfolz added some commits Jul 2, 2019

Finished draft of MigrateCleanCommand.php
Also updated messages in Migrator classes that command can be run to remove stale migrations.
@amosfolz

This comment has been minimized.

Copy link
Contributor Author

commented Jul 4, 2019

It looks like the 5.6 builds are failing

@lcharette

This comment has been minimized.

Copy link
Member

commented Jul 4, 2019

Looks good. I'll test the actual command when I get the chance, but it could be quite useful in development. Might just add a help part where you explain what a stale migration is and why it can be dangerous to removed them (failed dependencies). A force option could be useful in this case to by-pass the confirmation.

Update MigrateCleanCommand.php
Add help, add -f option to bypass confirmation prompt
@amosfolz

This comment has been minimized.

Copy link
Contributor Author

commented Jul 4, 2019

Looks good. I'll test the actual command when I get the chance, but it could be quite useful in development. Might just add a help part where you explain what a stale migration is and why it can be dangerous to removed them (failed dependencies). A force option could be useful in this case to by-pass the confirmation.

Added help message and force option in recent commit.

@lcharette lcharette added this to the 4.2.x milestone Jul 6, 2019

@codecov

This comment has been minimized.

Copy link

commented Jul 6, 2019

Codecov Report

Merging #1007 into hotfix will decrease coverage by 0.33%.
The diff coverage is 2.63%.

Impacted file tree graph

@@             Coverage Diff              @@
##             hotfix    #1007      +/-   ##
============================================
- Coverage      68.3%   67.97%   -0.34%     
- Complexity     2141     2151      +10     
============================================
  Files           159      160       +1     
  Lines          7289     7325      +36     
============================================
  Hits           4979     4979              
- Misses         2310     2346      +36
Impacted Files Coverage Δ Complexity Δ
.../sprinkles/core/src/Bakery/MigrateCleanCommand.php 0% <0%> (ø) 10 <10> (?)
.../sprinkles/core/src/Database/Migrator/Migrator.php 93.24% <0%> (ø) 56 <0> (ø) ⬇️
.../Database/Migrator/MigrationDependencyAnalyser.php 94.23% <100%> (ø) 24 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 21e43db...7ba71a4. Read the comment docs.

@codecov

This comment has been minimized.

Copy link

commented Jul 6, 2019

Codecov Report

Merging #1007 into hotfix will decrease coverage by 1.57%.
The diff coverage is 2.63%.

Impacted file tree graph

@@             Coverage Diff              @@
##             hotfix    #1007      +/-   ##
============================================
- Coverage      68.3%   66.73%   -1.58%     
+ Complexity     2141     2088      -53     
============================================
  Files           159      160       +1     
  Lines          7283     6861     -422     
============================================
- Hits           4975     4579     -396     
+ Misses         2308     2282      -26
Impacted Files Coverage Δ Complexity Δ
.../sprinkles/core/src/Bakery/MigrateCleanCommand.php 0% <0%> (ø) 10 <10> (?)
.../sprinkles/core/src/Database/Migrator/Migrator.php 93.1% <0%> (+1.21%) 52 <0> (-4) ⬇️
.../Database/Migrator/MigrationDependencyAnalyser.php 94.23% <100%> (ø) 24 <0> (ø) ⬇️
app/sprinkles/core/src/Util/EnvironmentInfo.php 43.75% <0%> (-12.5%) 5% <0%> (ø)
app/sprinkles/core/src/Util/RawAssetBundles.php 47.22% <0%> (-6.84%) 17% <0%> (ø)
app/sprinkles/admin/src/Sprunje/UserSprunje.php 20.4% <0%> (-6.01%) 24% <0%> (ø)
...pp/sprinkles/account/src/Twig/AccountExtension.php 89.47% <0%> (-5.99%) 6% <0%> (-1%)
app/sprinkles/core/src/Twig/CoreExtension.php 83.87% <0%> (-3.63%) 8% <0%> (-3%)
...prinkles/core/src/Bakery/MigrateRefreshCommand.php 65.62% <0%> (-3.13%) 8% <0%> (ø)
app/sprinkles/core/src/Bakery/MigrateCommand.php 69.04% <0%> (-3.05%) 12% <0%> (ø)
... and 51 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 21e43db...7ba71a4. Read the comment docs.

@lcharette lcharette merged commit 3516f98 into userfrosting:hotfix Jul 6, 2019

2 of 4 checks passed

codecov/patch 2.63% of diff hit (target 68.3%)
Details
codecov/project 67.97% (-0.34%) compared to 21e43db
Details
continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@amosfolz amosfolz deleted the amosfolz:hotfix-migrate-clean-bakeryCommand branch Jul 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.