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

View on GitHub
data/migrations/20201012103144_gamification-2.js

Summary

Maintainability
A
0 mins
Test Coverage
exports.up = function (knex) {
  return knex.schema.createTable('Points', (t) => {
    t.increments('ID');
    t.integer('WritingPoints');
    t.integer('DrawingPoints');
    t.integer('MemberID')
      .notNullable()
      .unsigned()
      .references('Members.ID')
      .onUpdate('CASCADE')
      .onDelete('RESTRICT');
    t.integer('SubmissionID')
      .notNullable()
      .unsigned()
      .references('Submissions.ID')
      .onUpdate('CASCADE')
      .onDelete('RESTRICT');
    t.unique(['MemberID', 'SubmissionID']);
  });
};

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