Questions tagged [dbmigrate]

Database migration framework.

What question should have this tag?

Database migration related question using a framework.

Basic Definitions

Database migration refers to the change of schema over time. It is common for a project's schemas to evolve depends on the need. Similarly, migration can help to add or remove columns from the schema/table.

Introduction

Typically a migration has an up and down method, so you can roll back any migrations. For example in nodejs, a migration might look like this:

//20180722013000-location.ts

exports.up = (db: any) => {
    return db.createTable("Location", {
        description: "text",
        geoCode: "jsonb",
        id: {
            allowNull: false,
            autoIncrement: true,
            primaryKey: true,
            type: "int",
        },
        locationId: "int",
        name: "string",
        open: "boolean",
    });
};

exports.down = (db: any) => {
    return db.dropTable("Location");
};

This migration will handle creating a table with that scheme on up and dropTable on down.

Learn more

Rails Active Record migration

Node Migration

Sequelize cli // A simple solution for migration and even support seeding

290 questions
2
votes
2 answers

Yii migrate command issue

I have followed this step by step instruction to create a table in my database using migrate command but I wondered how it is finalized at the last step. after running "yiic migrate" command I get the following message: Yii Migration Tool v1.0…
Hamid Ghorashi
  • 1,003
  • 3
  • 14
  • 29
2
votes
1 answer

rake db:migrate error (Function 'inotify_init' not found)

I just got done setting up my rails environment on my old mac book and ran into this error. I've installed FFI and rb-inotify. I've also ran bundle install again. I've looked…
Foolish Chap
  • 765
  • 1
  • 5
  • 19
2
votes
1 answer

rails : rake db:create is not creating the new table

I am working on an existing rails project where I have to add a new tab. Well, I have written all the corresponding models, views and controllers and then changed the schema.rb file to create the new table. create_table "ryan_indices", :force =>…
2
votes
1 answer

heroku run db:migrate fail as rake aborted

after pushing my latest code Heroku doesn't alter the tables. when i run "heroku rake db:migrate" i get rake aborted! its says syntax error but i cant figure where is the error syntax error on line 4, col 586: ` state:…
kisin
  • 177
  • 3
  • 4
  • 13
2
votes
1 answer

Vagrant, VirtualBox, Capistrano, db:migrate - could not connect to server

I have just worked my way through the book "Deploying Rails" and im stuck where capaistrano calls db:migrate. I have set up two VMs - app und db - each of them separate working perfektly. The VM app ist hostin nginx/unicorn and the VM db ist…
Stefan Kühn
  • 339
  • 2
  • 11
2
votes
1 answer

Conversion of DDL Oracle to Postgres

I have a very huge DDL script in Oracle of our existing Application, It has no Stored Procedures. Just Tables, Sequences and constraints. What is the best way to convert it to Postgres? Some people say its better to do it by hand, and some say…
bali208
  • 2,257
  • 7
  • 40
  • 43
1
vote
1 answer

Ancestry db:migrate

I am trying to install the Ancestry gem but I am having problems with rake db:migrate. I am following the instructions on the Ancestry github page. After I have done rails g migration add_ancestry_to_message ancestry:string I am editing the…
Tom Kadwill
  • 1,448
  • 3
  • 15
  • 21
1
vote
1 answer

Rails 3 rake db:migrate fails with a 'rake aborted! can't convert SQLite3::Statement into Array'

I was working through Ruby on Rails 3 tutorial when I experienced an error while trying to migrate my db. The 'can't convert SQLite3::Statement into Array' error appears even if I do a db:drop before running db:migrate. I've tried updating rake and…
Anna
  • 61
  • 10
1
vote
1 answer

rake db:miagrate aborted abnormal: rake aborted! uninitialized constant Rake::DSL

Anyone could help me? I searched the same problem, but I can't figure out a solution still. I ran successfully with "bundle update" "bundle install" but when running "rake db:migrate" I got the following problem... rake aborted! uninitialized…
aaron
  • 1,951
  • 3
  • 27
  • 41
1
vote
1 answer

heroku rake db:migrate not working

I am getting this error when running heroku rake db:migrate: Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.) I looked online and found to add the 'pg' gem. I…
user972276
  • 2,973
  • 9
  • 33
  • 46
1
vote
2 answers

Ruby on Rails 3 Tutorial: Chapter 2 Section 2.2.1 A User Tour

I am new to Ruby on Rails and am working through this tutorial book. I am on Windows Vista and using Cygwin. Here are the versions of the software that I am running: Ruby version 1.9.2 (i386-cygwin) RubyGems version 1.8.10 Rack version …
nbkincaid
  • 107
  • 1
  • 1
  • 9
1
vote
1 answer

Flyway - why all my schemas were deleted and how can i revert it

I was running a db repair command on my db, and surpassingly found out later that for each old migration version a new DELETE migration was created. It was only effecting the flyway_schema_history table, the rest of the tables stayed the same, and…
Tom Carmi
  • 385
  • 1
  • 5
  • 18
1
vote
1 answer

How to make bit column like in SQL Server using Laravel Database Migration

So I'm creating a new table, replicating an existing table, and one of them has a column of type bit, like this: I already understand the concept of migration and have made it often, but to create this column of bit type via migration, what type of…
1
vote
1 answer

What do the various columns in schema_version_history table of flyway represent?

I'm new to flyway & have been going through the documentation of flyway but couldn't find a doc which describes what each column in schema_version_history (or whatever you would have configured to name the flyway table) means. I'm specifically…
SRB
  • 1,031
  • 10
  • 16
1
vote
2 answers

InvalidTextRepresentation: Invalid input syntax for type bigint:"All Forms"

I had a field in my model with book_classes = (("","Select Form"),("1",'F1'),("2",'F2'),("3",'F3'),("4",'F4'),("All Forms","All Forms")) b_classes = models.CharField('Form',max_length=9,choices=book_classes,default="n/a") And then changed it…
fakeMake
  • 738
  • 8
  • 18