aboutsummaryrefslogtreecommitdiffstats
path: root/db/normalized/waiting_list.js
pre { line-height: 125%; } td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888 } /* Comment */ .highlight .err { color: #A61717; background-color: #E3D2D2 } /* Error */ .highlight .k { color: #080; font-weight: bold } /* Keyword */ .highlight .ch { color: #888 } /* Comment.Hashbang */ .highlight .cm { color: #888 } /* Comment.Multiline */ .highlight .cp { color: #C00; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888 } /* Comment.Single */ .highlight .cs { color: #C00; font-weight: bold; background-color: #FFF0F0 } /* Comment.Special */ .highlight .gd { color: #000; background-color: #FDD } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #A00 } /* Generic.Error */ .highlight .gh { color: #333 } /* Generic.Heading */ .highlight .gi { color: #000; background-color: #DFD } /* Generic.Inserted */ .highlight .go { color: #888 } /* Generic.Output */ .highlight .gp { color: #555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666 } /* Generic.Subheading */ .highlight .gt { color: #A00 } /* Generic.Traceback */ .highlight .kc { color: #080; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #080; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #080; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #080 } /* Keyword.Pseudo */ .highlight .kr { color: #080; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #00D; font-weight: bold } /* Literal.Number */ .highlight .s { color: #D20; background
export const up = function(knex) {
  return knex.schema.createTable('waiting_list', function(t) {
    t.increments('id').unsigned().primary();

    t.string('email').notNull();
    t.string('phone').notNull();
    t.enu('status', ['pending', 'activated', 'expired', 'cancelled']).notNull();
  
    t.timestamps();
  })
};

export const down = function(knex) {
  return knex.schema.dropTable('waiting_list');
};

// const { DataTypes } = require('@sequelize/core');

// 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);