aboutsummaryrefslogtreecommitdiffstats
path: root/db/normalized/waiting_list.js
diff options
context:
space:
mode:
authorRan Guin <[email protected]>2021-07-14 18:00:30 -0700
committerRan Guin <[email protected]>2021-07-14 18:00:30 -0700
commit4eacfda951f8275ac4f3a1283368884e53285ed0 (patch)
tree149e15bc2292b65756dff6323cb3778c9dc89f54 /db/normalized/waiting_list.js
parent826da4a8f7d791b06bb53346597ab0ed51b6362e (diff)
downloadcoinos-server-4eacfda951f8275ac4f3a1283368884e53285ed0.tar.gz
coinos-server-4eacfda951f8275ac4f3a1283368884e53285ed0.zip
update normalized models
Diffstat (limited to 'db/normalized/waiting_list.js')
-rw-r--r--db/normalized/waiting_list.js94
1 files changed, 55 insertions, 39 deletions
diff --git a/db/normalized/waiting_list.js b/db/normalized/waiting_list.js
index 8803066b..42ec57a7 100644
--- a/db/normalized/waiting_list.js
+++ b/db/normalized/waiting_list.js
@@ -1,44 +1,60 @@
-const { DataTypes } = require('sequelize');
+exports.up = function(knex) {
+ return knex.schema.createTable('waiting_list', function(t) {
+ t.increments('id').unsigned().primary();
-const attributes = {
- id: {
- type: DataTypes.INTEGER(11),
- primaryKey: true,
- autoIncrement: true,
- allowNull: false
- },
- email: {
- type: DataTypes.STRING(255),
- validate: {
- isEmail: true
- }
- },
- sms: {
- type: DataTypes.STRING(255),
- validate: {
- is: /^[0-9]+$/ // replace spaces, brackets, dashes dynamically prior to create
- }
- },
- status: {
- type: DataTypes.ENUM,
- values: ['pending', 'activated', 'expired', 'cancelled'],
- defaultValue: 'pending',
- allowNull: false
- }
+ t.string('email').notNull();
+ t.string('phone').notNull();
+ t.enu('status', ['pending', 'activated', 'expired', 'cancelled']).notNull();
+
+ t.timestamps();
+ })
}
-const options = {
- tableName: "waiting_list",
- comment: "Users on waiting list",
- timestamps: true,
- createdAt: 'created_at',
- updatedAt: 'updated_at',
- indexes: [
- {
- unique: true,
- fields: ['email', 'sms']
- }
- ]
+exports.down = function(knex) {
+ return knex.schema.dropTable('waiting_list');
};
-db["WaitingList"] = db.define("waiting_list_model", attributes, options);
+// const { DataTypes } = require('sequelize');
+
+// const attributes = {
+// id: {
+// type: DataTypes.INTEGER(11),
+// primaryKey: true,
+// autoIncrement: true,
+// allowNull: false
+// },
+// email: {
+// type: DataTypes.STRING(255),
+// validate: {
+// isEmail: true
+// }
+// },
+// sms: {
+// type: DataTypes.STRING(255),
+// validate: {
+// is: /^[0-9]+$/ // replace spaces, brackets, dashes dynamically prior to create
+// }
+// },
+// status: {
+// type: DataTypes.ENUM,
+// values: ['pending', 'activated', 'expired', 'cancelled'],
+// defaultValue: 'pending',
+// allowNull: false
+// }
+// }
+
+// const options = {
+// tableName: "waiting_list",
+// comment: "Users on waiting list",
+// timestamps: true,
+// createdAt: 'created_at',
+// updatedAt: 'updated_at',
+// indexes: [
+// {
+// unique: true,
+// fields: ['email', 'sms']
+// }
+// ]
+// };
+
+// db["WaitingList"] = db.define("waiting_list_model", attributes, options);