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

How to migrate data from react native asyncstorage to flutter?

I'm looking to migrate a react native app to flutter, so far everything is good. But I have to migrate user data stored in react native asyncstorage and I don't even know where to start. Does anyone can guide me in the right direction?
2
votes
2 answers

Cheaper alternative for RedGate ReadyRoll

RedGate ReadyRoll is wonderful DB versioning tool which works like a charm. But the only one drawback - price. I've researched what to use and found DBUp, Envolve... These tools are good but: Doesn't have ability to define Up and Down scripts to be…
Nikolay
  • 155
  • 2
  • 10
2
votes
0 answers

How to recreate database with doctrine migration?

I would like to use database migration tool in my current project. It's a php-project in zf3, therefore i decided for doctrine migrations. Here is pretty good example, how to use this tool. The issue is, im adding tables from my code, which then are…
tookie009
  • 186
  • 1
  • 14
2
votes
3 answers

SQL Server: pushing development to production?

I'm currently using SQL Server Management Studio. I have a development database, and access to a live database. I just want to able to migrate my development tables to the live server. I'm consulting stack flow first, since I don't want to blow…
Nick
  • 41
  • 1
  • 4
2
votes
1 answer

"heroku run rake db:migrate" command returns ETIMEDOUT error message

Any ideas why I might be getting the below error message? $ git push heroku master Everything up-to-date …
M3RS
  • 6,720
  • 6
  • 37
  • 47
2
votes
2 answers

What to do with triggers on SQL Server database during migration to Azure DB?

I have a SQL Server database to be migrated to Azure. Can I replace triggers with something else on Azure? Service? Or is the only option to remove the triggers and redesign their logic? Thanks.
2
votes
0 answers

Django: How to migrate primary key to BigIntegerField of class that inherits from AbstractUser

I have a Django project that has numerous applications. Each application has a models.py file. I'm using this strategy to modify all the models in my project such that their primary keys are explicitly defined as id =…
Saqib Ali
  • 11,931
  • 41
  • 133
  • 272
2
votes
2 answers

Heroku doesn't see gem 'pg'

Need help. When I try to make user@X220:~/rails_projects/sample_app$ heroku run rake db:migrate There is a mistake: Running rake db:migrate on limitless-fjord-69900.... up, run.2816 rake aborted! Gem::LoadError: Specified 'postgresql' for…
avzah
  • 23
  • 4
2
votes
3 answers

Rails : Why shouldn't I directly make changes directly in schema than do migrate

I am using ruby on rails for an application. I am developing it on my local server as of now. Everytime I need to make a change to the database, I need to create a migration. Why can't I directly make changes in schema.rb itself? I am allowed to…
Abhinav
  • 722
  • 2
  • 11
  • 27
2
votes
0 answers

rake db:migrate fail ~> PG::ConnectionBad: could not connect to server: Connection refused

Hi can someone help me with the error i a getting when i try to do the rake db:migrate using ubuntu 14 this is the error that follows rake aborted! PG::ConnectionBad: could not connect to server: Connection refused Is the server running on host…
user1868185
  • 899
  • 3
  • 9
  • 24
2
votes
1 answer

Undefined Method "each_pair" Error when running DB Migrate

here is the error: Migration Code: class Test < ActiveRecord::Migration def change create_table :test do |t| end end end As a side note, it does not fail if i remove the "Create_table" call. Upon running rake db:migrate, I get this…
meow
  • 27,476
  • 33
  • 116
  • 177
2
votes
0 answers

NameError: undefined local variable or method `demo_app' for main:Object

I am very new to learning rails and trying to get past this error as I work through the Hartl tutorial. I ran scaffolding and then rake db:migrate and cant get past the below: rake db:migrate rake aborted! NameError: undefined local variable or…
2
votes
1 answer

MySQL error for default value of decimal during Rails migrate

I'm setting up my production database in Rails. The development uses SQlite and production is in MySQL. During the migration I am getting an Invalid default value error for all decimal columns that have a default value. Here is an…
hey-ashy
  • 23
  • 7
2
votes
1 answer

rake db:migrate does nothing in Rails 4.1 app and exits without errors

I'm setting up a brand-new Rails 4.1 app and using 64-bit PostgreSQL 9.3.4 as my development server. Everything goes smoothly until I run rake db:migrate. Nothing happens. I ran the command again with the --trace flag, and it looks like the app is…
konung
  • 6,908
  • 6
  • 54
  • 79
2
votes
1 answer

rake db:migrate does not change table

I have a db with columns (name, path). Now I have a migration file that changes the columns to be (name, pathorig, pathjson, scramble). Doing rake db:reset and rake db:migrate doesn't update the table. Why can this happen? my migration file: class…
Don P
  • 60,113
  • 114
  • 300
  • 432