Tuesday, December 7, 2021

Why does sqlmigrate need a connection to an existing database?

Wondering why sqlmigrate needs a connection to an existing database.

I understand that for certain commands, it needs the database to generate the migration. But for most (basic) commands, no connection is really needed.

For example, I created a test project and generated migration files. Without ever running the `migrate` command, I was able to use `sqlmigrate` perfectly well on all migrations, save the last, which drops a `unique_together`.

I'm sure there are other commands which actually need a database connection (though I haven't found them yet). Seems to me sqlmigrate could be rewritten along the lines of:
  • Try to generate sql from migration file
  • If it hits a command it needs the database, attempt to connect
Or else:
  • If no connection, check if migration file needs connection to database
Is there something I'm unaware of?


This email may contain confidential material; unintended recipients must not disseminate, use, or act upon any information in it. If you received this email in error, please contact the sender and permanently delete the email.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0a3fb366-a95a-46a3-8156-2e2c618f72b4n%40googlegroups.com.

No comments:

Post a Comment