Skip to content

Instantly share code, notes, and snippets.

@roblight
Forked from notgiorgi/Schema.js
Created February 2, 2018 19:43
Show Gist options
  • Save roblight/5a5003eb4059f0c294e32844d2a31d74 to your computer and use it in GitHub Desktop.
Save roblight/5a5003eb4059f0c294e32844d2a31d74 to your computer and use it in GitHub Desktop.
const GSession = require('./schema')
module.exports = {
up(dbService) {
return dbService.createTable(GSession.options.tableName, GSession.schema))
},
down(dbService) {
return dbService.dropTable(Gsession.options.tableName)
}
}
const GSession = require('./schema')
module.exports = sequelize => sequelize.define('GSession', GSession.schema, GSession.options)
const { DataTypes } = require('sequelize')
module.exports = {
schema: {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
allowNull: false,
autoIncrement: true,
},
start_time: DataTypes.DATE,
end_time: DataTypes.DATE,
is_closed: {
type: DataTypes.BOOLEAN,
defaultValue: false,
},
},
options: {
tableName: 'gsessions',
timestamps: false,
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment