summaryrefslogtreecommitdiff
path: root/src/routers/vault/models
diff options
context:
space:
mode:
Diffstat (limited to 'src/routers/vault/models')
-rw-r--r--src/routers/vault/models/evol/char.js364
-rw-r--r--src/routers/vault/models/evol/char_reservation.js14
-rw-r--r--src/routers/vault/models/evol/login.js94
-rw-r--r--src/routers/vault/models/legacy/char.js143
-rw-r--r--src/routers/vault/models/legacy/login.js64
-rw-r--r--src/routers/vault/models/vault/account_log.js49
-rw-r--r--src/routers/vault/models/vault/claimed_game_accounts.js22
-rw-r--r--src/routers/vault/models/vault/claimed_legacy_accounts.js22
-rw-r--r--src/routers/vault/models/vault/identity.js36
-rw-r--r--src/routers/vault/models/vault/identity_log.js47
-rw-r--r--src/routers/vault/models/vault/login.js31
-rw-r--r--src/routers/vault/models/vault/login_log.js45
-rw-r--r--src/routers/vault/models/vault/migration_log.js35
13 files changed, 966 insertions, 0 deletions
diff --git a/src/routers/vault/models/evol/char.js b/src/routers/vault/models/evol/char.js
new file mode 100644
index 0000000..b905fde
--- /dev/null
+++ b/src/routers/vault/models/evol/char.js
@@ -0,0 +1,364 @@
+const Sequelize = require("sequelize"); // from npm registry
+
+module.exports = {
+ fields: {
+ charId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ primaryKey: true,
+ allowNull: false,
+ autoIncrement: true,
+ },
+ accountId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ charNum: {
+ type: Sequelize.INTEGER,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ name: { // char name
+ type: Sequelize.STRING(30),
+ allowNull: false,
+ defaultValue: "",
+ },
+ class: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ baseLevel: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 1,
+ },
+ jobLevel: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 1,
+ },
+ baseExp: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ jobExp: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ zeny: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ str: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 1,
+ },
+ agi: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 1,
+ },
+ vit: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 1,
+ },
+ int: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 1,
+ },
+ dex: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 1,
+ },
+ luk: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 1,
+ },
+ maxHp: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ hp: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 1,
+ },
+ maxSp: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ sp: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ statusPoint: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 48,
+ },
+ skillPoint: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ option: {
+ type: Sequelize.INTEGER,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ karma: {
+ type: Sequelize.INTEGER,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ manner: {
+ type: Sequelize.INTEGER,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ partyId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ guildId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ clanId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ petId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ homunId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ elementalId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ hair: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 1,
+ },
+ hairColor: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ clothesColor: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ body: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ weapon: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ shield: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ headTop: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ headMid: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ headBottom: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ robe: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ lastLogin: {
+ type: Sequelize.INTEGER,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ lastMap: {
+ type: Sequelize.STRING(11),
+ allowNull: false,
+ defaultValue: "000-0",
+ },
+ lastX: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 22,
+ },
+ lastY: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 24,
+ },
+ saveMap: {
+ type: Sequelize.STRING(11),
+ allowNull: false,
+ defaultValue: "000-0",
+ },
+ saveX: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 22,
+ },
+ saveY: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 24,
+ },
+ partnerId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ online: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ father: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ mother: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ child: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ fame: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ rename: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ deleteDate: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ slotchange: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ charOpt: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ font: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ unbanTime: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ uniqueitemCounter: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ sex: {
+ type: Sequelize.ENUM("M", "F", "U"),
+ allowNull: false,
+ defaultValue: "U",
+ },
+ hotkeyRowshift: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ hotkeyRowshift2: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ attendanceTimer: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ titleId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ inventorySize: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 100,
+ },
+ },
+ options: {
+ engine: "InnoDB",
+ initialAutoIncrement: 150000,
+ indexes: [
+ {
+ fields: ["name"],
+ unique: true,
+ },
+ {
+ fields: ["account_id"],
+ },
+ {
+ fields: ["party_id"],
+ },
+ {
+ fields: ["guild_id"],
+ },
+ {
+ fields: ["online"],
+ },
+ ]
+ }
+};
diff --git a/src/routers/vault/models/evol/char_reservation.js b/src/routers/vault/models/evol/char_reservation.js
new file mode 100644
index 0000000..f22c960
--- /dev/null
+++ b/src/routers/vault/models/evol/char_reservation.js
@@ -0,0 +1,14 @@
+const Sequelize = require("sequelize"); // from npm registry
+
+module.exports = {
+ fields: {
+ name: { // char name
+ type: Sequelize.STRING(30),
+ primaryKey: true,
+ allowNull: false,
+ },
+ },
+ options: {
+ engine: "InnoDB",
+ }
+};
diff --git a/src/routers/vault/models/evol/login.js b/src/routers/vault/models/evol/login.js
new file mode 100644
index 0000000..be37f07
--- /dev/null
+++ b/src/routers/vault/models/evol/login.js
@@ -0,0 +1,94 @@
+const Sequelize = require("sequelize"); // from npm registry
+
+module.exports = {
+ fields: {
+ accountId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ primaryKey: true,
+ autoIncrement: true,
+ allowNull: false,
+ },
+ userid: { // username
+ type: Sequelize.STRING(23),
+ allowNull: false,
+ defaultValue: "",
+ },
+ userPass: { // plaintext
+ type: Sequelize.STRING(32),
+ allowNull: false,
+ defaultValue: "",
+ },
+ sex: { // NOTE: we must exclude S
+ type: Sequelize.ENUM("M", "F", "S"), // TODO: add N when evol-hercules supports it
+ allowNull: false,
+ defaultValue: "M", // TODO: change to N
+ },
+ email: { // limited email length
+ type: Sequelize.STRING(39),
+ allowNull: false,
+ defaultValue: "",
+ },
+ groupId: {
+ type: Sequelize.INTEGER,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ state: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ unbanTime: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ expirationTime: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ logincount: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ lastlogin: {
+ type: Sequelize.DATE,
+ allowNull: true,
+ },
+ lastIp: {
+ type: Sequelize.STRING(100),
+ allowNull: false,
+ defaultValue: "",
+ },
+ birthdate: {
+ type: Sequelize.DATE,
+ allowNull: true,
+ },
+ characterSlots: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0, // 0 means MAX_CHARS(12)
+ },
+ pincode: {
+ type: Sequelize.STRING(4), // TODO: use this for TOTP
+ allowNull: false,
+ defaultValue: "",
+ },
+ pincodeChange: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ },
+ options: {
+ engine: "InnoDB",
+ initialAutoIncrement: 2000000,
+ indexes: [
+ {
+ fields: ["userid"],
+ }
+ ]
+ }
+};
diff --git a/src/routers/vault/models/legacy/char.js b/src/routers/vault/models/legacy/char.js
new file mode 100644
index 0000000..a13c977
--- /dev/null
+++ b/src/routers/vault/models/legacy/char.js
@@ -0,0 +1,143 @@
+const Sequelize = require("sequelize"); // from npm registry
+
+module.exports = {
+ fields: {
+ charId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ primaryKey: true,
+ allowNull: false,
+ },
+ revoltId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: true,
+ },
+ accountId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ name: { // char name
+ type: Sequelize.STRING(30),
+ allowNull: false,
+ defaultValue: "",
+ },
+ class: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ baseLevel: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 1,
+ },
+ jobLevel: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 1,
+ },
+ baseExp: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ jobExp: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ zeny: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ str: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ agi: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ vit: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ int: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ dex: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ luk: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ statusPoint: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ skillPoint: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ partyId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ partyIsleader: { // single BIT
+ type: Sequelize.BOOLEAN,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ hair: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ hairColor: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ partnerId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ sex: { // NOTE: we must exclude S
+ type: Sequelize.ENUM("M", "F", "N", "S"),
+ allowNull: false,
+ defaultValue: "N",
+ },
+ },
+ options: {
+ indexes: [
+ {
+ fields: ["revolt_id"],
+ unique: true,
+ },
+ {
+ fields: ["name"],
+ unique: true,
+ },
+ {
+ fields: ["account_id"],
+ },
+ {
+ fields: ["party_id"],
+ }
+ ]
+ }
+};
diff --git a/src/routers/vault/models/legacy/login.js b/src/routers/vault/models/legacy/login.js
new file mode 100644
index 0000000..12e17b9
--- /dev/null
+++ b/src/routers/vault/models/legacy/login.js
@@ -0,0 +1,64 @@
+const Sequelize = require("sequelize"); // from npm registry
+
+module.exports = {
+ fields: {
+ accountId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ primaryKey: true,
+ allowNull: false,
+ },
+ revoltId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: true,
+ },
+ userid: { // username
+ type: Sequelize.STRING(23),
+ allowNull: false,
+ defaultValue: "",
+ },
+ userPass: { // weak athena hashing
+ type: Sequelize.STRING(32),
+ allowNull: false,
+ defaultValue: "",
+ },
+ lastlogin: {
+ type: Sequelize.DATE,
+ allowNull: true,
+ },
+ logincount: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ state: { // ideally this should've been an enum, but whatever
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ email: { // tmwa has a very limited email length
+ type: Sequelize.STRING(39),
+ allowNull: true,
+ },
+ lastIp: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ unbanTime: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ defaultValue: 0,
+ },
+ },
+ options: {
+ indexes: [
+ {
+ fields: ["revolt_id"],
+ unique: true,
+ },
+ {
+ fields: ["userid"],
+ }
+ ]
+ }
+};
diff --git a/src/routers/vault/models/vault/account_log.js b/src/routers/vault/models/vault/account_log.js
new file mode 100644
index 0000000..1f8b05b
--- /dev/null
+++ b/src/routers/vault/models/vault/account_log.js
@@ -0,0 +1,49 @@
+const Sequelize = require("sequelize"); // from npm registry
+
+module.exports = {
+ fields: {
+ id: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ primaryKey: true,
+ autoIncrement: true,
+ allowNull: false,
+ },
+ vaultId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ },
+ accountType: {
+ type: Sequelize.ENUM("EVOL", "LEGACY", "FORUMS", "WIKI"),
+ allowNull: false,
+ },
+ accountId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ },
+ actionType: {
+ type: Sequelize.ENUM("CREATE", "DELETE", "LINK", "UNLINK", "UPDATE"),
+ allowNull: false,
+ defaultValue: "CREATE",
+ },
+ details: {
+ type: Sequelize.STRING,
+ allowNull: true,
+ },
+ ip: {
+ type: "VARBINARY(16)",
+ allowNull: false,
+ },
+ date: {
+ type: Sequelize.DATE,
+ allowNull: false,
+ defaultValue: Sequelize.NOW,
+ },
+ },
+ options: {
+ indexes: [
+ { fields: ["vault_id"] },
+ { fields: ["account_id"] },
+ { fields: ["ip"] },
+ ]
+ }
+};
diff --git a/src/routers/vault/models/vault/claimed_game_accounts.js b/src/routers/vault/models/vault/claimed_game_accounts.js
new file mode 100644
index 0000000..743376d
--- /dev/null
+++ b/src/routers/vault/models/vault/claimed_game_accounts.js
@@ -0,0 +1,22 @@
+const Sequelize = require("sequelize"); // from npm registry
+
+module.exports = {
+ fields: {
+ accountId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ primaryKey: true,
+ },
+ vaultId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ },
+ },
+ options: {
+ indexes: [
+ {
+ fields: ["vault_id"], // BUG: {underscored: true} does not work on indexes
+ },
+ ]
+ }
+};
diff --git a/src/routers/vault/models/vault/claimed_legacy_accounts.js b/src/routers/vault/models/vault/claimed_legacy_accounts.js
new file mode 100644
index 0000000..743376d
--- /dev/null
+++ b/src/routers/vault/models/vault/claimed_legacy_accounts.js
@@ -0,0 +1,22 @@
+const Sequelize = require("sequelize"); // from npm registry
+
+module.exports = {
+ fields: {
+ accountId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ primaryKey: true,
+ },
+ vaultId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ },
+ },
+ options: {
+ indexes: [
+ {
+ fields: ["vault_id"], // BUG: {underscored: true} does not work on indexes
+ },
+ ]
+ }
+};
diff --git a/src/routers/vault/models/vault/identity.js b/src/routers/vault/models/vault/identity.js
new file mode 100644
index 0000000..e10970f
--- /dev/null
+++ b/src/routers/vault/models/vault/identity.js
@@ -0,0 +1,36 @@
+const Sequelize = require("sequelize"); // from npm registry
+
+module.exports = {
+ fields: {
+ id: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ primaryKey: true,
+ autoIncrement: true,
+ allowNull: false,
+ },
+ userId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ },
+ email: {
+ type: Sequelize.STRING(320),
+ allowNull: false,
+ },
+ addedDate: {
+ type: Sequelize.DATE,
+ allowNull: false,
+ defaultValue: Sequelize.NOW,
+ },
+ },
+ options: {
+ indexes: [
+ {
+ fields: ["user_id"], // BUG: table option {underscored: true} does not work on indexes
+ },
+ {
+ fields: ["email"],
+ unique: true,
+ }
+ ]
+ }
+};
diff --git a/src/routers/vault/models/vault/identity_log.js b/src/routers/vault/models/vault/identity_log.js
new file mode 100644
index 0000000..4e881f1
--- /dev/null
+++ b/src/routers/vault/models/vault/identity_log.js
@@ -0,0 +1,47 @@
+const Sequelize = require("sequelize"); // from npm registry
+
+module.exports = {
+ fields: {
+ id: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ primaryKey: true,
+ autoIncrement: true,
+ allowNull: false,
+ },
+ userId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ },
+ identityId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ },
+ action: {
+ type: Sequelize.ENUM("ADD", "REMOVE"),
+ allowNull: false,
+ defaultValue: "ADD",
+ },
+ ip: {
+ type: "VARBINARY(16)",
+ allowNull: false,
+ },
+ date: {
+ type: Sequelize.DATE,
+ allowNull: false,
+ defaultValue: Sequelize.NOW,
+ },
+ },
+ options: {
+ indexes: [
+ {
+ fields: ["user_id"], // BUG: {underscored: true} does not work on indexes
+ },
+ {
+ fields: ["identity_id"], // BUG: {underscored: true} does not work on indexes
+ },
+ {
+ fields: ["ip"],
+ }
+ ]
+ }
+};
diff --git a/src/routers/vault/models/vault/login.js b/src/routers/vault/models/vault/login.js
new file mode 100644
index 0000000..1c9c51e
--- /dev/null
+++ b/src/routers/vault/models/vault/login.js
@@ -0,0 +1,31 @@
+const Sequelize = require("sequelize"); // from npm registry
+
+module.exports = {
+ fields: {
+ id: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ primaryKey: true,
+ autoIncrement: true,
+ allowNull: false,
+ },
+ primaryIdentity: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: true,
+ },
+ allowNonPrimary: {
+ type: Sequelize.BOOLEAN,
+ defaultValue: true,
+ allowNull: false,
+ },
+ creationDate: {
+ type: Sequelize.DATE,
+ allowNull: false,
+ defaultValue: Sequelize.NOW,
+ },
+ state: {
+ type: Sequelize.ENUM("OK", "BANNED"),
+ allowNull: false,
+ defaultValue: "OK",
+ },
+ }
+};
diff --git a/src/routers/vault/models/vault/login_log.js b/src/routers/vault/models/vault/login_log.js
new file mode 100644
index 0000000..5f42469
--- /dev/null
+++ b/src/routers/vault/models/vault/login_log.js
@@ -0,0 +1,45 @@
+const Sequelize = require("sequelize"); // from npm registry
+
+// NOTE: to get the ip, use something like
+// select *, INET6_NTOA(ip) as ip_ from vault.login_log;
+// and to search by ip use something like
+// select * from vault.login_log where ip = INET6_ATON("ip addr");
+
+module.exports = {
+ fields: {
+ id: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ primaryKey: true,
+ autoIncrement: true,
+ allowNull: false,
+ },
+ userId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ },
+ action: {
+ type: Sequelize.ENUM("LOGIN", "LOGOUT", "CREATE"),
+ allowNull: false,
+ defaultValue: "LOGIN",
+ },
+ ip: {
+ type: "VARBINARY(16)",
+ allowNull: false,
+ },
+ date: {
+ type: Sequelize.DATE,
+ allowNull: false,
+ defaultValue: Sequelize.NOW,
+ },
+ },
+ options: {
+ indexes: [
+ {
+ fields: ["user_id"], // BUG: {underscored: true} does not work on indexes
+ },
+ {
+ fields: ["ip"],
+ }
+ ]
+ }
+};
diff --git a/src/routers/vault/models/vault/migration_log.js b/src/routers/vault/models/vault/migration_log.js
new file mode 100644
index 0000000..5b2e651
--- /dev/null
+++ b/src/routers/vault/models/vault/migration_log.js
@@ -0,0 +1,35 @@
+const Sequelize = require("sequelize"); // from npm registry
+
+module.exports = {
+ fields: {
+ legacyId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ primaryKey: true,
+ allowNull: false,
+ },
+ accountId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ },
+ vaultId: {
+ type: Sequelize.INTEGER.UNSIGNED,
+ allowNull: false,
+ },
+ ip: {
+ type: "VARBINARY(16)",
+ allowNull: false,
+ },
+ date: {
+ type: Sequelize.DATE,
+ allowNull: false,
+ defaultValue: Sequelize.NOW,
+ },
+ },
+ options: {
+ indexes: [
+ { fields: ["vault_id"] },
+ { fields: ["account_id"] },
+ { fields: ["ip"] },
+ ]
+ }
+};