Skip to content

Commit

Permalink
Return from migrations, remove granteeId from index
Browse files Browse the repository at this point in the history
Renamed migrations to ensure they are ran
  • Loading branch information
jasalisbury committed Mar 11, 2021
1 parent e96c77d commit f9914ca
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 94 deletions.
9 changes: 0 additions & 9 deletions src/migrations/20210305172128-add-grant-goal-unique-index.js

This file was deleted.

43 changes: 0 additions & 43 deletions src/migrations/20210305181116-create-objectives.js

This file was deleted.

42 changes: 0 additions & 42 deletions src/migrations/20210305181122-create-activity-report-objectives.js

This file was deleted.

5 changes: 5 additions & 0 deletions src/migrations/20210310172128-add-grant-goal-unique-index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
up: async (queryInterface) => queryInterface.addIndex('GrantGoals', ['grantId', 'goalId'], { unique: true }),

down: async (queryInterface) => queryInterface.removeIndex('GrantGoals', ['grantId', 'goalId']),
};
41 changes: 41 additions & 0 deletions src/migrations/20210310181116-create-objectives.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module.exports = {
up: async (queryInterface, Sequelize) => queryInterface.createTable('Objectives', {
id: {
type: Sequelize.INTEGER,
allowNull: false,
primaryKey: true,
autoIncrement: true,
},
goalId: {
type: Sequelize.INTEGER,
allowNull: false,
references: {
model: {
tableName: 'Goals',
},
key: 'id',
},
},
title: {
type: Sequelize.TEXT,
},
ttaProvided: {
type: Sequelize.TEXT,
},
status: {
type: Sequelize.STRING,
},
createdAt: {
allowNull: false,
type: Sequelize.DATE,
defaultValue: Sequelize.fn('NOW'),
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE,
defaultValue: Sequelize.fn('NOW'),
},
}),

down: (queryInterface) => queryInterface.dropTable('Objectives'),
};
40 changes: 40 additions & 0 deletions src/migrations/20210310181122-create-activity-report-objectives.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module.exports = {
up: async (queryInterface, Sequelize) => queryInterface.createTable('ActivityReportObjectives', {
id: {
type: Sequelize.INTEGER,
allowNull: false,
primaryKey: true,
autoIncrement: true,
},
activityReportId: {
type: Sequelize.INTEGER,
allowNull: false,
references: {
model: {
tableName: 'ActivityReports',
},
},
},
objectiveId: {
type: Sequelize.INTEGER,
allowNull: false,
references: {
model: {
tableName: 'Objectives',
},
},
},
createdAt: {
allowNull: false,
type: Sequelize.DATE,
defaultValue: Sequelize.fn('NOW'),
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE,
defaultValue: Sequelize.fn('NOW'),
},
}),

down: (queryInterface) => queryInterface.dropTable('ActivityReportObjectives'),
};

0 comments on commit f9914ca

Please sign in to comment.