forked from sequelize/sequelize-sscce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sscce.js
51 lines (43 loc) · 1.34 KB
/
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
'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 an utility logger that should be preferred over `console.log()`.
const log = require('./utils/log');
// You can use chai assertions directly in your SSCCE if you want.
const { expect } = require('chai');
// Your SSCCE goes inside this function.
module.exports = async function() {
if (process.env.DIALECT !== "mssql") return;
const sequelize = createSequelizeInstance({
dialect: 'mssql',
logQueryParameters: true,
benchmark: true,
define: {
timestamps: false // For less clutter in the SSCCE
}
});
var testTable = sequelize.define("test_table", {
Name: {
type: DataTypes.STRING,
primaryKey: true
},
Age: {
type: DataTypes.INTEGER
},
IsOnline: {
type: DataTypes.BOOLEAN,
primaryKey: true
}
}, {
freezeTableName: true,
timestamps : false
});
await testTable.upsert({
"Name": "Charlie",
"Age": 24,
"IsOnline": false
});
};