diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-03-31 20:51:04 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-03-31 20:51:04 +0200 |
| commit | be4e78d7b769b9798fa7938909e4ee9fbba3977e (patch) | |
| tree | fd298bc34bca884173e3f3b8ad468f038ca7af32 | |
| download | orm-be4e78d7b769b9798fa7938909e4ee9fbba3977e.tar.gz orm-be4e78d7b769b9798fa7938909e4ee9fbba3977e.zip | |
move ORM model into seperate repo
| -rw-r--r-- | .gitignore | 59 | ||||
| -rw-r--r-- | generate_model.js | 23 | ||||
| -rw-r--r-- | model.js | 26 | ||||
| -rw-r--r-- | models/asset.js | 50 | ||||
| -rw-r--r-- | models/gamer.js | 41 | ||||
| -rw-r--r-- | models/hero_core_stats.js | 69 | ||||
| -rw-r--r-- | models/hero_dimension.js | 33 | ||||
| -rw-r--r-- | models/hero_stats.js | 41 | ||||
| -rw-r--r-- | models/heros.js | 85 | ||||
| -rw-r--r-- | models/item.js | 41 | ||||
| -rw-r--r-- | models/keys.js | 37 | ||||
| -rw-r--r-- | models/match.js | 50 | ||||
| -rw-r--r-- | models/match_ext.js | 52 | ||||
| -rw-r--r-- | models/migrations.js | 25 | ||||
| -rw-r--r-- | models/participant.js | 122 | ||||
| -rw-r--r-- | models/participant_ext.js | 42 | ||||
| -rw-r--r-- | models/participant_item_use.js | 34 | ||||
| -rw-r--r-- | models/player.js | 54 | ||||
| -rw-r--r-- | models/player_dimension.js | 33 | ||||
| -rw-r--r-- | models/player_ext.js | 60 | ||||
| -rw-r--r-- | models/player_stats.js | 33 | ||||
| -rw-r--r-- | models/roster.js | 58 | ||||
| -rw-r--r-- | models/roster_ext.js | 53 | ||||
| -rw-r--r-- | models/stats_dimensions.js | 29 | ||||
| -rw-r--r-- | package.json | 14 |
25 files changed, 1164 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..00cbbdf --- /dev/null +++ b/.gitignore @@ -0,0 +1,59 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Typescript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + diff --git a/generate_model.js b/generate_model.js new file mode 100644 index 0000000..d88fb12 --- /dev/null +++ b/generate_model.js @@ -0,0 +1,23 @@ +#!/usr/bin/node + +var SequelizeAuto = require("sequelize-auto") + +var auto = new SequelizeAuto("vainweb", "vainweb", "vainweb", { + host: "localhost", + dialect: "mariadb", + directory: "models", + additional: { + timestamps: false, + underscored: true, + freezeTableName: true + }, + indentation: 2, + spaces: true +}) + +auto.run(function (err) { + if (err) throw err; + + console.log(auto.tables); // table list + console.log(auto.foreignKeys); // foreign key list +}); diff --git a/model.js b/model.js new file mode 100644 index 0000000..d5ef5d6 --- /dev/null +++ b/model.js @@ -0,0 +1,26 @@ +/* jshint esnext:true */ +'use strict'; + +module.exports = (seq, Seq) => { + let Match = seq.import("./models/match.js"), + Asset = seq.import("./models/asset.js"), + Roster = seq.import("./models/roster.js"), + //Team = seq.import("./models/team.js"), + Participant = seq.import("./models/participant.js"), + ParticipantItemUse = seq.import("./models/participant_item_use.js"), + Player = seq.import("./models/player.js"), + Item = seq.import("./models/item.js"); + + Match.hasMany(Asset, {as: "Assets"}); + Asset.belongsTo(Match); + Roster.belongsTo(Match, { foreignKey: "match_api_id", targetKey: "api_id" }); + //Roster.hasOne(Team, {as: "Team"}); + //Team.belongsTo(Roster); + Participant.belongsTo(Roster, { foreignKey: "roster_api_id", targetKey: "api_id" }); + Participant.hasOne(Player, { foreignKey: "player_api_id", targetKey: "api_id" }); + ParticipantItemUse.belongsTo(Participant, { foreignKey: "participant_api_id", targetKey: "api_id" }); + ParticipantItemUse.hasOne(Item); + + //return {Match, Roster, Team, Participant, Player, Asset}; + return {Match, Roster, Participant, ParticipantItemUse, Player, Asset, Item}; +}; diff --git a/models/asset.js b/models/asset.js new file mode 100644 index 0000000..af8d040 --- /dev/null +++ b/models/asset.js @@ -0,0 +1,50 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('asset', { + id: { + type: DataTypes.INTEGER(10).UNSIGNED, + allowNull: false, + primaryKey: true, + autoIncrement: true + }, + api_id: { + type: DataTypes.STRING(191), + allowNull: false, + unique: true + }, + match_api_id: { + type: DataTypes.STRING(191), + allowNull: false + }, + url: { + type: DataTypes.STRING(191), + allowNull: false + }, + content_type: { + type: DataTypes.STRING(191), + allowNull: false + }, + created_at: { + type: DataTypes.TIME, + allowNull: false + }, + description: { + type: DataTypes.STRING(191), + allowNull: false + }, + filename: { + type: DataTypes.STRING(191), + allowNull: false + }, + name: { + type: DataTypes.STRING(191), + allowNull: false + } + }, { + tableName: 'asset', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/models/gamer.js b/models/gamer.js new file mode 100644 index 0000000..d88484c --- /dev/null +++ b/models/gamer.js @@ -0,0 +1,41 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('gamer', { + id: { + type: DataTypes.INTEGER(10).UNSIGNED, + allowNull: false, + primaryKey: true, + autoIncrement: true + }, + player_api_id: { + type: DataTypes.STRING(191), + allowNull: false + }, + name: { + type: DataTypes.STRING(191), + allowNull: false + }, + vainsocial_status: { + type: DataTypes.STRING(191), + allowNull: true + }, + vainglory_ign: { + type: DataTypes.STRING(191), + allowNull: true + }, + vainglory_shard_id: { + type: DataTypes.STRING(191), + allowNull: true + }, + vainglory_is_pro: { + type: DataTypes.INTEGER(1), + allowNull: true + } + }, { + tableName: 'gamer', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/models/hero_core_stats.js b/models/hero_core_stats.js new file mode 100644 index 0000000..bc709af --- /dev/null +++ b/models/hero_core_stats.js @@ -0,0 +1,69 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('hero_core_stats', { + id: { + type: DataTypes.INTEGER(10).UNSIGNED, + allowNull: false, + primaryKey: true, + autoIncrement: true + }, + created_at: { + type: DataTypes.TIME, + allowNull: true + }, + updated_at: { + type: DataTypes.TIME, + allowNull: true + }, + series: { + type: DataTypes.STRING(191), + allowNull: false + }, + hp: { + type: "DOUBLE", + allowNull: false + }, + energy: { + type: "DOUBLE", + allowNull: false + }, + weapon_damage: { + type: "DOUBLE", + allowNull: false + }, + attack_speed: { + type: "DOUBLE", + allowNull: false + }, + armor: { + type: "DOUBLE", + allowNull: false + }, + shield: { + type: "DOUBLE", + allowNull: false + }, + attack_range: { + type: "DOUBLE", + allowNull: false + }, + move_speed: { + type: "DOUBLE", + allowNull: false + }, + hp_regen: { + type: "DOUBLE", + allowNull: false + }, + ep_regen: { + type: "DOUBLE", + allowNull: false + } + }, { + tableName: 'hero_core_stats', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/models/hero_dimension.js b/models/hero_dimension.js new file mode 100644 index 0000000..c5af060 --- /dev/null +++ b/models/hero_dimension.js @@ -0,0 +1,33 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('hero_dimension', { + id: { + type: DataTypes.INTEGER(10).UNSIGNED, + allowNull: false, + primaryKey: true, + autoIncrement: true + }, + hero_id: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + dimension_id: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + stats_id: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + computed_on: { + type: DataTypes.DATE, + allowNull: false + } + }, { + tableName: 'hero_dimension', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/models/hero_stats.js b/models/hero_stats.js new file mode 100644 index 0000000..c79ea4f --- /dev/null +++ b/models/hero_stats.js @@ -0,0 +1,41 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('hero_stats', { + id: { + type: DataTypes.INTEGER(10).UNSIGNED, + allowNull: false, + primaryKey: true, + autoIncrement: true + }, + created_at: { + type: DataTypes.TIME, + allowNull: true + }, + updated_at: { + type: DataTypes.TIME, + allowNull: true + }, + pick_rate: { + type: "DOUBLE(8,2)", + allowNull: false + }, + win_rate: { + type: "DOUBLE(8,2)", + allowNull: false + }, + gold_per_min: { + type: "DOUBLE(8,2)", + allowNull: false + }, + cs_per_min: { + type: "DOUBLE(8,2)", + allowNull: false + } + }, { + tableName: 'hero_stats', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/models/heros.js b/models/heros.js new file mode 100644 index 0000000..5260ee7 --- /dev/null +++ b/models/heros.js @@ -0,0 +1,85 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('heros', { + id: { + type: DataTypes.INTEGER(10).UNSIGNED, + allowNull: false, + primaryKey: true, + autoIncrement: true + }, + created_at: { + type: DataTypes.TIME, + allowNull: true + }, + updated_at: { + type: DataTypes.TIME, + allowNull: true + }, + added_in_patch: { + type: DataTypes.STRING(191), + allowNull: false + }, + name: { + type: DataTypes.STRING(191), + allowNull: false + }, + api_name: { + type: DataTypes.STRING(191), + allowNull: false + }, + is_assassin: { + type: DataTypes.INTEGER(1), + allowNull: false + }, + is_mage: { + type: DataTypes.INTEGER(1), + allowNull: false + }, + is_protector: { + type: DataTypes.INTEGER(1), + allowNull: false + }, + is_sniper: { + type: DataTypes.INTEGER(1), + allowNull: false + }, + is_warrior: { + type: DataTypes.INTEGER(1), + allowNull: false + }, + is_carry: { + type: DataTypes.INTEGER(1), + allowNull: false + }, + is_jungler: { + type: DataTypes.INTEGER(1), + allowNull: false + }, + is_captain: { + type: DataTypes.INTEGER(1), + allowNull: false + }, + heroic_perk: { + type: DataTypes.STRING(191), + allowNull: false + }, + ability_a: { + type: DataTypes.STRING(191), + allowNull: false + }, + ability_b: { + type: DataTypes.STRING(191), + allowNull: false + }, + ability_c: { + type: DataTypes.STRING(191), + allowNull: false + } + }, { + tableName: 'heros', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/models/item.js b/models/item.js new file mode 100644 index 0000000..6f2aac9 --- /dev/null +++ b/models/item.js @@ -0,0 +1,41 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('item', { + id: { + type: DataTypes.INTEGER(10).UNSIGNED, + allowNull: false, + primaryKey: true, + autoIncrement: true + }, + created_at: { + type: DataTypes.TIME, + allowNull: true + }, + updated_at: { + type: DataTypes.TIME, + allowNull: true + }, + series: { + type: DataTypes.STRING(191), + allowNull: false + }, + name: { + type: DataTypes.STRING(191), + allowNull: false + }, + active: { + type: DataTypes.STRING(191), + allowNull: false + }, + passive: { + type: DataTypes.STRING(191), + allowNull: false + } + }, { + tableName: 'item', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/models/keys.js b/models/keys.js new file mode 100644 index 0000000..0ba17f0 --- /dev/null +++ b/models/keys.js @@ -0,0 +1,37 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('keys', { + id: { + type: DataTypes.INTEGER(10).UNSIGNED, + allowNull: false, + primaryKey: true, + autoIncrement: true + }, + created_at: { + type: DataTypes.TIME, + allowNull: true + }, + updated_at: { + type: DataTypes.TIME, + allowNull: true + }, + type: { + type: DataTypes.STRING(191), + allowNull: false + }, + key: { + type: DataTypes.STRING(191), + allowNull: false + }, + value: { + type: DataTypes.STRING(191), + allowNull: false + } + }, { + tableName: 'keys', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/models/match.js b/models/match.js new file mode 100644 index 0000000..ec5bdab --- /dev/null +++ b/models/match.js @@ -0,0 +1,50 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('match', { + id: { + type: DataTypes.INTEGER(10).UNSIGNED, + allowNull: false, + primaryKey: true, + autoIncrement: true + }, + api_id: { + type: DataTypes.STRING(191), + allowNull: false, + unique: true + }, + shard_id: { + type: DataTypes.STRING(191), + allowNull: false + }, + series: { + type: DataTypes.STRING(191), + allowNull: true + }, + created_at: { + type: DataTypes.TIME, + allowNull: false + }, + duration: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + game_mode: { + type: DataTypes.STRING(191), + allowNull: false + }, + end_game_reason: { + type: DataTypes.STRING(191), + allowNull: false + }, + queue: { + type: DataTypes.STRING(191), + allowNull: false + } + }, { + tableName: 'match', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/models/match_ext.js b/models/match_ext.js new file mode 100644 index 0000000..01d6f6a --- /dev/null +++ b/models/match_ext.js @@ -0,0 +1,52 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('match_ext', { + id: { + type: DataTypes.STRING(191), + allowNull: false + }, + match_api_id: { + type: DataTypes.STRING(191), + allowNull: false, + unique: true + }, + winning_side: { + type: DataTypes.STRING(191), + allowNull: true + }, + total_kills: { + type: DataTypes.INTEGER(11), + allowNull: true + }, + kraken_captures: { + type: DataTypes.INTEGER(11), + allowNull: true + }, + gold: { + type: DataTypes.INTEGER(11), + allowNull: true + }, + aces_earned: { + type: DataTypes.INTEGER(11), + allowNull: true + }, + turret_captures: { + type: DataTypes.INTEGER(11), + allowNull: true + }, + gold_mine_captures: { + type: DataTypes.INTEGER(11), + allowNull: true + }, + crystal_miner_captures: { + type: DataTypes.INTEGER(11), + allowNull: true + } + }, { + tableName: 'match_ext', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/models/migrations.js b/models/migrations.js new file mode 100644 index 0000000..c0b3ecf --- /dev/null +++ b/models/migrations.js @@ -0,0 +1,25 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('migrations', { + id: { + type: DataTypes.INTEGER(10).UNSIGNED, + allowNull: false, + primaryKey: true, + autoIncrement: true + }, + migration: { + type: DataTypes.STRING(191), + allowNull: false + }, + batch: { + type: DataTypes.INTEGER(11), + allowNull: false + } + }, { + tableName: 'migrations', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/models/participant.js b/models/participant.js new file mode 100644 index 0000000..9c17e74 --- /dev/null +++ b/models/participant.js @@ -0,0 +1,122 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('participant', { + id: { + type: DataTypes.INTEGER(10).UNSIGNED, + allowNull: false, + primaryKey: true, + autoIncrement: true + }, + shard_id: { + type: DataTypes.STRING(191), + allowNull: false + }, + api_id: { + type: DataTypes.STRING(191), + allowNull: false, + unique: true + }, + player_api_id: { + type: DataTypes.STRING(191), + allowNull: false + }, + roster_api_id: { + type: DataTypes.STRING(191), + allowNull: false + }, + created_at: { + type: DataTypes.TIME, + allowNull: true + }, + series: { + type: DataTypes.TIME, + allowNull: true + }, + actor: { + type: DataTypes.STRING(191), + allowNull: false + }, + assists: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + crystal_mine_captures: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + deaths: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + farm: { + type: "DOUBLE", + allowNull: false + }, + first_afk_time: { + type: "DOUBLE", + allowNull: false + }, + gold: { + type: DataTypes.INTEGER(11), + allowNull: true + }, + gold_mine_captures: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + jungle_kills: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + karma_level: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + kills: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + kraken_captures: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + level: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + minion_kills: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + non_jungle_minion_kills: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + skill_tier: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + skin_key: { + type: DataTypes.STRING(191), + allowNull: false + }, + turret_captures: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + went_afk: { + type: DataTypes.INTEGER(1), + allowNull: false + }, + winner: { + type: DataTypes.INTEGER(1), + allowNull: false + } + }, { + tableName: 'participant', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/models/participant_ext.js b/models/participant_ext.js new file mode 100644 index 0000000..abcb5ed --- /dev/null +++ b/models/participant_ext.js @@ -0,0 +1,42 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('participant_ext', { + id: { + type: DataTypes.INTEGER(10).UNSIGNED, + allowNull: false, + primaryKey: true, + autoIncrement: true + }, + series: { + type: DataTypes.STRING(191), + allowNull: false + }, + participant_api_id: { + type: DataTypes.STRING(191), + allowNull: false, + unique: true + }, + role: { + type: DataTypes.STRING(191), + allowNull: true + }, + score: { + type: "DOUBLE(8,2)", + allowNull: true + }, + kda: { + type: "DOUBLE(8,2)", + allowNull: true + }, + kills_participation: { + type: "DOUBLE(8,2)", + allowNull: true + } + }, { + tableName: 'participant_ext', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/models/participant_item_use.js b/models/participant_item_use.js new file mode 100644 index 0000000..5dc8c39 --- /dev/null +++ b/models/participant_item_use.js @@ -0,0 +1,34 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('participant_item_use', { + id: { + type: DataTypes.INTEGER(10).UNSIGNED, + allowNull: false, + primaryKey: true, + autoIncrement: true + }, + participant_api_id: { + type: DataTypes.STRING(191), + allowNull: false, + unique: true + }, + item_id: { + type: DataTypes.STRING(191), + allowNull: false + }, + action: { + type: DataTypes.STRING(191), + allowNull: false + }, + time_from_start: { + type: DataTypes.INTEGER(11), + allowNull: false + } + }, { + tableName: 'participant_item_use', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/models/player.js b/models/player.js new file mode 100644 index 0000000..827e9fc --- /dev/null +++ b/models/player.js @@ -0,0 +1,54 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('player', { + id: { + type: DataTypes.INTEGER(10).UNSIGNED, + allowNull: false, + primaryKey: true, + autoIncrement: true + }, + shard_id: { + type: DataTypes.STRING(191), + allowNull: true + }, + api_id: { + type: DataTypes.STRING(191), + allowNull: false, + unique: true + }, + created_at: { + type: DataTypes.TIME, + allowNull: true + }, + name: { + type: DataTypes.STRING(191), + allowNull: false + }, + last_match_created_date: { + type: DataTypes.TIME, + allowNull: true + }, + last_update: { + type: DataTypes.TIME, + allowNull: true + }, + level: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + xp: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + lifetime_gold: { + type: "DOUBLE(8,2)", + allowNull: false + } + }, { + tableName: 'player', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/models/player_dimension.js b/models/player_dimension.js new file mode 100644 index 0000000..82ff7a0 --- /dev/null +++ b/models/player_dimension.js @@ -0,0 +1,33 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('player_dimension', { + id: { + type: DataTypes.INTEGER(10).UNSIGNED, + allowNull: false, + primaryKey: true, + autoIncrement: true + }, + player_id: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + dimension_id: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + stats_id: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + computed_on: { + type: DataTypes.DATE, + allowNull: false + } + }, { + tableName: 'player_dimension', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/models/player_ext.js b/models/player_ext.js new file mode 100644 index 0000000..183faf9 --- /dev/null +++ b/models/player_ext.js @@ -0,0 +1,60 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('player_ext', { + id: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + player_api_id: { + type: DataTypes.STRING(191), + allowNull: false, + unique: true + }, + played: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + played_ranked: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + played_casual: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + played_brawl: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + wins: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + wins_ranked: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + wins_casual: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + wins_brawl: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + skill_tier: { + type: DataTypes.STRING(191), + allowNull: true + }, + streak: { + type: DataTypes.STRING(191), + allowNull: false + } + }, { + tableName: 'player_ext', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/models/player_stats.js b/models/player_stats.js new file mode 100644 index 0000000..6bbeb69 --- /dev/null +++ b/models/player_stats.js @@ -0,0 +1,33 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('player_stats', { + id: { + type: DataTypes.INTEGER(10).UNSIGNED, + allowNull: false, + primaryKey: true, + autoIncrement: true + }, + created_at: { + type: DataTypes.TIME, + allowNull: true + }, + updated_at: { + type: DataTypes.TIME, + allowNull: true + }, + gold_per_min: { + type: "DOUBLE(8,2)", + allowNull: false + }, + cs_per_min: { + type: "DOUBLE(8,2)", + allowNull: false + } + }, { + tableName: 'player_stats', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/models/roster.js b/models/roster.js new file mode 100644 index 0000000..3848c6a --- /dev/null +++ b/models/roster.js @@ -0,0 +1,58 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('roster', { + id: { + type: DataTypes.INTEGER(10).UNSIGNED, + allowNull: false, + primaryKey: true, + autoIncrement: true + }, + shard_id: { + type: DataTypes.STRING(191), + allowNull: false + }, + api_id: { + type: DataTypes.STRING(191), + allowNull: false, + unique: true + }, + match_api_id: { + type: DataTypes.STRING(191), + allowNull: false + }, + aces_earned: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + gold: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + hero_kills: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + kraken_captures: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + side: { + type: DataTypes.STRING(191), + allowNull: false + }, + turret_kills: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + turrets_remaining: { + type: DataTypes.INTEGER(11), + allowNull: false + } + }, { + tableName: 'roster', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/models/roster_ext.js b/models/roster_ext.js new file mode 100644 index 0000000..1f7c37d --- /dev/null +++ b/models/roster_ext.js @@ -0,0 +1,53 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('roster_ext', { + id: { + type: DataTypes.INTEGER(10).UNSIGNED, + allowNull: false, + primaryKey: true, + autoIncrement: true + }, + roster_api_id: { + type: DataTypes.STRING(191), + allowNull: false + }, + kills: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + assists: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + deaths: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + gold: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + kraken_captures: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + side: { + type: DataTypes.STRING(191), + allowNull: false + }, + turret_captures: { + type: DataTypes.INTEGER(11), + allowNull: false + }, + turrets_remaining: { + type: DataTypes.INTEGER(11), + allowNull: false + } + }, { + tableName: 'roster_ext', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/models/stats_dimensions.js b/models/stats_dimensions.js new file mode 100644 index 0000000..0aa6ef3 --- /dev/null +++ b/models/stats_dimensions.js @@ -0,0 +1,29 @@ +/* jshint indent: 2 */ + +module.exports = function(sequelize, DataTypes) { + return sequelize.define('stats_dimensions', { + id: { + type: DataTypes.INTEGER(10).UNSIGNED, + allowNull: false, + primaryKey: true, + autoIncrement: true + }, + dimension_on: { + type: DataTypes.STRING(191), + allowNull: false + }, + name: { + type: DataTypes.STRING(191), + allowNull: false + }, + value: { + type: DataTypes.STRING(191), + allowNull: false + } + }, { + tableName: 'stats_dimensions', + timestamps: false, + underscored: true, + freezeTableName: true + }); +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..e295276 --- /dev/null +++ b/package.json @@ -0,0 +1,14 @@ +{ + "name": "orm", + "version": "2.0.0", + "description": "", + "main": "generate_model.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "schneefux", + "license": "UNLICENSED", + "dependencies": { + "sequelize-auto": "^0.4.25" + } +} |
