I tried to get the raw sql from Django migrate file.
I took the following steps:
$ python manage.py makemigrations
$ python manage.py sqlmigrate app_name 0001
and raw sql command should display, but the result only contains:
BEGIN;
--
-- Create model User
--
--
-- Create model Config
--
COMMIT;
How to get the raw sql from sqlmigrate?
I read the source code of sqlmigrate and found that add DB name for migrate may work.
So the working version would be:
$ python manage.py sqlmigrate app_name 0001 --database=db_name
The source code is here: https://github.com/django/django/blob/master/django/core/management/commands/migrate.py
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With