forked from sequelize/sequelize-sscce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sscce.js
25 lines (21 loc) · 885 Bytes
/
sscce.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'use strict';
// Require the necessary things from Sequelize
const { Sequelize, Op, Model, DataTypes } = require('sequelize');
// This function should be used instead of `new Sequelize()`.
// It applies the config for your SSCCE to work on CI.
const createSequelizeInstance = require('./utils/create-sequelize-instance');
// This is a utility logger that should be preferred over `console.log()`.
const log = require('./utils/log');
// Your SSCCE goes inside this function.
module.exports = async function() {
const sequelize = createSequelizeInstance({
logQueryParameters: true,
benchmark: true,
define: {
timestamps: false // For less clutter in the SSCCE
}
});
const Foo = sequelize.define('Foo', { name: DataTypes.TEXT });
await sequelize.sync();
log(await Foo.create({ name: 'foo' }));
};