postgresql - Techniques to Avoid Problems with Django Migrations? -


i'm building e-commerce website django 1.8 , postgresql 9.4. i'm interested in learning techniques can use when change database avoid having problems django migrations, particularly in event can't migrations run , have delete migrations, rebuild database, , restore backups.

in development, i've found when change database schema , re-run migrations, run 50% of time. i'm doing things wrong. what's worse when migrations don't work, it's not easy understand why failed , how modify migration files run. in situations, have delete database , start over. acceptable in development it's not strategy when go production.

what "best practices" or "do's , don'ts" follow when modify model classes/database schema increase probability django migrations run? , there steps take ensure can restore database in event migrations won't run , have rebuild database scratch? should add i'm one-person startup don't have conflict issues team working same code base have.

these techniques i'm using

  1. work locally in same environment i'm working in on server. same version of django , database server push migrations itself, don't ignore it, , migrate on server using there migrations.
  2. this 1 used once migrate manually, created tables, indices, relations using sql commands manually , worked too.

i prefer first 1 more


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -