database migrations

54 views
Skip to first unread message

Perceval Maturure

unread,
Aug 2, 2019, 8:40:24 AM8/2/19
to django...@googlegroups.com
Dear all
creating a new database as applications increase has been one of the solutions to some of the errors i have encountered especially after adding a django cms by hand in my development environment.

i cant imagine a situation like that in a production environment as this will mean re-entry of data.
please share some thought*****
Regards
--
Perceval Maturure
083 303 9423

Jani Tiainen

unread,
Aug 3, 2019, 5:28:27 AM8/3/19
to django...@googlegroups.com
Hi.

So... what is the actual question?

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFZtZmBdeYCM0HXUkuM2k1V%3D_6B%3DUUDr%3DNZn77yun0On_gsDuA%40mail.gmail.com.

Perceval Maturure

unread,
Aug 3, 2019, 6:19:05 AM8/3/19
to django...@googlegroups.com
Question is what’s the best way forward to avoid situations where u will have to create a new database if ur applications do not work with the current databases so as to avoid populating the database with data again




Sent from my iPhone

RLM

unread,
Aug 3, 2019, 7:19:48 PM8/3/19
to django...@googlegroups.com

Why try to avoid re populating the database? That's the easy part, figuring what went wrong is more difficult.You don't need a lot of data to get an app working, you just need to understand what you want and how to achieve it.

When I was learning django I rebuilt my events database 20 times sometimes using the original data and sometimes by starting afresh.
If you have valid working data consider writing the data tables to csv then write that data into the new tables, it takes a couple of seconds to recreate a table once you have the fields the same as the csv. I found that when using a csv in spreadsheet it highlighted issues in the data sets

When experimenting, I suggest use SQLite and simply rename the database in the /dev app and start a new SQLite database by renaming it in the config file. That way you have previous data and new data in the same django application.

Also you could simply create new models in the current database and repopulate only the fields you need in the new model.
In all the above the main trouble will be joins. Get one small fields wrong and the join fails.

Cheers
Roger

--
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...@googlegroups.com.

Perceval Maturure

unread,
Aug 4, 2019, 2:55:09 AM8/4/19
to django...@googlegroups.com
Thanks Roger.


--
Sent from Gmail Mobile

Jani Tiainen

unread,
Aug 4, 2019, 8:34:48 AM8/4/19
to django...@googlegroups.com
Hi.

To me this sounds more debugging issue than migrations or database problem.

Since it is most definitely your code that doesn't work right.

Of course if youre building and testing features that fill thousands of entries or relatively complex data there are options.

Personally I use "template database". Rather big db but at least it is in known state.

You could have scripts to populate db after creation. Many ways to do that as well.

Mike Dewhirst

unread,
Aug 5, 2019, 12:02:06 AM8/5/19
to django...@googlegroups.com
Once I have a database I wish to replicate many times for testing I just
use pg_dump to create a json file which can be reloaded into an empty
database as often as required. For that I use a script which
sequentially calls dropdb, createdb and finally psql which nominates the
json dump file created earlier.

Have a look at PostgreSQL documentation online for those commands or
similar docs for similar commands if you use a different RDBMS

Cheers



On 4/08/2019 10:34 pm, Jani Tiainen wrote:
> Hi.
>
> To me this sounds more debugging issue than migrations or database
> problem.
>
> Since it is most definitely your code that doesn't work right.
>
> Of course if youre building and testing features that fill thousands
> of entries or relatively complex data there are options.
>
> Personally I use "template database". Rather big db but at least it is
> in known state.
>
> You could have scripts to populate db after creation. Many ways to do
> that as well.
>
> la 3. elok. 2019 klo 13.19 Perceval Maturure <drper...@gmail.com
> <mailto:drper...@gmail.com>> kirjoitti:
>
> Question is what’s the best way forward to avoid situations where
> u will have to create a new database if ur applications do not
> work with the current databases so as to avoid populating the
> database with data again
>
>
>
>
> Sent from my iPhone
>
> On 02 Aug 2019, at 14:39, Perceval Maturure <drper...@gmail.com
> <mailto:drper...@gmail.com>> wrote:
>
>> Dear all
>> creating a new database as applications increase has been one of
>> the solutions to some of the errors i have encountered especially
>> after adding a django cms by hand in my development environment.
>>
>> i cant imagine a situation like that in a production environment
>> as this will mean re-entry of data.
>> please share some thought*****
>> Regards
>> --
>> *Perceval Maturure*
>> *083 303 9423
>> *
> --
> 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...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> <https://groups.google.com/d/msgid/django-users/2D3BA6A6-EDC6-4599-B519-64593AE64A1F%40gmail.com?utm_medium=email&utm_source=footer>.
>
> --
> 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...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHn91od2f91AxBwRKPXDHPG8D0_%3D-aMTReya%2BxH%2B_5K6O%3DWyGA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHn91od2f91AxBwRKPXDHPG8D0_%3D-aMTReya%2BxH%2B_5K6O%3DWyGA%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Reply all
Reply to author
Forward
0 new messages