Skip to content

Instantly share code, notes, and snippets.

@broofa
Last active January 31, 2020 15:32
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
const Sequelize = require('sequelize');
async function main() {
const sequelize = new Sequelize(null, null, null, {
dialect: 'sqlite',
storage: ':memory:',
});
await sequelize.query('CREATE TABLE things (id INTEGER PRIMARY KEY, aColumn TEXT DEFAULT NULL)');
const Thing = await sequelize.define('thing', {
aColumn: {
type: Sequelize.STRING,
allowNull: true,
validate: {
customValidator() {
throw Error('Why is this being run???');
}
}
}
}, {timestamps: false});
// This throws. It shouldn't.
await Thing.create();
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment