From 6b4cb056cf133edcc3b2137f0bb35913a0096d07 Mon Sep 17 00:00:00 2001 From: schneefux Date: Sat, 1 Apr 2017 13:12:28 +0200 Subject: generate from db --- models/asset.js | 28 ++++++++++++++++------------ models/match.js | 3 ++- models/player.js | 2 +- models/player_ext.js | 34 ++++++++++++++++++++++------------ package.json | 1 + 5 files changed, 42 insertions(+), 26 deletions(-) diff --git a/models/asset.js b/models/asset.js index af8d040..b55fed4 100644 --- a/models/asset.js +++ b/models/asset.js @@ -8,38 +8,42 @@ module.exports = function(sequelize, DataTypes) { primaryKey: true, autoIncrement: true }, + match_api_id: { + type: DataTypes.STRING(191), + allowNull: false + }, api_id: { type: DataTypes.STRING(191), - allowNull: false, - unique: true + allowNull: false }, - match_api_id: { + type: { type: DataTypes.STRING(191), allowNull: false }, - url: { + name: { type: DataTypes.STRING(191), allowNull: false }, + url: { + type: DataTypes.STRING(191), + allowNull: true + }, content_type: { type: DataTypes.STRING(191), - allowNull: false + allowNull: true }, created_at: { type: DataTypes.TIME, - allowNull: false + allowNull: false, + defaultValue: sequelize.literal('CURRENT_TIMESTAMP') }, description: { type: DataTypes.STRING(191), - allowNull: false + allowNull: true }, filename: { type: DataTypes.STRING(191), - allowNull: false - }, - name: { - type: DataTypes.STRING(191), - allowNull: false + allowNull: true } }, { tableName: 'asset', diff --git a/models/match.js b/models/match.js index ec5bdab..46c4f80 100644 --- a/models/match.js +++ b/models/match.js @@ -23,7 +23,8 @@ module.exports = function(sequelize, DataTypes) { }, created_at: { type: DataTypes.TIME, - allowNull: false + allowNull: false, + defaultValue: sequelize.literal('CURRENT_TIMESTAMP') }, duration: { type: DataTypes.INTEGER(11), diff --git a/models/player.js b/models/player.js index a0583dc..827e9fc 100644 --- a/models/player.js +++ b/models/player.js @@ -10,7 +10,7 @@ module.exports = function(sequelize, DataTypes) { }, shard_id: { type: DataTypes.STRING(191), - allowNull: false + allowNull: true }, api_id: { type: DataTypes.STRING(191), diff --git a/models/player_ext.js b/models/player_ext.js index f31b790..6d0a369 100644 --- a/models/player_ext.js +++ b/models/player_ext.js @@ -4,9 +4,7 @@ module.exports = function(sequelize, DataTypes) { return sequelize.define('player_ext', { id: { type: DataTypes.INTEGER(11), - allowNull: false, - primaryKey: true, - autoIncrement: true + allowNull: false }, player_api_id: { type: DataTypes.STRING(191), @@ -15,43 +13,55 @@ module.exports = function(sequelize, DataTypes) { }, played: { type: DataTypes.INTEGER(11), - allowNull: true + allowNull: false }, played_ranked: { type: DataTypes.INTEGER(11), - allowNull: true + allowNull: false }, played_casual: { type: DataTypes.INTEGER(11), - allowNull: true + allowNull: false }, played_brawl: { type: DataTypes.INTEGER(11), - allowNull: true + allowNull: false }, wins: { type: DataTypes.INTEGER(11), - allowNull: true + allowNull: false }, wins_ranked: { type: DataTypes.INTEGER(11), - allowNull: true + allowNull: false }, wins_casual: { type: DataTypes.INTEGER(11), - allowNull: true + allowNull: false }, wins_brawl: { type: DataTypes.INTEGER(11), - allowNull: true + allowNull: false }, skill_tier: { type: DataTypes.STRING(191), allowNull: true }, - streak: { + played_role_1: { + type: DataTypes.STRING(191), + allowNull: true + }, + played_role_2: { type: DataTypes.STRING(191), allowNull: true + }, + played_role_3: { + type: DataTypes.STRING(191), + allowNull: true + }, + streak: { + type: DataTypes.STRING(191), + allowNull: false } }, { tableName: 'player_ext', diff --git a/package.json b/package.json index e295276..eeedf82 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "author": "schneefux", "license": "UNLICENSED", "dependencies": { + "mysql": "^2.13.0", "sequelize-auto": "^0.4.25" } } -- cgit v1.3.1