-
Notifications
You must be signed in to change notification settings - Fork 0
DB 설정 및 model 정의 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Jiwon-Yang
wants to merge
3
commits into
master
Choose a base branch
from
feature/settingDB
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| module.exports = function(sequelize, DataTypes) { | ||
| return sequelize.define( | ||
| 'matchingLog', | ||
| { | ||
| id: { | ||
| type: DataTypes.INTEGER(11), | ||
| allowNull: false, | ||
| primaryKey: true, | ||
| autoIncrement: true | ||
| }, | ||
| womanTeam: { | ||
| type: DataTypes.STRING(100), | ||
| allowNull: false | ||
| }, | ||
| manTeam: { | ||
| type: DataTypes.STRING(100), | ||
| allowNull: false | ||
| }, | ||
| matchedAt: { | ||
| type: DataTypes.DATE, | ||
| allowNull: false | ||
| } | ||
| }, | ||
| { | ||
| tableName: 'matchingLog' | ||
| } | ||
| ) | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| module.exports = function(sequelize, DataTypes) { | ||
| return sequelize.define( | ||
| 'report', | ||
| { | ||
| id: { | ||
| type: DataTypes.INTEGER(11), | ||
| allowNull: false, | ||
| primaryKey: true, | ||
| autoIncrement: true | ||
| }, | ||
| type: { | ||
| type: DataTypes.STRING(45), | ||
| allowNull: false | ||
| }, | ||
| matchingLog: { | ||
| type: DataTypes.INTEGER(11), | ||
| allowNull: false, | ||
| references: { | ||
| model: 'matchingLog', | ||
| key: 'id' | ||
| } | ||
| }, | ||
| target: { | ||
| type: DataTypes.INTEGER(11), | ||
| allowNull: false, | ||
| references: { | ||
| model: 'user', | ||
| key: 'id' | ||
| } | ||
| }, | ||
| author: { | ||
| type: DataTypes.INTEGER(11), | ||
| allowNull: false, | ||
| references: { | ||
| model: 'user', | ||
| key: 'id' | ||
| } | ||
| }, | ||
| content: { | ||
| type: DataTypes.STRING(45), | ||
| allowNull: false | ||
| }, | ||
| image: { | ||
| type: DataTypes.STRING(200), | ||
| allowNull: false | ||
| } | ||
| }, | ||
| { | ||
| tableName: 'report' | ||
| } | ||
| ) | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| module.exports = function(sequelize, DataTypes) { | ||
| return sequelize.define( | ||
| 'team', | ||
| { | ||
| id: { | ||
| type: DataTypes.INTEGER(11), | ||
| allowNull: false, | ||
| primaryKey: true, | ||
| autoIncrement: true | ||
| }, | ||
| teamCode: { | ||
| type: DataTypes.STRING(20), | ||
| allowNull: false | ||
| }, | ||
| gender: { | ||
| type: DataTypes.STRING(45), | ||
| allowNull: false | ||
| }, | ||
| matchedTeam: { | ||
| type: DataTypes.INTEGER(11), | ||
| allowNull: true, | ||
| references: { | ||
| model: 'team', | ||
| key: 'id' | ||
| } | ||
| }, | ||
| memberIds: { | ||
| type: DataTypes.STRING(100), | ||
| allowNull: false | ||
| }, | ||
| isMatching: { | ||
| type: DataTypes.BOOLEAN, | ||
| allowNull: false, | ||
| defaultValue: '0' | ||
| }, | ||
| teamType: { | ||
| type: DataTypes.INTEGER(4), | ||
| allowNull: false | ||
| }, | ||
| preferAge: { | ||
| type: DataTypes.STRING(20), | ||
| allowNull: false | ||
| }, | ||
| preferSmoking: { | ||
| type: DataTypes.BOOLEAN, | ||
| allowNull: false | ||
| }, | ||
| preferReligion: { | ||
| type: DataTypes.STRING(100), | ||
| allowNull: false | ||
| }, | ||
| preferBodyType: { | ||
| type: DataTypes.STRING(20), | ||
| allowNull: false | ||
| }, | ||
| preferHeight: { | ||
| type: DataTypes.STRING(10), | ||
| allowNull: false | ||
| }, | ||
| excludeMajor: { | ||
| type: DataTypes.STRING(100), | ||
| allowNull: false | ||
| } | ||
| }, | ||
| { | ||
| tableName: 'team' | ||
| } | ||
| ) | ||
| } | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| module.exports = function(sequelize, DataTypes) { | ||
| return sequelize.define( | ||
| 'user', | ||
| { | ||
| id: { | ||
| type: DataTypes.INTEGER(11), | ||
| allowNull: false, | ||
| primaryKey: true, | ||
| autoIncrement: true | ||
| }, | ||
| weehanId: { | ||
| type: DataTypes.STRING(45), | ||
| allowNull: false, | ||
| unique: true | ||
| }, | ||
| gender: { | ||
| type: DataTypes.ENUM('f', 'm'), | ||
| allowNull: false | ||
| }, | ||
| birth: { | ||
| type: DataTypes.INTEGER(4), | ||
| allowNull: false | ||
| }, | ||
| email: { | ||
| type: DataTypes.STRING(100), | ||
| allowNull: false | ||
| }, | ||
| kakaoId: { | ||
| type: DataTypes.STRING(45), | ||
| allowNull: false, | ||
| unique: true | ||
| }, | ||
| height: { | ||
| type: DataTypes.INTEGER(3), | ||
| allowNull: false | ||
| }, | ||
| bodyType: { | ||
| type: DataTypes.ENUM('light', 'middle', 'heavy'), | ||
| allowNull: false | ||
| }, | ||
| smoking: { | ||
| type: DataTypes.BOOLEAN, | ||
| allowNull: false | ||
| }, | ||
| major: { | ||
| type: DataTypes.ENUM( | ||
| '국어국문학과', | ||
| '중어중문학과', | ||
| '영어영문학과', | ||
| '독어독문학과', | ||
| '사학과', | ||
| '철학과', | ||
| '경제금융학과', | ||
| '경영학부', | ||
| '파이낸스경영학과', | ||
| '의류학과', | ||
| '식품영양학과', | ||
| '실내건축디자인학과', | ||
| '교육학과', | ||
| '교육공학과', | ||
| '국어교육과', | ||
| '영어교육과', | ||
| '수학교육과', | ||
| '응용미술교육과', | ||
| '성악과', | ||
| '작곡과', | ||
| '피아노과', | ||
| '관현악과', | ||
| '국악과', | ||
| '체육학과', | ||
| '스포스산업학과', | ||
| '연극영화학과', | ||
| '무용학과', | ||
| '국제학부', | ||
| '간호학부', | ||
| '산업융합학부', | ||
| '관광학부', | ||
| '미디어커뮤니케이션학과', | ||
| '사회학과', | ||
| '정치외교학과', | ||
| '의과대학', | ||
| '수학과', | ||
| '화학과', | ||
| '물리학과', | ||
| '생명과학과', | ||
| '행정학과', | ||
| '정책학과', | ||
| '건축학부', | ||
| '건축공학부', | ||
| '건설환경공학과', | ||
| '도시공학과', | ||
| '자원환경공학과', | ||
| '융합전자공학부', | ||
| '전기생체공학부', | ||
| '신소재공학부', | ||
| '화학공학과', | ||
| '생명공학과', | ||
| '유기나노공학과', | ||
| '에너지공학과', | ||
| '기계공학부', | ||
| '원자력공학과', | ||
| '산업공학과', | ||
| '미래자동차공학과', | ||
| '컴퓨터소프트웨어학부', | ||
| '정보시스템학과' | ||
| ), | ||
| allowNull: false | ||
| }, | ||
| religion: { | ||
| type: DataTypes.ENUM( | ||
| '기독교', | ||
| '천주교', | ||
| '불교', | ||
| '원불교', | ||
| '이슬람교', | ||
| '기타', | ||
| '종교없음' | ||
| ), | ||
| allowNull: false | ||
| }, | ||
| team: { | ||
| type: DataTypes.INTEGER(11), | ||
| allowNull: true, | ||
| references: { | ||
| model: 'team', | ||
| key: 'id' | ||
| } | ||
| }, | ||
| isActivate: { | ||
| type: DataTypes.INTEGER(4), | ||
| allowNull: false | ||
| }, | ||
| warning: { | ||
| type: DataTypes.STRING(100), | ||
| allowNull: true | ||
| } | ||
|
Comment on lines
+133
to
+136
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. report과 N:M 관계입니다. 다만 여기가 manTeam과 관계가 걸리는 건지, womanTeam과 관계가 걸리는 건지에 따라 reference가 달라져야 할 텐데 이 부분을 어떻게 해야 할지?.. 가장 간단하게는 warningForMan, warningForWoman으로 띡 나눠버리면 될 것 같긴 한데, 다른 방법이 있는지는 잘 모르겠네요 |
||
| }, | ||
| { | ||
| tableName: 'user' | ||
| } | ||
| ) | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Jiwon-Yang 1:N 릴레이션에서 N에 해당해야 하는 필드입니다. 릴레이션으로 수정해주세요