aboutsummaryrefslogtreecommitdiffstats
path: root/db/normalized/user_subscriptions.js
diff options
context:
space:
mode:
authorRan Guin <[email protected]>2021-05-11 18:28:25 -0700
committerAdam Soltys <[email protected]>2021-06-04 22:37:02 -0700
commit2e18dc7a532d07d6e53581e5076c7d61a45d6d65 (patch)
treeb6bbd72253c806af56d3640f9e97414f6f4cba19 /db/normalized/user_subscriptions.js
parent421accbfbc0a1add93f7704e657ae93f2d836b82 (diff)
downloadcoinos-server-2e18dc7a532d07d6e53581e5076c7d61a45d6d65.tar.gz
coinos-server-2e18dc7a532d07d6e53581e5076c7d61a45d6d65.zip
add first draft of normalized schema
Diffstat (limited to 'db/normalized/user_subscriptions.js')
-rw-r--r--db/normalized/user_subscriptions.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/db/normalized/user_subscriptions.js b/db/normalized/user_subscriptions.js
new file mode 100644
index 00000000..ba18d7c6
--- /dev/null
+++ b/db/normalized/user_subscriptions.js
@@ -0,0 +1,28 @@
+const { DataTypes } = require('sequelize');
+
+const attributes = {
+ id: {
+ type: DataTypes.INTEGER(11),
+ primaryKey: true,
+ autoIncrement: true,
+ allowNull: false
+ },
+ user_id: {
+ type: DataTypes.INTEGER(11),
+ references: { model: User, key: 'id' },
+ allowNull: false,
+ comment: "Referral granted to this user (updated when token used)"
+ },
+}
+const options = {
+ tableName: "users",
+ comment: "",
+ timestamps: true,
+ createdAt: 'created_at',
+ updatedAt: 'updated_at',
+ indexes: [
+ {fields: ['uuid', 'email']}
+ ]
+};
+
+db["User"] = db.define("users_model", attributes, options);