From cb1a855f34bd12464a4e80cc03c096a323a02818 Mon Sep 17 00:00:00 2001 From: schneefux Date: Sat, 15 Apr 2017 16:58:31 +0200 Subject: db: participant_item_use needs a primary key --- models/asset.js | 3 ++- models/item_participant.js | 10 ++++++++-- models/match.js | 3 ++- models/participant.js | 3 ++- 4 files changed, 14 insertions(+), 5 deletions(-) (limited to 'models') diff --git a/models/asset.js b/models/asset.js index ae939a0..a10c2da 100644 --- a/models/asset.js +++ b/models/asset.js @@ -35,7 +35,8 @@ module.exports = function(sequelize, DataTypes) { }, created_at: { type: DataTypes.TIME, - allowNull: false + allowNull: false, + defaultValue: sequelize.literal('CURRENT_TIMESTAMP') }, description: { type: DataTypes.STRING(191), diff --git a/models/item_participant.js b/models/item_participant.js index 94d2061..ca8ef15 100644 --- a/models/item_participant.js +++ b/models/item_participant.js @@ -3,8 +3,10 @@ module.exports = function(sequelize, DataTypes) { return sequelize.define('item_participant', { id: { - type: DataTypes.INTEGER(5).UNSIGNED, - allowNull: false + type: DataTypes.INTEGER(10).UNSIGNED, + allowNull: false, + primaryKey: true, + autoIncrement: true }, participant_api_id: { type: DataTypes.CHAR(36), @@ -14,6 +16,10 @@ module.exports = function(sequelize, DataTypes) { type: DataTypes.STRING(191), allowNull: false }, + number: { + type: DataTypes.INTEGER(5).UNSIGNED, + allowNull: false + }, action: { type: DataTypes.ENUM('grant','sell','use','final'), allowNull: false diff --git a/models/match.js b/models/match.js index 0b9f6d9..7efd63b 100644 --- a/models/match.js +++ b/models/match.js @@ -19,7 +19,8 @@ module.exports = function(sequelize, DataTypes) { }, created_at: { type: DataTypes.TIME, - allowNull: false + allowNull: false, + defaultValue: sequelize.literal('CURRENT_TIMESTAMP') }, duration: { type: DataTypes.INTEGER(5).UNSIGNED, diff --git a/models/participant.js b/models/participant.js index caa8c80..f508e9b 100644 --- a/models/participant.js +++ b/models/participant.js @@ -51,7 +51,8 @@ module.exports = function(sequelize, DataTypes) { }, created_at: { type: DataTypes.TIME, - allowNull: false + allowNull: false, + defaultValue: sequelize.literal('CURRENT_TIMESTAMP') }, actor: { type: DataTypes.STRING(16), -- cgit v1.3.1