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

Convert MySQL database to SQLite

I have a MySQL database with some data and i want convert it to SQLite, please advise me any good tools(Windows) for it. I've tried SQLite Data Wizard, but it can't find already installed MySQL ODBC driver.
whizzzkey
  • 926
  • 3
  • 21
  • 52
0
votes
1 answer

Cannot seem to use development database

I updated my database.yml file to look like so: test: adapter: postgresql encoding: unicode database: startpoint_test hostname: localhost pool: 5 username: postgres password: password development: adapter: postgresql encoding:…
Adam
  • 609
  • 2
  • 8
  • 15
0
votes
1 answer

rails 3 migration error in change_column type

I am trying to change a column type and getting error. My model is Conf, and column name is xml. I want to change it from :file to :binary. xml at first created as text, then I've changed it to file with a similar migration file very much like this…
kalahari
  • 895
  • 5
  • 15
  • 34
0
votes
2 answers

Rails app, installing Devise, rake db:migrate error

Trying to re-install Devise. Rails 4 on Postgresql I've followed the instructions from Devise (like adding devise gem/bundle install) and made the changes to my environments/application.rb/added my flash messages Then ran rails generate devise…
Christian Flores
  • 207
  • 1
  • 4
  • 12
0
votes
2 answers

ruby on rails - git repository, database handling

I am currently using Bitbucket and am handling a Ruby on Rails repository across users. By default, when one user pushes the repository(default command - git push origin master -entire rails folder), I assume that the db also gets pushed to bit…
Venomoustoad
  • 1,203
  • 1
  • 14
  • 38
0
votes
2 answers

Rake aborted: "ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (available in RDoc 2.4.2+) instead."

When trying to execute: rake db:migrate The terminal answers: rake aborted! ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (available in RDoc 2.4.2+)…
0
votes
3 answers

Rails db:migrate cannot mass assign protected attributes

I am learning Rails with the book Agile Web Development with Rails 4th edition. Given the code for the migration below: class CombineItemsInCart < ActiveRecord::Migration def up Cart.all.each do |cart| sums =…
Senjai
  • 1,811
  • 3
  • 20
  • 40
0
votes
3 answers

Rake db:migrate error Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter`

Briefing: I've been attempting to deploy my blog to heroku for the last week with no luck. I've contacted Heroku support and they've pretty much told me to post the log on stackoverflow. So here I am. I'm pretty sure it has something to do with…
user2109855
0
votes
1 answer

Rails: db:migrate wont make changes to database table (tinytds)

I'm using tinytds to connect to a ms-sqlserver database. I've noticed that db:migrate will work as long as there isn't a table already in my database. Once I try to make changes to an object and replicate to the database using db:migrate I get the…
daveomcd
  • 6,367
  • 14
  • 83
  • 137
0
votes
5 answers

Please install mysql2 adapter

I'm new of rails, and i have this big problem. I'm running rails 3.2.9 and Ruby 1.9.3, I did a porting of a rails app from linux to windows, but in windows i'm having a lot of problems with mysql2 gem. I installed mysql2 gem yesterday and than i…
0
votes
1 answer

Installing phpmyadmin to be able to manage the mysql database the admin created for me

I dont have access to cPanel. I only can access the root of the site I am working on using FTP, with the domain name, user and password. I want to install phpmyadmin on the root so that I can manage the mysql database the admin created for me. I…
0
votes
0 answers

rake db:migrate not picking up all the fields in my migration file

I will be the first to admit that I am probably doing this wrong or have a poor workflow but I am trying to build my first rails app. It works different in 3 than I recall in rails 1 (last time i putzed around with this). I remember defining my…
Codejoy
  • 3,722
  • 13
  • 59
  • 99
0
votes
2 answers

rake db:migrate gets error

I have just recently cloned a sample rails application I am working on onto my macbook and I am trying to run rake db:migrate but I get the following error rake…
Cool Guy Yo
  • 5,910
  • 14
  • 59
  • 89
0
votes
1 answer

Rails: rake db:migrate suddenly starts at version 0 again, should start at version 16

today I just ran rake db:migrate... well, two things happened, first it reversed from version 2 to 0, so it smashed my user db (very very annoying) and now it wants to migrate vom version 1. But it should start at version 16. Any Ideas? Shema.rb is…
Joern Akkermann
  • 3,542
  • 8
  • 33
  • 41
0
votes
1 answer

how does "bundle exec rake db:migrate" work if i have multiple databases?

I am a newbie to rails/ruby. i have two databases, sqlite for development/testing and postgres for production/deployment. when i run "bundle exec rake db:migrate", which database is updated with my current data model, the sqlite or the postgres? …
user1985281