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
3
votes
2 answers

is it possible to undo rake db rollback?

I accidentally ran rake db:migrate, and then ran rake db:rollback. Now the database table I had created before is completely gone. Is there any way to undo a rollback, or should I just revert to the most recent branch?
calyxofheld
  • 1,538
  • 3
  • 24
  • 62
3
votes
1 answer

rake db:migrate issue postgresql

I'm complete noob at PostgreSQL, Ruby on Rails.. I'm trying to follow this tutorial (WITHOUT rubymine) http://www.codeproject.com/Articles/575551/User-Authentication-in-Ruby-on-Rails#InstallingRubyMine4 I have as such this to migrate…
Ahmad Bilal
  • 380
  • 1
  • 2
  • 15
3
votes
1 answer

sqlite database not migrated to postgresql when pushed to heroku server (django)

I pushed my app to heroku, but it seems that the database did not migrate (the database has 0 tables and 0 entries). How can I migrate it correctly?
babbaggeii
  • 7,577
  • 20
  • 64
  • 118
2
votes
0 answers

db-migrate and db-migrate-pg How to control order of migrations?

Is there a way to run only specific migration file using db-migrate, or to at least execute migrations in a specific order? Some workarounds would be to change the dates in migration file name, or to put all operations into one file, but I'm trying…
Marijana
  • 102
  • 10
2
votes
2 answers

Unable to run rake db:migrate

I new to rails, i've done all steps from this tutorial http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby-mac on my ubuntu 11.04 but i'm unable to run rake db:migrate. It gives to this…
user253202
2
votes
1 answer

How to define "INT GENERATED ALWAYS AS IDENTITY" column with node-pg-migrate?

How do I define a migration file using node-pg-migrate for the below table CREATE TABLE color ( color_id INT GENERATED ALWAYS AS IDENTITY, color_name VARCHAR NOT NULL ); There seems to be no documentation on how to do INT GENERATED ALWAYS…
PirateApp
  • 5,433
  • 4
  • 57
  • 90
2
votes
4 answers

How do you rake a Heroku database?

I have an application on Heroku. However, whenever I change my database locally and then push the changes to the application, the database doesn't not change. I realized that I need to run a rake on the Heroku database. However when I try heroku…
Vasseurth
  • 6,354
  • 12
  • 53
  • 81
2
votes
2 answers

Heroku rake error

When I run rake db:migrate on Heroku, I get an error. I have no problems running it locally. This works fine: C:\unaton>rake db:migrate But when I use C:\unaton>heroku rake db:migrate then I get the following error. (in /app) rake…
Deepak
  • 21
  • 4
2
votes
1 answer

Migrate returns (in /app)

I've push my app to Heroku however my database(Sqlite3) fails to migrate. I understand that heroku will automatically migrate as a PG. [ I don't have PG install]. I figured if something was wrong, I would of received an error prompt. This is my…
RedRory
  • 632
  • 1
  • 6
  • 18
2
votes
0 answers

Error after Altering (Dropping columns and Change many-to-many membership) the SQLite in FLASK migrate

I had a User and channel class in my model.py. They had many-to-many relationships. I decided to remove the many-to-many relationships between User and channel and add the many-to-many relationship between Usertemp class and channel class. After…
math
  • 341
  • 4
  • 14
2
votes
1 answer

How to migrate Realm DataBase to shared(AppGroup) in Swift?

So I have one iOS app that uses Realm database and I've been implementing new stuff with SiriKit so now I am using App Groups that are working well for NSUserDefault. But now how can I migrate the Realm database which is the default location to a…
Tiago Mendes
  • 4,572
  • 1
  • 29
  • 35
2
votes
4 answers

Error running a Ruby on Rails database migration

I am installing the devise gem for authentication in a Ruby on Rails application and I ran the database migration like this: rake db:migrate and got this error: undefined method `reference' for…
GeekedOut
  • 16,905
  • 37
  • 107
  • 185
2
votes
1 answer

"flyway.locations:" if sql files are in S3 bucket

I am asked to perform DB migration. My script files are in S3 bucket. I am migrating using flyway. How can i mention flyway.locations: for this scenario?
AkshayBadri
  • 504
  • 1
  • 10
  • 18
2
votes
0 answers

ERROR: Dialect needs to be explicitly supplied as of v4.0.0

I am constantly running into errors where it is yelling at me to mention dialect explicitely. I am trying to talk to 2 databases and am using sequelize to perform migrations. I am using msSQL and mySQL. Looking at other suggestions and blogs : I…
anzie001
  • 231
  • 3
  • 12
2
votes
2 answers

Ruby nubie on OSX - can't get beyond rake db:migrate - get [BUG] Bus Error

Original problem: I'm (a newbie to ruby) using RVM to manage my ruby on Mac OSX 10.6 Here's my mac OX info: $ rvm info ruby-1.9.2-head@1.9.2-head-gemset: system: uname: "Darwin fillibuster-2.local 10.6.0 Darwin Kernel Version 10.6.0:…
Mac Duck
  • 96
  • 1
  • 7