Questions tagged [migration]

An action of moving between major versions of any framework, product or language, or, just as commonly, alteration to the data schema of an application. This might involve modifying existing data to make it work with the new version.

An action of moving between major versions of any framework, product or language, or, just as commonly, alteration to the data schema of an application. This might involve modifying existing data to make it work with the new version.

11009 questions
103
votes
9 answers

Ruby on Rails: How can I revert a migration with rake db:migrate?

After installing devise MODEL User i got this. class DeviseCreateUsers < ActiveRecord::Migration def self.up create_table(:users) do |t| t.database_authenticatable :null => false t.recoverable t.rememberable …
cola
  • 12,198
  • 36
  • 105
  • 165
103
votes
11 answers

Rake just one migration

I'm trying to run just one migration out of a whole bunch in my rails app. How can I do this? I don't want to run any of the migrations before or after it. Thanks.
Anon
  • 5,103
  • 11
  • 45
  • 58
101
votes
2 answers

Rails Migration to make a column null => true

I had originally created a table with column as t.string "email", :default => "", :null => false The requirement has changed and now I need to allow email to be null. How can I write a migration to make :null => true
Pykih
  • 2,769
  • 3
  • 29
  • 38
99
votes
13 answers

Django migration error :you cannot alter to or from M2M fields, or add or remove through= on M2M fields

I'm trying to modify a M2M field to a ForeignKey field. The command validate shows me no issues and when I run syncdb : ValueError: Cannot alter field xxx into yyy they are not compatible types (you cannot alter to or from M2M fields, or add or…
loar
  • 1,505
  • 1
  • 15
  • 34
95
votes
23 answers

Error: Schema validation failed with the following errors: Data path "" should NOT have additional properties(project)

After migrating application from angular 5 to 6, on running ng serve the following errors pop up. Schema validation failed with the following errors: Data path "" should NOT have additional properties(project). Error: Schema validation failed…
V5NEXT
  • 1,907
  • 4
  • 19
  • 38
95
votes
1 answer

Rails 3 Migration with longtext

I am needing to change a column type from text to longtext in my Rails script, but can't find anything on how to do this. Has anyone ran across this? Thanks! Dennis
dennismonsewicz
  • 25,132
  • 33
  • 116
  • 189
95
votes
5 answers

How can I disable code first migrations

I have a code-first entity model in EF5. But I want to manage the database changes manually -- I do not want EF to modify my existing database and all its data. But when I make parallel changes in the EF mapping and in the database, EF refuses to…
Stan Hargrove
  • 951
  • 1
  • 6
  • 3
93
votes
8 answers

Replacing ld with gold - any experience?

Has anyone tried to use gold instead of ld? gold promises to be much faster than ld, so it may help speeding up test cycles for large C++ applications, but can it be used as drop-in replacement for ld? Can gcc/g++ directly call gold.? Are there any…
IanH
  • 3,968
  • 2
  • 23
  • 26
92
votes
13 answers

How to reset migrations in Django 1.7

(I know there is a title the same as this, but the question is different). I have managed to get my development machine migrations and production migrations out of sync. I have a Django app which was using South. I had my own workflow that worked…
wobbily_col
  • 11,390
  • 12
  • 62
  • 86
91
votes
3 answers

Rails migrations: self.up and self.down versus change

Looks like the new rails version has "change" versus self.up and self.down methods. So what happens when one has to roll back a migration how does it know what actions to perform. I have the following method that I need to implement based on an…
banditKing
  • 9,405
  • 28
  • 100
  • 157
90
votes
5 answers

Rails Migrations: Check Existence and Keep Going?

I was doing this kind of thing in my migrations: add_column :statuses, :hold_reason, :string rescue puts "column already added" but it turns out that, while this works for SQLite, it does not work for PostgreSQL. It seems like if the add_column…
Dan Rosenstark
  • 68,471
  • 58
  • 283
  • 421
89
votes
1 answer

Django 1.8 Run a specific migration

In django 1.8 is there a way to run a specific migration and that migration only. Not for one app only but a specific file in that apps migrations directory. EDIT TO ORIGINAL: Traceback (most recent call last): File "manage.py", line 10, in…
bgrantdev
  • 1,622
  • 4
  • 17
  • 29
88
votes
14 answers

Using Rails, how can I set my primary key to not be an integer-typed column?

I'm using Rails migrations to manage a database schema, and I'm creating a simple table where I'd like to use a non-integer value as the primary key (in particular, a string). To abstract away from my problem, let's say there's a table employees…
Rudd Zwolinski
  • 26,712
  • 17
  • 57
  • 60
86
votes
8 answers

Update one column to value of another in Rails migration

I have a table in a Rails app with hundreds of thousands of records, and they only have a created_at timestamp. I'm adding the ability to edit these records, so I want to add an updated_at timestamp to the table. In my migration to add the column, I…
jrdioko
  • 32,230
  • 28
  • 81
  • 120
86
votes
8 answers

Migrations for Java

I use both ruby on rails and Java. I really enjoy using migrations when I am working on a rails project. so I am wondering is there a migrations like tool for Java? If there is no such tool is it a good idea to use migrations as a tool to control…
Josh Moore
  • 13,338
  • 15
  • 58
  • 74