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 DDL preview functionality #584

Merged
merged 14 commits into from
Aug 12, 2022

Conversation

AliSayyah
Copy link
Member

Hey there!
Just some cleanups and initial base stuff.
Doesn't work right now.

@AliSayyah AliSayyah marked this pull request as draft August 11, 2022 20:15
@codecov-commenter
Copy link

codecov-commenter commented Aug 11, 2022

Codecov Report

Merging #584 (dfad68f) into master (0c44bb2) will increase coverage by 0.38%.
The diff coverage is 92.53%.

@@            Coverage Diff             @@
##           master     #584      +/-   ##
==========================================
+ Coverage   90.82%   91.21%   +0.38%     
==========================================
  Files         105      105              
  Lines        7183     7044     -139     
==========================================
- Hits         6524     6425      -99     
+ Misses        659      619      -40     
Impacted Files Coverage Δ
piccolo/apps/migrations/commands/backwards.py 96.15% <75.00%> (-1.15%) ⬇️
piccolo/apps/migrations/auto/migration_manager.py 94.52% <94.44%> (-0.04%) ⬇️
piccolo/apps/migrations/commands/forwards.py 98.66% <100.00%> (+0.07%) ⬆️
piccolo/apps/user/commands/create.py 38.88% <0.00%> (-9.03%) ⬇️
...ccolo/apps/migrations/auto/serialisation_legacy.py 50.00% <0.00%> (-1.52%) ⬇️
piccolo/apps/sql_shell/commands/run.py 97.22% <0.00%> (-0.22%) ⬇️
piccolo/apps/app/commands/new.py 97.22% <0.00%> (-0.15%) ⬇️
piccolo/apps/schema/commands/generate.py 86.77% <0.00%> (-0.09%) ⬇️
piccolo/columns/combination.py 94.44% <0.00%> (-0.08%) ⬇️
piccolo/apps/playground/commands/run.py 47.86% <0.00%> (-0.04%) ⬇️
... and 30 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@dantownsend
Copy link
Member

@AliSayyah This looks great, thanks!

It's exactly what I had in mind.

@AliSayyah
Copy link
Member Author

AliSayyah commented Aug 12, 2022

I'll work on more tests, but how do you think we should handle the command?

piccolo migrations forwards my_app --preview
piccolo migrations backwards 2018-09-04T19:44:09 --preview

Would this work?

@dantownsend
Copy link
Member

I'll work on more tests, but how do you think we should handle the command?

piccolo migrations forwards my_app --preview
piccolo migrations backwards 2018-09-04T19:44:09 --preview
Would this work?

Yes, I like that 👍

@AliSayyah AliSayyah marked this pull request as ready for review August 12, 2022 10:46
@AliSayyah
Copy link
Member Author

Hey, @dantownsend. This seems ok to me. But let me know if there are any problems, or the tests are insufficient.

Comment on lines -748 to -754
await self._run_add_columns(backwards=True)
await self._run_add_tables(backwards=True)
await self._run_drop_tables(backwards=True)
await self._run_rename_tables(backwards=True)
await self._run_drop_columns(backwards=True)
await self._run_rename_columns(backwards=True)
await self._run_alter_columns(backwards=True)
Copy link
Member

Choose a reason for hiding this comment

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

It looks good - my only concern was this bit.

You've merged run and run_backwards - I can understand why, as it reduces repetition. The order of the operations were slightly different before when running backwards. Having thought about it though, I think the new order should also be fine.

@dantownsend
Copy link
Member

@AliSayyah This looks good to me, thanks.

I think we should release it.

@dantownsend dantownsend merged commit 3d04c3b into piccolo-orm:master Aug 12, 2022
@AliSayyah AliSayyah deleted the #515/extract_migration_sql branch August 12, 2022 12:09
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.

None yet

3 participants