Atrisināts: django izmest iepriekšējās migrācijas

Galvenā problēma ir tāda, ka, izmetot migrāciju un pēc tam mēģināt palaist migrāciju vēlreiz, django neatpazīs jūsu veiktās izmaiņas un tā vietā veiks sākotnējo migrāciju.

I am trying to dump my previous migrations in Django. I have tried the following command:
<code>python manage.py dumpdata --exclude contenttypes --exclude auth.permission &gt; app/fixtures/initial_data.json</code>
However, this only dumps my current data and not the data from my previous migrations. How can I do this?


A:

You can use <code>--format=json</code> to export your data into a json file and then you can use it as a fixture for your future migrations: 
<code>python manage.py dumpdata --format=json --indent=4 &gt; app/fixtures/initial_data.json  # add all your apps here separated by spaces 
</code>

Kas ir izgāztuve

Dump ir komandrindas rīks datu bāzes satura izmešanai teksta failā.

Wot veikt migrāciju Django

1.8

Ir daži dažādi veidi, kā migrēt savus datus programmā Django 1.8.

1. Izmantojiet komandu migrate, lai savā izstrādes serverī palaistu vairākas migrācijas:

$ python manage.py migrēt

2. Izmantojiet rīku django-migrate:

$ pip instalēt django-migrate $ cd myproject $ django-migrate init $ python manage.py migrēt

Related posts:

Leave a Comment