@takaro/db 0.0.11 → 0.0.13

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.
@@ -0,0 +1,3 @@
1
+ import { Knex } from 'knex';
2
+ export declare function up(knex: Knex): Promise<void>;
3
+ export declare function down(knex: Knex): Promise<void>;
@@ -0,0 +1,11 @@
1
+ export async function up(knex) {
2
+ await knex.schema.alterTable('playerOnGameServer', (table) => {
3
+ table.integer('playtimeSeconds').defaultTo(0).notNullable();
4
+ });
5
+ }
6
+ export async function down(knex) {
7
+ await knex.schema.alterTable('playerOnGameServer', (table) => {
8
+ table.dropColumn('playtimeSeconds');
9
+ });
10
+ }
11
+ //# sourceMappingURL=20240922110414-player-playtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20240922110414-player-playtime.js","sourceRoot":"","sources":["../../../src/migrations/sql/20240922110414-player-playtime.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC,IAAU;IACjC,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC,KAAK,EAAE,EAAE;QAC3D,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,IAAU;IACnC,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC,KAAK,EAAE,EAAE;QAC3D,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Knex } from 'knex';
2
+ export declare function up(knex: Knex): Promise<void>;
3
+ export declare function down(knex: Knex): Promise<void>;
@@ -0,0 +1,20 @@
1
+ export async function up(knex) {
2
+ await knex.schema.createTable('bans', (table) => {
3
+ table.timestamps(true, true, true);
4
+ table.uuid('id').primary().defaultTo(knex.raw('gen_random_uuid ()'));
5
+ table.string('domain').references('domains.id').onDelete('CASCADE').notNullable();
6
+ table.index('domain');
7
+ table.uuid('gameServerId').references('gameservers.id').onDelete('CASCADE').notNullable();
8
+ table.uuid('playerId').references('players.id').onDelete('CASCADE').notNullable();
9
+ // PlayerId and gameServerId should be unique combined
10
+ table.unique(['playerId', 'gameServerId']);
11
+ table.boolean('takaroManaged').notNullable();
12
+ table.boolean('isGlobal').notNullable().defaultTo(false);
13
+ table.timestamp('until').nullable();
14
+ table.string('reason').nullable();
15
+ });
16
+ }
17
+ export async function down(knex) {
18
+ await knex.schema.dropTable('bans');
19
+ }
20
+ //# sourceMappingURL=20240922133738-add-bans.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20240922133738-add-bans.js","sourceRoot":"","sources":["../../../src/migrations/sql/20240922133738-add-bans.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC,IAAU;IACjC,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;QAC9C,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACnC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC;QACrE,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;QAClF,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAEtB,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;QAC1F,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;QAClF,sDAAsD;QACtD,KAAK,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;QAE3C,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,WAAW,EAAE,CAAC;QAC7C,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAEzD,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;QACpC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,IAAU;IACnC,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Knex } from 'knex';
2
+ export declare function up(knex: Knex): Promise<void>;
3
+ export declare function down(knex: Knex): Promise<void>;
@@ -0,0 +1,11 @@
1
+ export async function up(knex) {
2
+ await knex.schema.alterTable('players', (table) => {
3
+ table.integer('playtimeSeconds').defaultTo(0).notNullable();
4
+ });
5
+ }
6
+ export async function down(knex) {
7
+ await knex.schema.alterTable('players', (table) => {
8
+ table.dropColumn('playtimeSeconds');
9
+ });
10
+ }
11
+ //# sourceMappingURL=20240929090313-global-playtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20240929090313-global-playtime.js","sourceRoot":"","sources":["../../../src/migrations/sql/20240929090313-global-playtime.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC,IAAU;IACjC,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;QAChD,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,IAAU;IACnC,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;QAChD,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Knex } from 'knex';
2
+ export declare function up(knex: Knex): Promise<void>;
3
+ export declare function down(knex: Knex): Promise<void>;
@@ -0,0 +1,11 @@
1
+ export async function up(knex) {
2
+ await knex.schema.alterTable('players', (table) => {
3
+ table.string('name').nullable().alter();
4
+ });
5
+ }
6
+ export async function down(knex) {
7
+ await knex.schema.alterTable('players', (table) => {
8
+ table.string('name').notNullable().alter();
9
+ });
10
+ }
11
+ //# sourceMappingURL=20240929143849-player-name-null.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20240929143849-player-name-null.js","sourceRoot":"","sources":["../../../src/migrations/sql/20240929143849-player-name-null.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC,IAAU;IACjC,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;QAChD,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,IAAU;IACnC,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;QAChD,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takaro/db",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "An opinionated data layer",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",
@@ -17,11 +17,11 @@
17
17
  "author": "",
18
18
  "license": "ISC",
19
19
  "dependencies": {
20
- "convict": "^6.2.3",
21
- "objection": "^3.0.1",
22
- "pg": "^8.8.0"
20
+ "convict": "6.2.4",
21
+ "objection": "3.1.5",
22
+ "pg": "8.13.0"
23
23
  },
24
24
  "devDependencies": {
25
- "@types/convict": "^6.1.1"
25
+ "@types/convict": "6.1.6"
26
26
  }
27
27
  }
@@ -0,0 +1,13 @@
1
+ import { Knex } from 'knex';
2
+
3
+ export async function up(knex: Knex): Promise<void> {
4
+ await knex.schema.alterTable('playerOnGameServer', (table) => {
5
+ table.integer('playtimeSeconds').defaultTo(0).notNullable();
6
+ });
7
+ }
8
+
9
+ export async function down(knex: Knex): Promise<void> {
10
+ await knex.schema.alterTable('playerOnGameServer', (table) => {
11
+ table.dropColumn('playtimeSeconds');
12
+ });
13
+ }
@@ -0,0 +1,25 @@
1
+ import { Knex } from 'knex';
2
+
3
+ export async function up(knex: Knex): Promise<void> {
4
+ await knex.schema.createTable('bans', (table) => {
5
+ table.timestamps(true, true, true);
6
+ table.uuid('id').primary().defaultTo(knex.raw('gen_random_uuid ()'));
7
+ table.string('domain').references('domains.id').onDelete('CASCADE').notNullable();
8
+ table.index('domain');
9
+
10
+ table.uuid('gameServerId').references('gameservers.id').onDelete('CASCADE').notNullable();
11
+ table.uuid('playerId').references('players.id').onDelete('CASCADE').notNullable();
12
+ // PlayerId and gameServerId should be unique combined
13
+ table.unique(['playerId', 'gameServerId']);
14
+
15
+ table.boolean('takaroManaged').notNullable();
16
+ table.boolean('isGlobal').notNullable().defaultTo(false);
17
+
18
+ table.timestamp('until').nullable();
19
+ table.string('reason').nullable();
20
+ });
21
+ }
22
+
23
+ export async function down(knex: Knex): Promise<void> {
24
+ await knex.schema.dropTable('bans');
25
+ }
@@ -0,0 +1,13 @@
1
+ import { Knex } from 'knex';
2
+
3
+ export async function up(knex: Knex): Promise<void> {
4
+ await knex.schema.alterTable('players', (table) => {
5
+ table.integer('playtimeSeconds').defaultTo(0).notNullable();
6
+ });
7
+ }
8
+
9
+ export async function down(knex: Knex): Promise<void> {
10
+ await knex.schema.alterTable('players', (table) => {
11
+ table.dropColumn('playtimeSeconds');
12
+ });
13
+ }
@@ -0,0 +1,13 @@
1
+ import { Knex } from 'knex';
2
+
3
+ export async function up(knex: Knex): Promise<void> {
4
+ await knex.schema.alterTable('players', (table) => {
5
+ table.string('name').nullable().alter();
6
+ });
7
+ }
8
+
9
+ export async function down(knex: Knex): Promise<void> {
10
+ await knex.schema.alterTable('players', (table) => {
11
+ table.string('name').notNullable().alter();
12
+ });
13
+ }