forked from junbyeol/kaist-ua-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/kaistusc/kaist-ua-server …
…into develop
- Loading branch information
Showing
45 changed files
with
805 additions
and
462 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
require("dotenv").config(); | ||
require('dotenv').config(); | ||
|
||
module.exports = { | ||
development: { | ||
username: process.env.USERNAME, | ||
password: process.env.PASSWORD, | ||
database: process.env.DATABASE, | ||
host: process.env.HOST, | ||
dialect: "mysql", | ||
dialect: 'mysql', | ||
operatorsAliases: 0, | ||
}, | ||
test: { | ||
username: process.env.USERNAME, | ||
password: process.env.PASSWORD, | ||
database: process.env.DATABASE, | ||
host: process.env.HOST, | ||
dialect: "mysql", | ||
dialect: 'mysql', | ||
operatorsAliases: 0, | ||
}, | ||
production: { | ||
username: process.env.USERNAME, | ||
password: process.env.PASSWORD, | ||
database: process.env.DATABASE, | ||
host: process.env.HOST, | ||
dialect: "mysql", | ||
dialect: 'mysql', | ||
operatorsAliases: 0, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
142 changes: 71 additions & 71 deletions
142
src/database/migrations/20200827230222-create-associations.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,76 @@ | ||
"use strict"; | ||
|
||
module.exports = { | ||
up: async (queryInterface, Sequelize) => { | ||
// Board hasMany Post | ||
return queryInterface | ||
.addColumn( | ||
"Post", // name of Source model | ||
"BoardId", // name of the key we're adding | ||
{ | ||
type: Sequelize.INTEGER, | ||
references: { | ||
model: "Board", // name of Target model | ||
key: "id", // key in Target model that we're referencing | ||
}, | ||
onUpdate: "CASCADE", | ||
onDelete: "SET NULL", | ||
} | ||
) | ||
.then(() => { | ||
// Student hasMany CancelRequest | ||
return queryInterface.addColumn( | ||
"CancelRequest", // name of Target model | ||
"studentNumber", // name of the key we're adding | ||
{ | ||
type: Sequelize.INTEGER, | ||
references: { | ||
model: "Student", // name of Source model | ||
key: "studentNumber", | ||
}, | ||
onUpdate: "CASCADE", | ||
onDelete: "CASCADE", | ||
} | ||
); | ||
}) | ||
.then(() => { | ||
// Student hasMany Payment | ||
return queryInterface.addColumn( | ||
"Payment", // name of Target model | ||
"StudentId", // name of the key we're adding | ||
{ | ||
type: Sequelize.UUID, | ||
references: { | ||
model: "Student", // name of Source model | ||
key: "id", | ||
}, | ||
onUpdate: "CASCADE", | ||
onDelete: "SET NULL", | ||
} | ||
); | ||
}); | ||
}, | ||
up: async (queryInterface, Sequelize) => { | ||
// Board hasMany Post | ||
return queryInterface | ||
.addColumn( | ||
"Post", // name of Source model | ||
"BoardId", // name of the key we're adding | ||
{ | ||
type: Sequelize.INTEGER, | ||
references: { | ||
model: "Board", // name of Target model | ||
key: "id", // key in Target model that we're referencing | ||
}, | ||
onUpdate: "CASCADE", | ||
onDelete: "SET NULL", | ||
} | ||
) | ||
.then(() => { | ||
// Student hasMany CancelRequest | ||
return queryInterface.addColumn( | ||
"CancelRequest", // name of Target model | ||
"studentNumber", // name of the key we're adding | ||
{ | ||
type: Sequelize.INTEGER, | ||
references: { | ||
model: "Student", // name of Source model | ||
key: "studentNumber", | ||
}, | ||
onUpdate: "CASCADE", | ||
onDelete: "CASCADE", | ||
} | ||
); | ||
}) | ||
.then(() => { | ||
// Student hasMany Payment | ||
return queryInterface.addColumn( | ||
"Payment", // name of Target model | ||
"StudentId", // name of the key we're adding | ||
{ | ||
type: Sequelize.UUID, | ||
references: { | ||
model: "Student", // name of Source model | ||
key: "id", | ||
}, | ||
onUpdate: "CASCADE", | ||
onDelete: "SET NULL", | ||
} | ||
); | ||
}); | ||
}, | ||
|
||
down: async (queryInterface, Sequelize) => { | ||
// remove Board hasMany Post | ||
return queryInterface | ||
.removeColumn( | ||
"Post", // name of Source model | ||
"BoardId" // key we want to remove | ||
) | ||
.then(() => { | ||
// remove Student hasMany CancelRequest | ||
return queryInterface.removeColumn( | ||
"CancelRequest", // name of the Target model | ||
"studentNumber" // key we want to remove | ||
); | ||
}) | ||
.then(() => { | ||
// remove Student hasMany Payment | ||
return queryInterface.removeColumn( | ||
"Payment", // name of the Target model | ||
"StudentId" // key we want to remove | ||
); | ||
}); | ||
}, | ||
down: async (queryInterface, Sequelize) => { | ||
// remove Board hasMany Post | ||
return queryInterface | ||
.removeColumn( | ||
"Post", // name of Source model | ||
"BoardId" // key we want to remove | ||
) | ||
.then(() => { | ||
// remove Student hasMany CancelRequest | ||
return queryInterface.removeColumn( | ||
"CancelRequest", // name of the Target model | ||
"studentNumber" // key we want to remove | ||
); | ||
}) | ||
.then(() => { | ||
// remove Student hasMany Payment | ||
return queryInterface.removeColumn( | ||
"Payment", // name of the Target model | ||
"StudentId" // key we want to remove | ||
); | ||
}); | ||
}, | ||
}; |
Oops, something went wrong.