stellar-deprecated / stex

DEPRECATED. An opinionated framework built on top of expressjs used to build better web services for stellar
Other
30 stars 11 forks source link

Knex migrate #26

Closed thejollyrogers closed 10 years ago

thejollyrogers commented 10 years ago

add knex migration support to stex

nullstyle commented 10 years ago

I’ll pull this down in a little bit and test it out.

nullstyle commented 10 years ago

running an unknown migrate command causes a hang:

➜  stellar-wallet git:(master) ✗ stex migrate create
[Error: Unknown cmd create]

The above command never exits.

nullstyle commented 10 years ago

Looks like successful commands dont properly exit as well

nullstyle commented 10 years ago

Given the migration (in stellar-wallet) (using npm-linked stex):

'use strict';

exports.up = function(knex, Promise) {
  knex.schema.table('wallets_v2', function (table) {
    table.string('publicKey').index();
  });
};

exports.down = function(knex, Promise) {

};

I get the following output:

➜  stellar-wallet git:(master) ✗ stex migrate latest
SQL: select * from information_schema.tables where table_schema = ? and table_name = ?
SQL: create table `knex_migrations` (`id` int unsigned not null auto_increment primary key, `name` varchar(255), `batch` int, `migration_time` timestamp)
SQL: select `name` from `knex_migrations` order by `id` asc
SQL: select max(`batch`) as `batchNo` from `knex_migrations`
Possibly unhandled TypeError: Object [object Knex:mysql] has no method 'createTable'
    at Object.exports.up (/Users/nullstyle/Dropbox/src/stellar/stellar-wallet/migrations/20140604193141-add-wallets.js:5:6)
    at Object.current.then.then.knex.insert.name (/Users/nullstyle/Dropbox/src/stellar/stex/node_modules/knex/lib/migrate/index.js:214:34)
    at tryCatch1 (/Users/nullstyle/Dropbox/src/stellar/stex/node_modules/knex/node_modules/bluebird/js/main/util.js:63:19)
    at Promise$_callHandler [as _callHandler] (/Users/nullstyle/Dropbox/src/stellar/stex/node_modules/knex/node_modules/bluebird/js/main/promise.js:695:13)
    at Promise$_settlePromiseFromHandler [as _settlePromiseFromHandler] (/Users/nullstyle/Dropbox/src/stellar/stex/node_modules/knex/node_modules/bluebird/js/main/promise.js:711:18)
    at Promise$_settlePromiseAt [as _settlePromiseAt] (/Users/nullstyle/Dropbox/src/stellar/stex/node_modules/knex/node_modules/bluebird/js/main/promise.js:868:14)
    at Async$_consumeFunctionBuffer [as _consumeFunctionBuffer] (/Users/nullstyle/Dropbox/src/stellar/stex/node_modules/knex/node_modules/bluebird/js/main/async.js:74:12)
    at Async$consumeFunctionBuffer (/Users/nullstyle/Dropbox/src/stellar/stex/node_modules/knex/node_modules/bluebird/js/main/async.js:37:14)
    at process._tickDomainCallback (node.js:463:13)
thejollyrogers commented 10 years ago

I added the finally block to shutdown stex after the command runs, are you sure it's hanging?

nullstyle commented 10 years ago

I'll check it again later today

thejollyrogers commented 10 years ago

not sure why you're getting a "has no method 'createTable'" when you don't ever call that method in your example migration..you sure it's not running a different migration file?

thejollyrogers commented 10 years ago

scoot :+1: