Skip to content

Commit

Permalink
Merge pull request ocademy-ai#678 from LongfeiH/database
Browse files Browse the repository at this point in the history
fix the database bug
  • Loading branch information
bestfw authored Nov 26, 2023
2 parents 88aeb96 + f442c82 commit 98f30ae
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
1 change: 0 additions & 1 deletion awesome/database/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const TABLES = {
BOOK: "Book",
TUTORIAL: "Tutorial",
TAG: "Tag",
TUTORIAL: "Tutorial",
COURSE_TAGS: "CourseTags",
COURSE_ORGANIZATIONS: "CourseOrganizations",
USER_COURSES: "UserCourses",
Expand Down
Binary file modified awesome/database/data.db
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const { TABLES } = require("../constants");
const databaseOperations = require("../utils");
const tablesToModify = {
TUTORIAL: TABLES.TUTORIAL,
COURSE: TABLES.COURSE,
};

exports.up = async function (knex) {
await Promise.all(
Object.values(tablesToModify).map(async (v) => {
return (() => {
databaseOperations.alterTable(knex, v, (table) => {
table.string('cost', 255).alter();
})
});
})
);
};

exports.down = async function (knex) {
await Promise.all(
Object.values(tablesToModify).map(async (v) => {
return (() => {
databaseOperations.alterTable(knex, v, (table) => {
table.integer('cost').alter();
})
});
})
);
};

0 comments on commit 98f30ae

Please sign in to comment.