Skip to content

Commit

Permalink
fix: migration functions uses database name
Browse files Browse the repository at this point in the history
  • Loading branch information
romain22222 committed Oct 17, 2023
1 parent ee6bd05 commit b825286
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/database/game/GameDatabaseUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {QueryInterface} from "sequelize";
* Add a mission to the campaign
*/
export async function addCampaignMission(context: QueryInterface, position: number): Promise<void> {
await context.sequelize.query(`UPDATE draftbot_game.player_missions_info SET campaignProgression = campaignProgression + 1 WHERE campaignProgression > ${position}`);
await context.sequelize.query(`UPDATE draftbot_game.player_missions_info SET campaignBlob = CONCAT(SUBSTR(campaignBlob, 1, ${position - 1}), "0", SUBSTR(campaignBlob, ${position}))`);
await context.sequelize.query(`UPDATE player_missions_info SET campaignProgression = campaignProgression + 1 WHERE campaignProgression > ${position}`);
await context.sequelize.query(`UPDATE player_missions_info SET campaignBlob = CONCAT(SUBSTR(campaignBlob, 1, ${position - 1}), "0", SUBSTR(campaignBlob, ${position}))`);
}

/**
Expand All @@ -21,8 +21,8 @@ export async function addCampaignMissionList(context: QueryInterface, positions:
* Remove a mission from the campaign
*/
export async function removeCampaignMission(context: QueryInterface, position: number): Promise<void> {
await context.sequelize.query(`UPDATE draftbot_game.player_missions_info SET campaignProgression = campaignProgression - 1 WHERE campaignProgression >= ${position}`);
await context.sequelize.query(`UPDATE draftbot_game.player_missions_info SET campaignBlob = CONCAT(SUBSTR(campaignBlob, 1, ${position - 1}), SUBSTR(campaignBlob, ${position + 1}))`);
await context.sequelize.query(`UPDATE player_missions_info SET campaignProgression = campaignProgression - 1 WHERE campaignProgression >= ${position}`);
await context.sequelize.query(`UPDATE player_missions_info SET campaignBlob = CONCAT(SUBSTR(campaignBlob, 1, ${position - 1}), SUBSTR(campaignBlob, ${position + 1}))`);
}

/**
Expand Down

0 comments on commit b825286

Please sign in to comment.