Skip to content

Commit bf08443

Browse files
committed
fix karma migration #629
fix karma migration #629
1 parent 636d2e3 commit bf08443

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

Core/src/core/database/game/migrations/028-add-karma.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import {
33
} from "sequelize";
44

55
export async function up({ context }: { context: QueryInterface }): Promise<void> {
6-
await context.addColumn("players", "karma", DataTypes.INTEGER);
6+
await context.addColumn("players", "karma", {
7+
type: DataTypes.INTEGER,
8+
allowNull: false,
9+
defaultValue: 0
10+
});
711
}
812

913
export async function down({ context }: { context: QueryInterface }): Promise<void> {

Core/src/core/database/game/models/Player.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,6 +1508,10 @@ export function initModel(sequelize: Sequelize): void {
15081508
type: DataTypes.INTEGER,
15091509
defaultValue: EntityConstants.DEFAULT_VALUES.HEALTH
15101510
},
1511+
karma: {
1512+
type: DataTypes.INTEGER,
1513+
defaultValue: EntityConstants.DEFAULT_VALUES.KARMA
1514+
},
15111515
fightPointsLost: {
15121516
type: DataTypes.INTEGER,
15131517
defaultValue: EntityConstants.DEFAULT_VALUES.FIGHT_POINTS_LOST

Lib/src/constants/EntityConstants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ export abstract class EntityConstants {
44
ATTACK: 50,
55
DEFENSE: 20,
66
SPEED: 10,
7-
FIGHT_POINTS_LOST: 0
7+
FIGHT_POINTS_LOST: 0,
8+
KARMA: 0
89
};
910

1011
static readonly HEAL_ENERGY_PRICE = [

0 commit comments

Comments
 (0)