adhoc fix sequelize/sequelize-tests.ts

This commit is contained in:
vvakame
2015-09-03 22:16:43 +09:00
parent 9c6b48468e
commit fbbf9cdc0a

View File

@@ -587,7 +587,9 @@ User.findOne( { where : { name : 'worker' }, include : [User] } );
User.findOne( { where : { name : 'Boris' }, include : [User, { model : User, as : 'Photos' }] } );
User.findOne( { where : { username : 'someone' }, include : [User] } );
User.findOne( { where : { username : 'barfooz' }, raw : true } );
/* NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
User.findOne( { updatedAt : { ne : null } } );
*/
User.find( { where : { intVal : { gt : 5 } } } );
User.find( { where : { intVal : { lte : 5 } } } );
@@ -639,7 +641,9 @@ User.findOrInitialize( { where : { username : 'foo' }, defaults : { foo : 'asd'
User.findOrCreate( { where : { a : 'b' }, defaults : { json : { a : { b : 'c' }, d : [1, 2, 3] } } } );
User.findOrCreate( { where : { a : 'b' }, defaults : { json : 'a', data : 'b' } } );
/* NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
User.findOrCreate( { where : { a : 'b' }, transaction : t, lock : t.LOCK.UPDATE } );
*/
User.findOrCreate( { where : { a : 'b' }, logging : function( ) { } } );
User.findOrCreate( { where : { username : 'Username' }, defaults : { data : 'some data' }, transaction : t } );
User.findOrCreate( { where : { objectId : 'asdasdasd' }, defaults : { username : 'gottlieb' } } );
@@ -719,24 +723,32 @@ queryInterface.dropAllTables();
queryInterface.showAllTables( { logging : function() { } } );
queryInterface.createTable( 'table', { name : Sequelize.STRING }, { logging : function() { } } );
queryInterface.createTable( 'skipme', { name : Sequelize.STRING } );
/* NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
queryInterface.dropAllTables( { skip : ['skipme'] } );
*/
queryInterface.dropTable( 'Group', { logging : function() { } } );
queryInterface.addIndex( 'Group', ['username', 'isAdmin'], { logging : function() { } } );
queryInterface.showIndex( 'Group', { logging : function() { } } );
queryInterface.removeIndex( 'Group', ['username', 'isAdmin'], { logging : function() { } } );
queryInterface.showIndex( 'Group' );
/* NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
queryInterface.createTable( 'table', { name : { type : Sequelize.STRING } }, { schema : 'schema' } );
*/
queryInterface.addIndex( { schema : 'a', tableName : 'c' }, ['d', 'e'], { logging : function() {} }, 'schema_table' );
queryInterface.showIndex( { schema : 'schema', tableName : 'table' }, { logging : function() {} } );
queryInterface.addIndex( 'Group', ['from'] );
queryInterface.describeTable( '_Users', { logging : function() {} } );
queryInterface.createTable( 's', { table_id : { type : Sequelize.INTEGER, primaryKey : true, autoIncrement : true } } );
/* NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
queryInterface.insert( null, 'TableWithPK', {}, { raw : true, returning : true, plain : true } );
*/
queryInterface.createTable( 'SomeTable', { someEnum : Sequelize.ENUM( 'value1', 'value2', 'value3' ) } );
queryInterface.createTable( 'SomeTable', { someEnum : { type : Sequelize.ENUM, values : ['b1', 'b2', 'b3'] } } );
queryInterface.createTable( 't', { someEnum : { type : Sequelize.ENUM, values : ['c1', 'c2', 'c3'], field : 'd' } } );
/* NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
queryInterface.createTable( 'User', { name : { type : Sequelize.STRING } }, { schema : 'hero' } );
queryInterface.rawSelect( 'User', { schema : 'hero', logging : function() {} }, 'name' );
*/
queryInterface.renameColumn( '_Users', 'username', 'pseudo', { logging : function() {} } );
queryInterface.renameColumn( { schema : 'archive', tableName : 'Users' }, 'username', 'pseudo' );
queryInterface.renameColumn( '_Users', 'username', 'pseudo' );
@@ -918,6 +930,7 @@ s.define( 'UserWithUniqueUsername', {
username : { type : Sequelize.STRING, unique : { name : 'user_and_email', msg : 'User and email must be unique' } },
email : { type : Sequelize.STRING, unique : 'user_and_email' }
} );
/* NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
s.define( 'UserWithUniqueUsername', {
user_id : { type : Sequelize.INTEGER },
email : { type : Sequelize.STRING }
@@ -931,7 +944,7 @@ s.define( 'UserWithUniqueUsername', {
fields : ['user_id', { attribute : 'email', collate : 'en_US', order : 'DESC', length : 5 }]
}]
} );
*/
s.define( 'TaskBuild', {
title : { type : Sequelize.STRING, defaultValue : 'a task!' },
foo : { type : Sequelize.INTEGER, defaultValue : 2 },
@@ -1239,49 +1252,3 @@ s.transaction( function() {
s.transaction( { isolationLevel : 'SERIALIZABLE' }, function( t ) { return Promise.resolve(); } );
s.transaction( { isolationLevel : s.Transaction.ISOLATION_LEVELS.SERIALIZABLE }, (t) => Promise.resolve() );
s.transaction( { isolationLevel : s.Transaction.ISOLATION_LEVELS.READ_COMMITTED }, (t) => Promise.resolve() );