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

Rake db:migrate is not working even not giving error

I have rail's project and it was working perfectly fine but, at some point I have done something that I haven't remember and rake db:migrate stopped working. I have tried this answer but didn't work. The response for rake db:migrate is…
Mayur Patel
  • 759
  • 7
  • 16
0
votes
1 answer

Will I make many or just one migration for a model?

Are migrations instructions that change a model? Will I make several migrations, or will there be one migration per table? For instance, let's say if I want to change "username" to "admin_username". Does this call for a migration? Then, let's say I…
PudparK
  • 111
  • 2
  • 13
0
votes
2 answers

IntelliJ Idea/Rubymine push to Heroku running db:migrate

I'm using IntelliJ Idea with the Rubymine plugin, and Heroku plugin, and I'm a bit stumped when it comes to pushing an app to Heroku. I can set it up and actually push the app: off it goes, and launches successfully. But even before I did that I…
ad-johnson
  • 555
  • 3
  • 17
0
votes
1 answer

Argument Error in migration in Rails project

I had use sqlite as database for my rails app, then I changed it with Postgresql and after that I started to get an error when I tried to add new migrations. Error $ rake db:migrate --trace ** Invoke db:migrate (first_time) ** Invoke environment…
Takor
  • 277
  • 2
  • 12
0
votes
0 answers

Migrate Sybase Date to Oracle Date

I am migrating my database from Sybase to oracle. I have generated insert statement from Sybase and trying to insert in Oracle database. I am getting error for date time. In insert statement sybase date is in format "08/20/2007 09:41:00.000 AM" And…
Rahul
  • 11
  • 2
0
votes
1 answer

rake db:migrate is not working and giving an error in terminal

So im trying to run rake db:migrate and i get this error in the terminal? rake aborted! LoadError: cannot load such file -- bcrypt_ext C:/Users/Josh/loveapp/app/models/user.rb:4:in `' C:/Users/Josh/loveapp/app/models/user.rb:1:in `
0
votes
1 answer

Cannot run a migration update in Ruby

Im using ruby and I go to do a rake db:migrate which I get the follow error: LoadError: cannot load such file -- bundler/setup C:/Sites/raddit/config/boot.rb:4:in
0
votes
1 answer

Rails Model / Migrate Issue

I am reading this book "RailSpace" and am trying to learn rails. However I have been stuck for 2 days on this particular issue. I've made a user model but when I go to migrate it I keep getting errors. Here's the code I have. class CreateUsers <…
Corey Holmes
  • 368
  • 3
  • 13
0
votes
1 answer

Migration - Did I just lose all of my data?

Being newer to Ruby on Rails and while I have a fair understanding of certain areas, I am still learning. The one area I have difficulty is migrations/databases and I fear I may have had a terrible mistake. I am currently working on building a blog…
Joe Dayvie
  • 304
  • 3
  • 14
0
votes
2 answers

Rake Migrate error "wrong number of arguments"

I am trying to add columns to a model that I have(clue).I have read online that this has something to do with my migrate file. Here is my migrate file: class Addboolstoclue < ActiveRecord::Migration def self.up add_column :clue do |t| …
wellcole
  • 21
  • 1
  • 7
0
votes
0 answers

DigitalOcean Rake db:seed command not found

I am trying to update my database, which is stored at a DigitalOcean-server. The seeds.rb-file is on the server atm, but I don't know what to type in the console window. When I type "rake db:seed", I get "Command not found". I would have been very…
svakers
  • 11
  • 1
0
votes
1 answer

MySQL & Rails 4 - bundle exec rake db:migrate - Unsupported database for migration to UTF-8

I have a Ruby on Rails 4 app that I have cloned from Github and am trying to get up and running on my MacBook in a dev environment. Initially the app complained about not finding MySQL, so I did brew install mysql. I now have mysqld running with…
tadasajon
  • 14,276
  • 29
  • 92
  • 144
0
votes
3 answers

Ruby-on-Rails Tutorial Trouble

I am new to both Ruby and Rails. So this may be an easy fix. I'm sorry if it is. I recently installed Ruby-on-Rails and started following the tutorial on rubyonrails.org which shows how to make a simple blog. Everything was running fine until I got…
hmmm
  • 13
  • 5
0
votes
1 answer

Take a backup of rake db migration. and command denied for rake db:migrate rake aborted

I have db version 11. I want to move back to version 10 and add another version. But before that I want to take backup of version 11. How can I do that? I am using ruby 1.8.7 and rails 1.2.6. rake db:migrate version=10 output: rake…
mrk m
  • 125
  • 1
  • 3
  • 15
0
votes
1 answer

Update the database with new values after a migration

I have a table in my database called sessions with two columns (start_time and end_time) in it and I already have lots of data in my table. I then generated a migration: $ rails g migration AddDurationToSessions duration:integer My model…
Fei
  • 1,187
  • 1
  • 16
  • 35