Skip to content

Instantly share code, notes, and snippets.

@broofa
Last active January 31, 2020 15:32
Show Gist options
  • Save broofa/2d85e249d219406e54ab14b3c8f4f36c to your computer and use it in GitHub Desktop.
Save broofa/2d85e249d219406e54ab14b3c8f4f36c to your computer and use it in GitHub Desktop.
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