Skip to content

Commit

Permalink
Merge pull request #91 from GDSC-PKNU-21-22/fix/#90
Browse files Browse the repository at this point in the history
Fix/#90: RDS 용량문제 해결
  • Loading branch information
pp449 authored Aug 30, 2023
2 parents a936f3c + e2acfe8 commit 665339d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
15 changes: 4 additions & 11 deletions src/db/data/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ export const saveDepartmentToDB = async (college: College[]): Promise<void> => {

const saveNotice = (notice: Notice, major: string): Promise<void> => {
const saveNoticeQuery =
'INSERT INTO ' +
major +
' (title, link, content, uploadDate) VALUES (?, ?, ?, ?)';
const values = [notice.title, notice.path, notice.description, notice.date];
'INSERT INTO ' + major + ' (title, link, uploadDate) VALUES (?, ?, ?)';
const values = [notice.title, notice.path, notice.date];

return new Promise((resolve) => {
db.query(saveNoticeQuery, values, (err) => {
Expand Down Expand Up @@ -152,7 +150,7 @@ const saveSchoolNotice = async (
});
});

const saveNoticeQuery = `INSERT INTO 학교${mode} (title, link, content, uploadDate) VALUES (?, ?, ?, ?);`;
const saveNoticeQuery = `INSERT INTO 학교${mode} (title, link, uploadDate) VALUES (?, ?, ?);`;
const savePromises: Promise<void>[] = [];

for (const list of notices) {
Expand All @@ -165,12 +163,7 @@ const saveSchoolNotice = async (

savePromises.push(
new Promise<void>((resolve) => {
const values = [
notice.title,
notice.path,
notice.description,
notice.date,
];
const values = [notice.title, notice.path, notice.date];
db.query(saveNoticeQuery, values, async (error) => {
if (error) {
console.log('학교 공지사항 입력 실패!');
Expand Down
2 changes: 0 additions & 2 deletions src/db/table/createTables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const createNoticeTable = (college: College[]) => {
id INT PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(255) NOT NULL,
link VARCHAR(255) NOT NULL UNIQUE,
content TEXT NOT NULL,
uploadDate VARCHAR(255) NOT NULL
);`;

Expand Down Expand Up @@ -90,7 +89,6 @@ const createSchoolNoticeTable = () => {
id INT PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(255) NOT NULL,
link VARCHAR(255) NOT NULL UNIQUE,
content TEXT NOT NULL,
uploadDate VARCHAR(255) NOT NULL
);`;

Expand Down

0 comments on commit 665339d

Please sign in to comment.