Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Aug 19 08:42
    RenWenshan commented #468
  • Aug 18 18:51
    wzrdtales edited #634
  • Aug 18 18:46
    stale[bot] closed #634
  • Aug 16 11:34
    stale[bot] labeled #636
  • Aug 16 11:34
    stale[bot] commented #636
  • Aug 16 10:39
    wzrdtales edited #633
  • Aug 16 10:34
    stale[bot] closed #633
  • Aug 16 08:29
    wzrdtales edited #645
  • Aug 16 08:23
    golopot opened #645
  • Aug 15 18:20
    wzrdtales edited #629
  • Aug 15 18:15
    stale[bot] closed #629
  • Aug 15 09:14
    stale[bot] unlabeled #624
  • Aug 15 09:14
    ilgiz-badamshin commented #624
  • Aug 15 06:15
    stale[bot] labeled #624
  • Aug 15 06:15
    stale[bot] commented #624
  • Aug 15 00:13
    RenWenshan commented #468
  • Aug 15 00:11
    RenWenshan edited #644
  • Aug 14 08:25
    RenWenshan synchronize #644
  • Aug 14 08:21
    commitlint-wzrdtales[bot] commented #644
  • Aug 14 08:21
    RenWenshan opened #644
Nicholas Iannone
ie. if the database.json file indicates a driver type of "pg", then it'd have to slap in a import * as DbMigratePg from 'db-migrate-pg' into the migration file.
and then modify the type of db in export function up(db) and export function down(db) to match
Tobias Gurtzick
@nickiannone Ok, cool. Let me know if you need anything, very basic plugin support has also been added, needs more hooks to be actually useful. Next topic is the transition assitent and documentations
@wallyuva I have taken your question about how to use yaml by the way. It is the first example plugin that is indeed also a real plugin that is functional. You can see this here: https://github.com/db-migrate/plugin-yaml As soon as the latest changes are released which needs the transition helper first b/c of a breaking change that occured in the latest changes, this will be available.
Alla Abramova
Hi guys! Doing some research. Wonder if there is any sample project repo of using db-migrate to migrate from mongo to postres?
Nenad Kostic
Hi Guys I have issue when adding create function in raw sql file. THe script works fine when i run it on mysql server but when I use dg-migrate I get :[ERROR] Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER //
I am using the lates bersion of db-migrate and mysql driver
is there any way way to add SSL to the migrations_config.js file?
Jeff Galbraith
In our database, we are using "sql-file": true for our migrations. I need to add some additional types to an ENUM, but according to the Postgress documentation: ALTER TYPE ... ADD VALUE (the form that adds a new value to an enum type) cannot be executed inside a transaction block.. Is there a way of turning off a transaction for a particular migration file?
Erik Trom
howdy - brand new to this tool in node - is there a competing db migration tool or is the ‘the one’?
Nicholas Bering
I’ve seen some people use sequelize and sequelize-cli. It’s a bit more involved though since you’re pulling in a whole ORM.
It’s hard to judge market share with DB tools since you see a lot more library code in the public than you do actual application code. Tutorials are a poor indicator.
Erik Trom
@nbering - i’ll check sequelize-cli as well, thanks
Tobias Gurtzick
There are some other solutions, some that are more simple and are really just up and downards migrations.
sequelize has as mentioned migrations, but as far as I remember no real migrations, that have been some reflection like migrations which is a different thing
Depends on what you search for, if you want zero downtime you probably want something more sophisticated
if you don't care about that and your application is not that critical you can go for comfortable, but less safe and with less control, solutions like sequelize and others
just weigh your options and decide
Scott Stern
Hello, I am trying to use the programmable API for getInstance and I am passing in options as an object but getting errors TypeError: Cannot read property 'charCodeAt' of undefined. Any ideas? Thank you
Daniel Bretoi
hi i'm getting TypeError: Promise.fromCallback is not a function from node_modules/db-migrate/api.js:195 anyone know what's up with that? Seems this fromCallback is no longer part of bluebird
ok, nm, i guess it's an older one it wasn't part of
and the older one got required first in the chain
Hi! i was wondering how to create a migration script, with default value using the literal DEFAULT_TIMESTAMP of mysql. i tried to search the docs & repo for ways to do this, but can't find any. can anyone help me please? Thanks!
Tobias Gurtzick
@shierro depends on the driver. in doubt new String('xyz') always works
in updated drivers such as the cockroachdb one there is a new raw property
in those you can write it like this:
    createdAt: {
      type: 'timestamptz',
      notNull: true,
      defaultValue: {
        raw: 'CURRENT_TIMESTAMP()'
if i am right this needs to be added to the other official drivers though. in that case fall back to new String
and you mean probably CURRENT_TIMESTAMP and not DEFAULT_TIMESTAMP
this is natively supported by the mysql driver anyway
just put it like that defaultValue: 'CURRENT_TIMESTAMP'
new String and raw will be more cross compatible in doubt though
ah yes, i was looking for the raw option, and yes for CURRENT_TIMESTAMP thanks @wzrdtales you're awesome
this is useful. although i haven't been able to see it in the docs. might be good if we can add it there for future reference
Tobias Gurtzick
np, it is not yet in the docs, and not yet in all drivers
I intend to add a special property as well
where I can put well known functions like current_timestamp across the board
and keep raw for the unique stuff
Hi. I'm getting an error [ERROR] Error: Environment(s) 'all' not found. My database.json file just contains one line: {
"all": {"ENV":"DATABASE_URL"}
}. Can you assist?
This is only happening within a Heroku release, not locally
and using command: db-migrate up --config config/database.json -e all
Tobias Gurtzick
you're using that wrong
first of all never name your target config all
all is a reserved key in a lot of cases
second of all, when you want to use DATABASE_URL you do not need any db config at all normally
and the error happens b/c the environment variable is not set
you need to check on your side why
Dmitry Dzhus
Hey all, I can't find anything on the status of COPY support – is it expected to work if I want to manage some custom data in migrations too? currently getting this on 0.11.5:
received data: CREATE TABLE test_data (col1 text, col2 text);

COPY test_data (col1, col2) FROM stdin;
a       b
c       d

[ERROR] AssertionError [ERR_ASSERTION]: ifError got unwanted exception: syntax error at or near "a"

guys stupid question about installation
i am confused...
npm install -g db-migrate - done
creating the migration: db-migrate create initial

and the result is like this

'use strict';

var dbm;
var type;
var seed;

  * We receive the dbmigrate dependency from dbmigrate initially.
  * This enables us to not have to rely on NODE_PATH.
exports.setup = function(options, seedLink) {
  dbm = options.dbmigrate;
  type = dbm.dataType;
  seed = seedLink;

exports.up = function(db) {
  return null;

exports.down = function(db) {
  return null;

exports._meta = {
  "version": 1

this is definitely not the same as in docs
and i think its from another package at all
or... docs are a little bit wrong?