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

Rails db:migrate aborted with "undefined local variable or method `limit'" why?

Sorry for my English. I searched the site, but I could not find a solution. When I try to make rails db: migrate gives me this error: C:\PW\Sites\grota>rails db:migrate == 20170209014957 CreateWholesalers: migrating …
0
votes
0 answers

Ruby On Rails: Heroku run rake db:migrate failed

Whenever i try to run heroku run rake db:migrate or want to bundle install i get the following error message: PG:DuplicateObject: ERROR: constraint "fk_rails_d0c2931" for relation "subscription" already exist : ALTER TABLE…
Prometheus
  • 799
  • 8
  • 28
0
votes
3 answers

Heroku Rails db migration file order and relationships

I have a User model and a Role model. When I started building the app, I start by creating the User model and the migration file that was generated contain a reference to Roles: class CreateUsers < ActiveRecord::Migration[5.0] def change …
Zhang
  • 11,549
  • 7
  • 57
  • 87
0
votes
1 answer

Rails 5 adding admin flag to users but deleted migration and

I made a mistake in my migration file and I deleted and then tried running the migration again and now I'm getting an activerecord::pendingmigrationerror when I load localhost:3000 but when I try to run rails:db migrate again its keeps canceling…
Jerry Hoglen
  • 111
  • 1
  • 10
0
votes
0 answers

MSSQL to MYSQL migration (check constraints into triggers)

I am trying to figure out how to properly migrate a sql server database into a mysql database. Everything went OK beside the check constraints (and on update cascade). Is there any way or tool to automatic transform CHECK constraint into…
Wim
  • 11
  • 1
  • 4
0
votes
1 answer

Can't migrate psql database after scaffold - Cloud9

I am getting an "wrong number of arguments (given 1, expected 0)" error when trying to run rake db:migrate on my psql database. This asker had the same trouble, but locking my Gemfile "to gem 'arel', '6.0.0.beta2'" and using rails version…
0
votes
1 answer

module export usage error in node

I'm having db.js file which consist of var mysql = require('mysql2'); var mysqlModel = require('mysql-model'); var appModel = mysqlModel.createConnection({ host : 'localhost', user : 'root', password : 'root', …
m2j
  • 1,152
  • 5
  • 18
  • 43
0
votes
0 answers

Import mysql database/dump into laravel 5.2 migration

I have a complete mysql database that I need to shift to laravel's database. How can I do that ? I have so far created a migration for the database - Into this db I want to put data, which is huge. I'm not using homestead env. I'm using artisan…
s_user
  • 586
  • 2
  • 8
  • 19
0
votes
2 answers

how to drop and re-run migrations with db-migrate

I am trying to seed the db before I run all my tests. So I have created a new file bootstrapTest.js and included it in my test source file like this gulp.src(['test/bootstrapTest.js', 'test/**/*.js'] bootstrapTest.js now needs to reset the database…
AbhinavD
  • 6,892
  • 5
  • 30
  • 40
0
votes
3 answers

Convertion from Sql server 2005 to Oracle 9i

I have devloped website using ASP and Sql Server 2005. I have not used any Stored Procedure and Views [All the queries are passed from the asp page]. Now i need to convert the database from SQL Server 2005 to Oracle 9i. Will it takes huge changes…
0
votes
1 answer

DbMigration.SqlFile generate SqlException (0x80131904): Transaction context in use by another session

I have created database migration and in Up method I want to execute sql files with SqlFile method. Each of files contains 2 statements: first drop procedure if exists and second one is create procedure. Both statements finishes with GO. Here is…
Mardok
  • 624
  • 8
  • 18
0
votes
1 answer

Rails Rake db:migrate aborting (sqlite3)

Similar questions have been asked but none of the recommendations have worked for me. I'm trying to migrate a db in rails development on my computer and I keep getting this error message: rake aborted! StandardError: An error has occurred, this…
tfantina
  • 788
  • 11
  • 37
0
votes
1 answer

Serial Output for migration when deploying with Capistrano 3

When I used custom db:migrate task from capistrano/rails information about migrate processing isn't shown. To change that I customized db:migrate task and change log_level to :debug. info '[deploy:migrate] Run `rake db:migrate`' within…
0
votes
3 answers

Rails user authentication: can you hardcode a user?

I have a working rails application with user authentication. I want to automatically have my account coded because I will have the admin role and no one else will. Is there a way to do this? By the way, my db/migrate table looks like this: class…
salipshitz
  • 67
  • 13
0
votes
2 answers

REDMINE - Migrate MySQL from 1.x to 3.x

We shall change an old server on which Redmine 1.x is installed, it's our actual production server. We plan to migrate to a fresh new server and get the opportunity to migrate redmine version from 1.x to 3.x For now, I backuped my 1.x MySQL database…
Patrick Ferreira
  • 1,983
  • 1
  • 15
  • 31