Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django - generate CREATE TABLE sql for models

Is there any way in django to generate the CREATE TABLE script for my models for a particular DB engine? (MySQL in my case)

like image 633
Martin Massera Avatar asked Oct 20 '25 16:10

Martin Massera


1 Answers

you can use command in console

python manage.py sqlmigrate <appname> migration_name

where migration name is the name of file with migration that you need. e.g.

python manage.py sqlmigrate manager 0001_initial
like image 190
Andrey Maslov Avatar answered Oct 23 '25 06:10

Andrey Maslov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!