Lambda-School-Labs/Labs26-StorySquad-BE-TeamB

View on GitHub
data/migrations/20200914121455_child_updates.js

Summary

Maintainability
A
0 mins
Test Coverage
exports.up = function (knex) {
  return knex.schema
    .createTable('GradeLevels', (t) => {
      t.increments('ID');
      t.string('GradeLevel').notNullable().unique();
    })
    .table('Children', (t) => {
      t.integer('GradeLevelID')
        .notNullable()
        .unsigned()
        .references('GradeLevels.ID')
        .onUpdate('CASCADE')
        .onDelete('RESTRICT');
      t.boolean('IsDyslexic').notNullable();
    });
};

exports.down = function (knex) {
  return knex.schema
    .table('Children', (t) => {
      t.dropColumn('IsDyslexic');
      t.dropColumn('GradeLevelID');
    })
    .dropTableIfExists('GradeLevels');
};