db-migrate / node-db-migrate

Database migration framework for node
Other
2.32k stars 360 forks source link

Version Control #472

Closed SeanJOBrien closed 7 years ago

SeanJOBrien commented 7 years ago

Hello,

This is very much a question.

On generation of a migration using

db-migrate create <NAME> --config config/database.json

The file generated looks thus.

'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
};

my question is around "exports._meta" this is meta data for that particular file from what i can see, does it serve any other purpose ?

Thanks

wzrdtales commented 7 years ago

@SeanJOBrien Yes it does, this is really what it sounds like. It is metadata for this specific migration and should help in the future, to identify the version of your migration, to actually allow a few things.

1) Migrate migration changes into a new schema 2) Allow new versions of migrations that could look totally different

SeanJOBrien commented 7 years ago

Perfect thank you, sorry for the late reply.

Diluka commented 6 years ago

@wzrdtales Shall I change this number every time or in what situation must I change it?

wzrdtales commented 6 years ago

@Diluka you may never touch it.

Diluka commented 6 years ago

understood,thx