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

rake db:migrate problems with using paperclip

I installed paperclip 2.7 using gem install. I did rails generate paperclip user photo. and then tried migrate the db. But it gave me an error. SQLite3::SQLException: duplicate column name: photo_file_name: ALTER TABLE "users" ADD "photo_file_name"…
0
votes
2 answers

heroku run rake db:migrate works correctly when typed into console, but not when run via a rake task

I have the following task: task :migrate_test => :environment do puts 'Running database migrations ...' puts `heroku run rake db:migrate --app my-app` end When I run heroku run rake db:migrate --app my-app in the console, the migration…
Will Nathan
  • 625
  • 7
  • 13
0
votes
1 answer

rails db:migrate fails '[MODEL].users' doesn't exist: SHOW FULL FIELDS FROM `users`

I done lot of googling and read lot of stack overflow pages , but can't fix this issues. If any one can help with this , it will be helpful. My app works fine still yesterday , now suddenly it starts to give error on "rake db:migrate" I check my…
Senthil
  • 946
  • 1
  • 14
  • 34
0
votes
2 answers

Rails rake db:migrate of a recently created database

I have just created a database. I am trying to migrate but I am receiving a table not found error. rake db:migrate /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.1.5/lib/bundler/runtime.rb:211: warning: Insecure world writable dir…
Tony
  • 10,088
  • 20
  • 85
  • 139
0
votes
2 answers

Why doesn't rake db:migrate report version number?

rake 0.8.7, rails/activerecord 2.3.3 Output from rake db:migrate: == CreateProducts: migrating ================================================= -- create_table(:products) -> 0.0017s == CreateProducts: migrated (0.0019s)…
Bruce Hobbs
  • 116
  • 5
0
votes
1 answer

Does the latest version of Rails require my db migration files to have "down" (undo) commands for the db?

Because it sure doesn't seem like it. When I generate a model and check out it's db migration file (I'm a bit of noob so forgive me for any ignorance), there is no "down" code which has been automatically generated. Is this because the newest rails…
boulder_ruby
  • 38,457
  • 9
  • 79
  • 100
0
votes
1 answer

Heroku deprecation warnings when trying to migrate the database

I have a Rails 3.2 app that I've created and want to deploy it on Heroku. I created a new session on the cedar stack and pushed up my app to it. However, when I try to migrate the DB I get deprecation warnings. I ran the migrate commend with the…
Keva161
  • 2,623
  • 9
  • 44
  • 68
0
votes
1 answer

Redis data sync for Heroku

Is there a way I can sync my local redis store to the remote store in Heroku? What is possible is a migrating the local data to the heroku server and running the 'SET' command yourself via the heroku console. Is there a smarter way, like…
cggaurav
  • 565
  • 5
  • 20
0
votes
1 answer

Why do I keep getting this error when I try and run rake db:migrate?

== AddAncestryToMessages: migrating ========================================== -- add_column(:messages, :ancestry, :string) rake aborted! An error has occurred, this and all later migrations canceled: SQLite3::SQLException: no such table:…
BigBoy1337
  • 4,735
  • 16
  • 70
  • 138
0
votes
1 answer

rake db:migrate is not working - continuously pending

>C:\rails_projects\sample_app>rake db:migrate >-- create_table("users", {:force=>true}) > -> 0.5100s >-- add_index("users", ["email"], {:name=>"index_users_on_email", :unique=>true}) > -> 0.0170s >-- initialize_schema_migrations_table() > ->…
Steve Q
  • 395
  • 5
  • 28
0
votes
1 answer

Problems running rake db:migrate in a Ruby on Rails app

I am trying to run rake db:migrate in my Ruby on Rails application. However, it is giving me a "uninitialized constant" exception. From Googling this, it looks like the solution is to update the rake version. So I changed my gemfile and ran bundle…
Marvin K
  • 437
  • 1
  • 5
  • 11
-1
votes
2 answers

Liquibase did not execute changelog file by dependency order

Our project have multiple modules. We created databasechangelog file for each module. Liquibase was execute these files by alphabetical order not module dependency order. For example Project | Module1 | | - domain | | - foo1 | | -…
Madasamy
  • 29
  • 2
  • 7
-1
votes
1 answer

Flyway doesn't mark statement in schema_version as fail in DB2

If some script fails during migration , flyway won't add record to schema_version in DB2 db for failed statement. Do you have any idea how to avoid this situation? I did a migration, 4th script failed, i expect this script will have status…
-1
votes
1 answer

rake db:migrate StandardError macOS

I'm getting a so called 'StandardError' when I run rake db:migrate. I ran this command: rake db:migrate And got this 'StandardError' in a Mac Terminal
-1
votes
1 answer

Db:migrate produces no error and does not create table in database (MYSQL)

I'have created model using rails generate model users.i have created new data base readit_development and granted all privileges on this database to user readitadmin. In my database.yml file i have given user name as readitadmin and password as…
Manish Sakariya
  • 482
  • 3
  • 10
1 2 3
19
20