Tuesday, December 28, 2021

Re: are migrations the same regardless of database type?

Not exactly.  Migrations try to be generalized across db types, but that doesn't mean that you can be using db-specific features in your models and ORM usage.  Thats one reason its highly, highly recommended to use the same database and version at all layers of your stack.

In other words, if you're using sqlite locally and postgres in deployment, you're opening yourself to the high probability of having to figure something out and finding out that its due to different features in the db.  

On Tuesday, December 28, 2021 at 10:42:56 AM UTC-5 lie...@punkt.de wrote:
As far as I know, the migrations are "Python-Code" in themselves, only
defining which tables change in what way. Only when they are being
applied, this is turned into actual database code.

But you can test this easily by creating migrations and look at them. Or
use e.g. a postgres docker container, if my memory is wrong.

Cheers

Lars

Am 28.12.21 um 16:02 schrieb Anil Felipe Duggirala:
> hello,
> I running an app locally using an SQlite database (I have not been able to set up postgresql locally). I am running the same app in Heroku, using Postgresql.
> If I run "makemigrations" locally, then push those migrations to Heroku (which is using postgresql), will those migrations be applied correctly by just doing "migrate" on Heroku.
> Do the contents of migrations files depend on the database type that is associated to the app when creating the migrations?
> thank you,
>
> Anil F
>
--
punkt.de GmbH
Lars Liedtke
.infrastructure

Kaiserallee 13a
76133 Karlsruhe

Tel. +49 721 9109 500
https://infrastructure.punkt.de
in...@punkt.de

AG Mannheim 108285
Geschäftsführer: Jürgen Egeling, Daniel Lienert, Fabian Stein

--
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/60d5140c-5126-4317-ac51-beef4030f08dn%40googlegroups.com.

No comments:

Post a Comment