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
1
vote
1 answer

How does rake db:migrate VERSION=0 work?

I'm new to ruby. I got this error bundle exec rake db:migrate == 20150423205259 AddActivationToUsers: migrating ============================= -- add_column(:users, :activation_digest, :string) rake aborted! StandardError: An error has occurred,…
Hanna
  • 539
  • 2
  • 9
  • 24
1
vote
3 answers

rake aborted database will not migrate

I created models, views, and controllers for 'startups' each individually (without scaffolding). I have a file db>migrate>'201..._create_startups.rb' with the code below: class CreateStartups < ActiveRecord::Migration def change create_table…
Kevin Mirc
  • 11
  • 1
  • 3
1
vote
1 answer

Grails migration issues. DBM-UPDATE include not recursing, fails silently

This is part of an ongoing project... splitting out domain objects so they can be consumed by multiple applications. The database migration files for the domain objects live with the plugin... but we want the apps to be able to reference them…
Tuishimi
  • 171
  • 8
1
vote
2 answers

How can I add new attributes into my migrate?

I currently have the migrate thing like: class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| t.string :name t.string :email t.string :encrypted_password t.string :salt t.timestamps …
zzx
  • 179
  • 2
  • 12
1
vote
1 answer

Stop entity framework from creating computed column in db migration

Thanks in advance, I have been using code first with EF-DB migration in my project. The challenge I am having is now I want to add a property in my Class which should only be long to the class and not Create a database table-column. I have tried…
Sanj
  • 3,770
  • 6
  • 26
  • 31
1
vote
1 answer

Can't run a db migration on rails

I have had ongoing trouble migrating a database in rails via rake db:migrate. My migration currently looks like this: class CreateArticles < ActiveRecord::Migration def change create_table :articles do |t| t.string :title t.text…
Terryfrancis
  • 135
  • 1
  • 12
1
vote
2 answers

Ruby on Rails n00b. rake db:migrate fail

new to ROR. i'm taking one month rails and : i cannot get past f'n $ rake db:migrate!!!! I'm getting this message now gregs-MacBook-Air:trydah gregfrontiero $ rake db:migrate == 20140606025644 AddDeviseToUsers: migrating…
1
vote
0 answers

Rails migration does not find schema_migrations table if not in main database

I am working with a multi-schema MySQL database. Unfortunately, the main schema (specified in database attribute in database.yml) is NOT the database we can store the schema_migrations table in. All schemas are on the same server so accessing…
DSadaka
  • 76
  • 6
1
vote
3 answers

rake db:migrate not doing anything

I'm following the onemonthrails tutorial, and I'm in the "New User Signup and Signin" lesson. I followed all the steps correctly, but I'm running into an error : "ActiveRecord::StatementInvalid in Devise::RegistrationsController#new Could not find…
1
vote
3 answers

Configuring and running Ruby-On-Rails migrations

I'm (completely) new to ROR and have got an application to maintain and upgrade. I've the source code and am trying to build database using db:migrate rake command. I've started using Aptana Studio for the development. When I run dg:migrate I get…
TheVillageIdiot
  • 40,053
  • 20
  • 133
  • 188
1
vote
3 answers

rake db migrate aborted: duplicate column name (HELP!)

I had already ran "$rails generate paperclip pin image" but decided to reinstall it to attempt to resolve "Could Not Run The Identify Command. Please Install ImageMagick." error while uploading image. Thus went to terminal and ran "$ rails generate…
Steven L
  • 131
  • 1
  • 3
  • 10
1
vote
1 answer

flyway migration step multiple times

I have a very complicated migration to perform. It can not be done with SQL, I've got to use Java. And I have treat each row individually, bulky update is not possible. To make things more complicated: one of my customers has several billions of…
Christian
  • 11
  • 2
1
vote
4 answers

Error to Migrate DB Rails

Im trying to use this migration but i keep getting the error, like these This is my Migration file class CreateEmployees < ActiveRecord::Migration def self.up create_table :employees do |t| t.string :name t.date :hiredate …
Ytipsh
  • 37
  • 2
  • 10
1
vote
2 answers

What does Heroku run rake Don't know how to build task 'default' mean?

When I went to heroku run rake Rake was aborted and the next line said, Don't know how to build task 'default' Ran heroku run rake --trace and got Running `rake --trace` attached to terminal... up, run.3479 DEPRECATION WARNING: You have Rails…
Patrick
  • 2,176
  • 3
  • 18
  • 21
1
vote
1 answer

migrate data from mysql5.1 to mysql5.6

i want to migrate data from mysql5.1 to mysql5.6. i installed mysql5.6 successfully but i have data of older version is more than 50 GB. i want to just copy and paste in newer version. i did it but some table does not accessible. i guess it is…
niket patel
  • 93
  • 1
  • 9