@takaro/db 0.4.0 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/migrations/sql/20250809122020-add-player-name-history.d.ts.map +1 -1
- package/dist/migrations/sql/20250809122020-add-player-name-history.js +0 -12
- package/dist/migrations/sql/20250809122020-add-player-name-history.js.map +1 -1
- package/package.json +1 -1
- package/src/migrations/sql/20250809122020-add-player-name-history.ts +0 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"20250809122020-add-player-name-history.d.ts","sourceRoot":"","sources":["../../../src/migrations/sql/20250809122020-add-player-name-history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,wBAAsB,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"20250809122020-add-player-name-history.d.ts","sourceRoot":"","sources":["../../../src/migrations/sql/20250809122020-add-player-name-history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,wBAAsB,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAalD;AAED,wBAAsB,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAapD"}
|
|
@@ -10,18 +10,6 @@ export async function up(knex) {
|
|
|
10
10
|
table.index(['playerId', 'createdAt'], 'idx_player_name_history_player_created');
|
|
11
11
|
table.index('name', 'idx_player_name_history_name');
|
|
12
12
|
});
|
|
13
|
-
// Populate initial data from existing player names
|
|
14
|
-
const players = await knex('players').select('id', 'name', 'domain', 'createdAt').whereNotNull('name');
|
|
15
|
-
if (players.length > 0) {
|
|
16
|
-
const nameHistoryRecords = players.map((player) => ({
|
|
17
|
-
playerId: player.id,
|
|
18
|
-
name: player.name,
|
|
19
|
-
domain: player.domain,
|
|
20
|
-
createdAt: player.createdAt,
|
|
21
|
-
updatedAt: player.createdAt,
|
|
22
|
-
}));
|
|
23
|
-
await knex('playerNameHistory').insert(nameHistoryRecords);
|
|
24
|
-
}
|
|
25
13
|
}
|
|
26
14
|
export async function down(knex) {
|
|
27
15
|
// Update players table with latest name from history before dropping
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"20250809122020-add-player-name-history.js","sourceRoot":"","sources":["../../../src/migrations/sql/20250809122020-add-player-name-history.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC,IAAU;IACjC,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE;QAC3D,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC;QACrE,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACnC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;QAClF,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;QAClF,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC;QACxF,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;QAEnC,0BAA0B;QAC1B,KAAK,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,wCAAwC,CAAC,CAAC;QACjF,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"20250809122020-add-player-name-history.js","sourceRoot":"","sources":["../../../src/migrations/sql/20250809122020-add-player-name-history.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC,IAAU;IACjC,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE;QAC3D,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC;QACrE,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACnC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;QAClF,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;QAClF,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC;QACxF,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;QAEnC,0BAA0B;QAC1B,KAAK,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,wCAAwC,CAAC,CAAC;QACjF,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,IAAU;IACnC,qEAAqE;IACrE,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC;SAChD,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC;SAC1B,UAAU,CAAC,UAAU,CAAC;SACtB,OAAO,CAAC,UAAU,CAAC;SACnB,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAEhC,KAAK,MAAM,MAAM,IAAI,WAAW,EAAE,CAAC;QACjC,MAAM,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IACnF,CAAC;IAED,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;AACnD,CAAC"}
|
package/package.json
CHANGED
|
@@ -13,21 +13,6 @@ export async function up(knex: Knex): Promise<void> {
|
|
|
13
13
|
table.index(['playerId', 'createdAt'], 'idx_player_name_history_player_created');
|
|
14
14
|
table.index('name', 'idx_player_name_history_name');
|
|
15
15
|
});
|
|
16
|
-
|
|
17
|
-
// Populate initial data from existing player names
|
|
18
|
-
const players = await knex('players').select('id', 'name', 'domain', 'createdAt').whereNotNull('name');
|
|
19
|
-
|
|
20
|
-
if (players.length > 0) {
|
|
21
|
-
const nameHistoryRecords = players.map((player) => ({
|
|
22
|
-
playerId: player.id,
|
|
23
|
-
name: player.name,
|
|
24
|
-
domain: player.domain,
|
|
25
|
-
createdAt: player.createdAt,
|
|
26
|
-
updatedAt: player.createdAt,
|
|
27
|
-
}));
|
|
28
|
-
|
|
29
|
-
await knex('playerNameHistory').insert(nameHistoryRecords);
|
|
30
|
-
}
|
|
31
16
|
}
|
|
32
17
|
|
|
33
18
|
export async function down(knex: Knex): Promise<void> {
|