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.

9601 questions
181
votes
7 answers

rake db:schema:load vs. migrations

Very simple question here - if migrations can get slow and cumbersome as an app gets more complex and if we have the much cleaner rake db:schema:load to call instead, why do migrations exist at all? If the answer to the above is that migrations are…
sscirrus
  • 50,379
  • 41
  • 125
  • 211
176
votes
20 answers

SQL Server String or binary data would be truncated

I am involved in a data migration project. I am getting the following error when I try to insert data from one table into another table (SQL Server 2005): Msg 8152, Level 16, State 13, Line 1 String or binary data would be truncated. The source…
Jim Evans
  • 5,390
  • 10
  • 32
  • 56
166
votes
19 answers

List all sequences in a Postgres db 8.1 with SQL

I'm converting a db from postgres to mysql. Since i cannot find a tool that does the trick itself, i'm going to convert all postgres sequences to autoincrement ids in mysql with autoincrement value. So, how can i list all sequences in a Postgres DB…
apelliciari
  • 7,321
  • 7
  • 53
  • 89
164
votes
7 answers

Adding :default => true to boolean in existing Rails column

I've seen a few questions (namely this one) here on SO about adding a default boolean value to an existing column. So I tried the change_column suggestion but I mustn't be doing it right. I tried: $ change_column :profiles, :show_attribute,…
tvalent2
  • 4,879
  • 9
  • 42
  • 83
162
votes
10 answers

Rails 3 migrations: Adding reference column?

If I create a new rails 3 migration with (for example) rails g migration tester title:tester user:references , everything works fine...however if I add a column with something along the lines of: rails g migration add_user_to_tester…
PlankTon
  • 11,872
  • 14
  • 82
  • 144
147
votes
18 answers

How to implement LIMIT with SQL Server?

I have this query with MySQL: select * from table1 LIMIT 10,20 How can I do this with SQL Server?
Bigballs
  • 3,361
  • 9
  • 28
  • 27
139
votes
17 answers

Dependency graph of Visual Studio projects

I'm currently migrating a big solution (~70 projects) from VS 2005 + .NET 2.0 to VS 2008 + .NET 3.5. Currently I have VS 2008 + .NET 2.0. The problem is that I need to move projects one by one to new .NET framework ensuring that no .NET 2.0 project…
Migol
  • 7,465
  • 8
  • 44
  • 68
138
votes
5 answers

Ruby on Rails: How do I add a not null constraint to an existing column using a migration?

In my Rails (3.2) app, I have a bunch of tables in my database but I forgot to add a few not null constraints. I've googled around but I can't find how to write a migration which adds not null to an existing column. TIA.
David Robertson
  • 1,710
  • 3
  • 11
  • 12
136
votes
5 answers

Migrating from JSF 1.2 to JSF 2.0

I am working with a rather large app written in JSF 1.2. JSF 1.2 is around 6 years old now. I need to upgrade to JSF 2.0. How painful will this be? I noticed that some attributes in custom tags have been changed etc.
mkoryak
  • 54,015
  • 59
  • 193
  • 252
136
votes
20 answers

Mechanisms for tracking DB schema changes

What are the best methods for tracking and/or automating DB schema changes? Our team uses Subversion for version control and we've been able to automate some of our tasks this way (pushing builds up to a staging server, deploying tested code to a…
pix0r
  • 30,601
  • 18
  • 82
  • 102
134
votes
5 answers

Rails migration: t.references with alternative name?

So I have a create_table like this for Courses at a School: create_table :courses do |t| t.string :name t.references :course t.timestamps end but I want it to reference two other courses like: has_many :transferrable_as # A Course has_many…
themirror
  • 8,937
  • 6
  • 38
  • 71
133
votes
8 answers

Populating a database in a Laravel migration file

I'm just learning Laravel, and have a working migration file creating a users table. I am trying to populate a user record as part of the migration: public function up() { Schema::create('users', function($table){ …
Adam Hopkinson
  • 26,835
  • 7
  • 57
  • 87
129
votes
26 answers

Package Manager Console Enable-Migrations CommandNotFoundException only in a specific VS project

I tried to run the command 'Enable-Migrations' in a new project and I got the message: PM> Enable-Migrations The term 'Enable-Migrations' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of…
Eduardo Brites
  • 4,055
  • 4
  • 33
  • 49
127
votes
6 answers

Rails: Adding an index after adding column

Suppose I created a table table in a Rails app. Some time later, I add a column running: rails generate migration AddUser_idColumnToTable user_id:string. Then I realize I need to add user_id as an index. I know about the add_index method, but…
user1611830
  • 4,209
  • 7
  • 47
  • 79
127
votes
7 answers

How do I migrate a model out of one django app and into a new one?

I have a django app with four models in it. I realize now that one of these models should be in a separate app. I do have south installed for migrations, but I don't think this is something it can handle automatically. How can I migrate one of the…
Apreche
  • 23,946
  • 8
  • 37
  • 46