piccolo icon indicating copy to clipboard operation
piccolo copied to clipboard

Be able to see the DDL generated by migrations

Open dantownsend opened this issue 3 years ago • 0 comments

Discussed in https://github.com/piccolo-orm/piccolo/discussions/514

Originally posted by theelderbeever May 16, 2022 Throwing this out there as a possible suggestion. It would be potentially valuable to have an --sql option with the migration management where the output of piccolo migrations new --sql is a .sql file instead of using python code. This maybe useful in debugging and transparency into what will be run and how. I know of one other ORM that does this (Hasura) and it was nice to easily edit the migration.

dantownsend avatar May 17 '22 12:05 dantownsend

Hey @dantownsend Can I have a try on this? This option could help me out right now.

AliSayyah avatar Aug 11 '22 14:08 AliSayyah

@AliSayyah Yes, that would be great.

We need to modify MigrationManager somehow so instead of running queries, it prints out the SQL.

https://github.com/piccolo-orm/piccolo/blob/master/piccolo/apps/migrations/auto/migration_manager.py

dantownsend avatar Aug 11 '22 14:08 dantownsend

@AliSayyah Yes, that would be great.

We need to modify MigrationManager somehow so instead of running queries, it prints out the SQL.

https://github.com/piccolo-orm/piccolo/blob/master/piccolo/apps/migrations/auto/migration_manager.py

Ok, thank you.

AliSayyah avatar Aug 11 '22 15:08 AliSayyah

Fixed by https://github.com/piccolo-orm/piccolo/pull/584

dantownsend avatar Aug 12 '22 12:08 dantownsend