Lambda-School-Labs/allay-be

View on GitHub
data/migrations/20200312145927_users_table.js

Summary

Maintainability
A
1 hr
Test Coverage
exports.up = function (knex) {
  return knex.schema.createTable('users', tbl => {
    tbl.increments();
    tbl.string('username', 128).notNullable().unique();
    tbl.string('email', 128).notNullable().unique();
    tbl.string('password');
    tbl
      .integer('track_id')
      .unsigned()
      .notNullable()
      .references('id')
      .inTable('tracks')
      .onUpdate('CASCADE')
      .onDelete('CASCADE');
  });
};

exports.down = function (knex) {
  return knex.schema.dropTableIfExists('users');
};