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

Rake db:migrate error, table already exists

I accidentally create a migration which I did not need so I delete the file, and created a new migration now when I try to run rake db:migrate I keep getting this error. I am the using SQlite3 gem, and Ruby on Rails 4 StandardError: An error has…
user3914956
  • 83
  • 2
  • 6
4
votes
1 answer

Rake db:migrate on aws elastic beanstalk

I'm trying to do rake db:migrate on aws, but can't figure out how Here is my .ebextensions/.config file, but it doesn't work packages: yum: postgresql-devel: [] # Run rake tasks before an application deployment container_commands: …
4
votes
6 answers

Rails migrate with different databases

I need use Devise with a existing user table in another database, so I config my database.yml: development: adapter: postgresql encoding: unicode database: almoxarifado pool: 5 timeout: 5000 username: user password: pass host:…
giordanofalves
  • 173
  • 2
  • 8
4
votes
1 answer

How to tell if rake db:migrate and rake db:seed were successful

Ruby rake db:seed aborting due to ** Execute db:abort_if_pending_migrations, but I think all the migrations were successful. Here's the last portion of the output when I run rake db:migrate --trace ** Invoke db:load_config (first_time) **…
rsmets
  • 789
  • 1
  • 13
  • 23
4
votes
1 answer

Segmentation fault ruby 1.8.7 on db migrate in rails

On this command RAILS_ENV=production bundle exec rake db:migrate I'm getting this error : [BUG] Segmentation fault ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux] I thought of trying this but the command won't execute as it doesn't know what…
Sachin Prasad
  • 5,365
  • 12
  • 54
  • 101
4
votes
1 answer

Grails - DB migration for Quartz plug-in persistence

We would like to use the Quartz plug-in persistent mode for working in a cluster. Our DB schema is maintained using the DB-migration plug-in, and therefore we can not use the provided SQL script for updating the DB. Is there a db-migration script…
user964797
  • 231
  • 3
  • 6
4
votes
3 answers

migrate database schema on update of Java EE application

I have a Java EE application which use SQL Server Express as backend database. When we deploy new version sometime we need to change the database: add tables, add columns, remove columns, merge tables, merge column, etc. Until today we use offline…
Ido Ran
  • 10,584
  • 17
  • 80
  • 143
3
votes
1 answer

MissingDriverError while using postgres

Errors Error during migration generation: MissingDriverError: Wrong driver: "undefined" given. Supported drivers are: "aurora-data-api", "aurora-data-api-pg", "better-sqlite3", "capacitor", "cockroachdb", "cordova", "expo", "mariadb", "mongodb",…
Saad Bin Zia
  • 133
  • 1
  • 2
  • 6
3
votes
1 answer

Rails aborted migrate command

In trying to do the command $rails db:migrate, I receive the following error: $ rails db:migrate RAILS_ENV=test rails aborted! StandardError: An error has occurred, this and all later migrations canceled: Directly inheriting from…
NR 15
  • 77
  • 1
  • 11
3
votes
2 answers

Undefined method 'task' using rake 0.9.0 AND 0.8.3

while attempting to run rake, I run into the following error: heroku rake db:migrate rake aborted! ...and the trace: > undefined method `task' for # > /app/.bundle/gems/ruby/1.8/gems/railties-3.0.7/lib/rails/application.rb:215:in…
jfigaro
  • 33
  • 2
3
votes
2 answers

Disable wrapping migration in a transaction with Node db-migrate

I need to use db-migrate to add an index to a Postgres database with CREATE INDEX CONCURRENTLY. However, db-migrate wraps all migrations in a transaction by default, and trying to create a concurrent index inside a transaction results in this error…
JSBձոգչ
  • 40,684
  • 18
  • 101
  • 169
3
votes
1 answer

Migrate SQLite3 database to MySQL in Django

I am developing a website using Django 1.11 and Django-CMS with python3. Initially I used the default database sqlite3, however, now I want it to migrate to mysql. I have found several solutions online like Solution 1 Solution 2 However, both did…
Dr3w Br1ck13
  • 187
  • 1
  • 5
  • 14
3
votes
3 answers

Export oracle database to another server

How can i migrate oracle database from one server to another along with data? Database is on Window server and i need to copy it to another window server. Nothing complex :)
Ankit
  • 6,388
  • 8
  • 54
  • 79
3
votes
1 answer

Unable to connect to database: SequelizeConnectionRefusedError: connect ECONNREFUSED

Whenever i launch my app, part of my task is to first run a migration. however, I get the below error 95% of the time. Command failed: /bin/sh -c node_modules/.bin/sequelize db:migrate Unable to connect to database: SequelizeConnectionRefusedError:…
3
votes
7 answers

DB2 add auto increment column to an existing table

I have a table with following schema in my DB2 database. CREATE TABLE IDN_OAUTH_CONSUMER_APPS ( CONSUMER_KEY VARCHAR (255) NOT NULL, CONSUMER_SECRET VARCHAR (512), USERNAME VARCHAR (255), TENANT_ID INTEGER DEFAULT 0, …
Chamila Wijayarathna
  • 1,815
  • 5
  • 30
  • 54
1 2
3
19 20