Skip to content

Commit 2f2bd0f

Browse files
authored
Merge pull request #72 from x-team/GAMESHQ_New-Scoreboard
Add missing migrations
2 parents 998608f + 9d50929 commit 2f2bd0f

2 files changed

+72
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import type { QueryInterface, Sequelize } from 'sequelize';
2+
import { DataTypes } from 'sequelize';
3+
4+
interface SequelizeContext {
5+
context: {
6+
queryInterface: QueryInterface;
7+
Sequelize: Sequelize;
8+
};
9+
}
10+
11+
module.exports = {
12+
async up({ context: { queryInterface } }: SequelizeContext) {
13+
return queryInterface.sequelize.transaction(async (transaction) => {
14+
await queryInterface.addColumn(
15+
'TowerStatistics',
16+
'lastFloorVisited',
17+
{
18+
type: DataTypes.INTEGER,
19+
defaultValue: 0,
20+
},
21+
{ transaction }
22+
);
23+
});
24+
},
25+
26+
async down({ context: { queryInterface } }: SequelizeContext) {
27+
return queryInterface.sequelize.transaction(async (transaction) => {
28+
await queryInterface.removeColumn('TowerStatistics', 'lastFloorVisited', { transaction });
29+
});
30+
},
31+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import type { QueryInterface, Sequelize } from 'sequelize';
2+
import { DataTypes } from 'sequelize';
3+
4+
interface SequelizeContext {
5+
context: {
6+
queryInterface: QueryInterface;
7+
Sequelize: Sequelize;
8+
};
9+
}
10+
11+
module.exports = {
12+
async up({ context: { queryInterface } }: SequelizeContext) {
13+
return queryInterface.sequelize.transaction(async (transaction) => {
14+
await queryInterface.addColumn(
15+
'TowerStatistics',
16+
'lastHealth',
17+
{
18+
type: DataTypes.INTEGER,
19+
defaultValue: 100,
20+
},
21+
{ transaction }
22+
);
23+
await queryInterface.addColumn(
24+
'TowerStatistics',
25+
'perks',
26+
{
27+
type: DataTypes.INTEGER,
28+
defaultValue: 0,
29+
},
30+
{ transaction }
31+
);
32+
});
33+
},
34+
35+
async down({ context: { queryInterface } }: SequelizeContext) {
36+
return queryInterface.sequelize.transaction(async (transaction) => {
37+
await queryInterface.removeColumn('TowerStatistics', 'lastHealth', { transaction });
38+
await queryInterface.removeColumn('TowerStatistics', 'perks', { transaction });
39+
});
40+
},
41+
};

0 commit comments

Comments
 (0)