-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lx 301 backsearch feedback backend (#53)
Thanks @rogup for advice, @lin-d-hop everything resolve bar unit tests.
- Loading branch information
Showing
6 changed files
with
1,155 additions
and
656 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"use strict"; | ||
|
||
module.exports = { | ||
async up(queryInterface, Sequelize) { | ||
await queryInterface.sequelize.query( | ||
`CREATE TABLE user_feedback ( | ||
id bigint NOT NULL AUTO_INCREMENT, | ||
question_use_case text, | ||
question_impact text, | ||
question_who_benefits text, | ||
question_improvements text, | ||
user_id bigint DEFAULT NULL, | ||
submission_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
PRIMARY KEY (id), | ||
KEY user_id (user_id), | ||
CONSTRAINT user_feedback_user FOREIGN KEY (user_id) REFERENCES user (id) | ||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1` | ||
); | ||
}, | ||
async down(queryInterface, Sequelize) { | ||
await queryInterface.dropTable("user_feedback"); | ||
}, | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"use strict"; | ||
|
||
const { faker } = require("@faker-js/faker"); | ||
|
||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface.bulkInsert("user_feedback", [ | ||
{ | ||
question_use_case: faker.lorem.paragraph(), | ||
question_impact: faker.lorem.paragraph(), | ||
question_who_benefits: faker.lorem.paragraph(), | ||
question_improvements: faker.lorem.paragraph(), | ||
feedback_user_id: 1, | ||
}, | ||
]); | ||
}, | ||
|
||
down: (queryInterface, Sequelize) => { | ||
return queryInterface.bulkDelete("user_feedback", null, {}); | ||
}, | ||
}; |
Oops, something went wrong.