summaryrefslogtreecommitdiff
path: root/src/routers/vault/models/vault/identity_log.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/routers/vault/models/vault/identity_log.js')
-rw-r--r--src/routers/vault/models/vault/identity_log.js47
1 files changed, 47 insertions, 0 deletions
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"],
+ }
+ ]
+ }
+};