Questions tagged [schema-migration]

Schema migration refers to altering the data schema used in an application. This may merely involve changing the database, but frequently also involves code alterations.

Schema migration refers to altering the data schema used in an application. This may merely involve changing the database, but frequently also involves code alterations.

Because the data schema is often relatively stable, and code usually embeds assumptions about it, schema-migration must be handled carefully.

64 questions
153
votes
12 answers

How to move a model between two Django apps (Django 1.7)

So about a year ago I started a project and like all new developers I didn't really focus too much on the structure, however now I am further along with Django it has started to appear that my project layout mainly my models are horrible in…
Sam Buckingham
  • 1,771
  • 2
  • 13
  • 16
65
votes
9 answers

Django 1.8 - what's the difference between migrate and makemigrations?

According to the documentation here: https://docs.djangoproject.com/en/1.8/topics/migrations/ it says: migrate, which is responsible for applying migrations, as well as unapplying and listing their status. and makemigrations, which is responsible…
SilentDev
  • 20,997
  • 28
  • 111
  • 214
36
votes
10 answers

Move models between Django (1.8) apps with required ForeignKey references

This is an extension to this question: How to move a model between two Django apps (Django 1.7) I need to move a bunch of models from old_app to new_app. The best answer seems to be Ozan's, but with required foreign key references, things are bit…
Shreyas
  • 363
  • 3
  • 7
29
votes
8 answers

What is your favorite solution for managing database migrations in django?

I quite like Rails' database migration management system. It is not 100% perfect, but it does the trick. Django does not ship with such a database migration system (yet?) but there are a number of open source projects to do just that, such as…
MiniQuark
  • 46,633
  • 36
  • 147
  • 183
28
votes
2 answers

Are there any concepts for firestore db schema migrations comparable to rails ActiveRecord migrations?

Our firestore DB based model evolves naturally. Now we would like to update all existing documents to the new (implicit) schema. Are there any tools supporting that or what are the best practices. I would love to have a concept comparable to the…
Mutual Exception
  • 1,240
  • 12
  • 27
26
votes
3 answers

Support for schema migrations with JPA?

I've been briefly looking at JPA recently, and I was wondering what the deal is with database schema migrations and staying lined up with the classes you've created. Is there support in JPA for this stuff? Utilities? Best Practises? Cheers!
brabster
  • 42,504
  • 27
  • 146
  • 186
9
votes
3 answers

Move Django model from one app to another

I made the stupid mistake of creating too many models in the same Django app, now I want to split it into 3 distinct ones. Problem is: there's already data in production in two customers' sites, so I need to carefully plan any schema/data migration…
mgibsonbr
  • 21,755
  • 7
  • 70
  • 112
8
votes
1 answer

Django: flush command doesnt completely clear database, reset fails

I rewrote a lot of my models, and since I am just running a test server, I do ./manage.py reset myapp to reset the db tables and everything has been working fine. But I tried to do it this time, and I get an error, "The full error: contraint…
DantheMan
  • 7,247
  • 10
  • 33
  • 36
8
votes
1 answer

Doctrine schema update fails on foreign key

I'm trying to do a schema update using the app/console doctrine:schema:update --force command, but Doctrine fails on the following part: An exception occurred while executing 'DROP INDEX IDX_E98F2859A074D5D7 ON contract': …
viraptor
  • 33,322
  • 10
  • 107
  • 191
6
votes
3 answers

What is the recommended way to temporarily disable my Google App Engine app so that I can perform schema migration?

I'd like to disable user access to my app so that I can perform a schema migration. I've looked into a few possibilities and found possible shortcomings: Disable datastore writes - I'd rather just bring my whole application down so that people do…
shino
  • 4,562
  • 5
  • 38
  • 57
4
votes
2 answers

How to manage schema changes to a BigQuery table via Terraform

We currently use the following mechanism to create a BigQuery table with a pre-defined schema and we created the infrastructure. https://www.terraform.io/docs/providers/google/r/bigquery_table.html The dev team decided to modify the schema by adding…
klee
  • 1,554
  • 2
  • 19
  • 31
4
votes
1 answer

Run Flyway Migration Asynchronously

By design the flyway migrations run in transactions and synchronously pretty early during startup of an application. This is usually desired, to ensure before business logic starts to execute the database is in a consistent state (migrated) or the…
icyerasor
  • 4,973
  • 1
  • 43
  • 52
4
votes
0 answers

Cassandra schema migration in java

I wrote on .NET and Entity Framework for quite a while, and I got used to the Entity Framework Code First Migrations. The idea is that you describe your tables in the code and you create a migration. Which in tern checks the current database schema…
Ivan Stoyanov
  • 5,412
  • 12
  • 55
  • 71
4
votes
2 answers

How the schema migration tools work?

I have db based application and I delete the schema & db content every time whenever there is any changes in the schema. Now it is in development mode. Soon we release the application in production. But we suspect there could be many changes after…
user90150
3
votes
1 answer

Best practice for adding code and status values with FluentMigrator?

We are working on a project that uses Entity Framework 4 (code-first) and Fluent Migrator. In going throughout the project, we've created migrations for all of our schema changes and profiles for test-data that we want populated in our various…
Jeffrey Harrington
  • 1,797
  • 1
  • 15
  • 24
1
2 3 4 5