@byline/db-postgres 2.1.2 → 2.2.0
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/database/schema/auth.d.ts +98 -98
- package/dist/database/schema/auth.js +6 -9
- package/dist/database/schema/common.d.ts +34 -0
- package/dist/database/schema/common.js +45 -0
- package/dist/database/schema/index.d.ts +407 -349
- package/dist/database/schema/index.js +28 -13
- package/dist/index.js +6 -1
- package/dist/modules/counters/counters-commands.d.ts +22 -0
- package/dist/modules/counters/counters-commands.js +96 -0
- package/dist/modules/storage/storage-commands.d.ts +6 -6
- package/dist/modules/storage/storage-flatten.js +1 -0
- package/dist/modules/storage/storage-queries.d.ts +10 -10
- package/dist/modules/storage/storage-queries.js +13 -2
- package/package.json +4 -4
- package/dist/lib/test-bootstrap.d.ts +0 -8
- package/dist/lib/test-bootstrap.js +0 -27
|
@@ -9,6 +9,40 @@ export declare const adminUsers: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
9
9
|
name: "byline_admin_users";
|
|
10
10
|
schema: undefined;
|
|
11
11
|
columns: {
|
|
12
|
+
created_at: import("drizzle-orm/pg-core").PgColumn<{
|
|
13
|
+
name: string;
|
|
14
|
+
tableName: "byline_admin_users";
|
|
15
|
+
dataType: "date";
|
|
16
|
+
columnType: "PgTimestamp";
|
|
17
|
+
data: Date;
|
|
18
|
+
driverParam: string;
|
|
19
|
+
notNull: true;
|
|
20
|
+
hasDefault: true;
|
|
21
|
+
isPrimaryKey: false;
|
|
22
|
+
isAutoincrement: false;
|
|
23
|
+
hasRuntimeDefault: false;
|
|
24
|
+
enumValues: undefined;
|
|
25
|
+
baseColumn: never;
|
|
26
|
+
identity: undefined;
|
|
27
|
+
generated: undefined;
|
|
28
|
+
}, {}, {}>;
|
|
29
|
+
updated_at: import("drizzle-orm/pg-core").PgColumn<{
|
|
30
|
+
name: string;
|
|
31
|
+
tableName: "byline_admin_users";
|
|
32
|
+
dataType: "date";
|
|
33
|
+
columnType: "PgTimestamp";
|
|
34
|
+
data: Date;
|
|
35
|
+
driverParam: string;
|
|
36
|
+
notNull: true;
|
|
37
|
+
hasDefault: true;
|
|
38
|
+
isPrimaryKey: false;
|
|
39
|
+
isAutoincrement: false;
|
|
40
|
+
hasRuntimeDefault: false;
|
|
41
|
+
enumValues: undefined;
|
|
42
|
+
baseColumn: never;
|
|
43
|
+
identity: undefined;
|
|
44
|
+
generated: undefined;
|
|
45
|
+
}, {}, {}>;
|
|
12
46
|
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
13
47
|
name: "id";
|
|
14
48
|
tableName: "byline_admin_users";
|
|
@@ -259,9 +293,16 @@ export declare const adminUsers: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
259
293
|
identity: undefined;
|
|
260
294
|
generated: undefined;
|
|
261
295
|
}, {}, {}>;
|
|
296
|
+
};
|
|
297
|
+
dialect: "pg";
|
|
298
|
+
}>;
|
|
299
|
+
export declare const adminRoles: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
300
|
+
name: "byline_admin_roles";
|
|
301
|
+
schema: undefined;
|
|
302
|
+
columns: {
|
|
262
303
|
created_at: import("drizzle-orm/pg-core").PgColumn<{
|
|
263
|
-
name:
|
|
264
|
-
tableName: "
|
|
304
|
+
name: string;
|
|
305
|
+
tableName: "byline_admin_roles";
|
|
265
306
|
dataType: "date";
|
|
266
307
|
columnType: "PgTimestamp";
|
|
267
308
|
data: Date;
|
|
@@ -277,8 +318,8 @@ export declare const adminUsers: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
277
318
|
generated: undefined;
|
|
278
319
|
}, {}, {}>;
|
|
279
320
|
updated_at: import("drizzle-orm/pg-core").PgColumn<{
|
|
280
|
-
name:
|
|
281
|
-
tableName: "
|
|
321
|
+
name: string;
|
|
322
|
+
tableName: "byline_admin_roles";
|
|
282
323
|
dataType: "date";
|
|
283
324
|
columnType: "PgTimestamp";
|
|
284
325
|
data: Date;
|
|
@@ -293,13 +334,6 @@ export declare const adminUsers: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
293
334
|
identity: undefined;
|
|
294
335
|
generated: undefined;
|
|
295
336
|
}, {}, {}>;
|
|
296
|
-
};
|
|
297
|
-
dialect: "pg";
|
|
298
|
-
}>;
|
|
299
|
-
export declare const adminRoles: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
300
|
-
name: "byline_admin_roles";
|
|
301
|
-
schema: undefined;
|
|
302
|
-
columns: {
|
|
303
337
|
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
304
338
|
name: "id";
|
|
305
339
|
tableName: "byline_admin_roles";
|
|
@@ -406,26 +440,16 @@ export declare const adminRoles: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
406
440
|
identity: undefined;
|
|
407
441
|
generated: undefined;
|
|
408
442
|
}, {}, {}>;
|
|
443
|
+
};
|
|
444
|
+
dialect: "pg";
|
|
445
|
+
}>;
|
|
446
|
+
export declare const adminRoleAdminUser: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
447
|
+
name: "byline_admin_role_admin_user";
|
|
448
|
+
schema: undefined;
|
|
449
|
+
columns: {
|
|
409
450
|
created_at: import("drizzle-orm/pg-core").PgColumn<{
|
|
410
|
-
name:
|
|
411
|
-
tableName: "
|
|
412
|
-
dataType: "date";
|
|
413
|
-
columnType: "PgTimestamp";
|
|
414
|
-
data: Date;
|
|
415
|
-
driverParam: string;
|
|
416
|
-
notNull: true;
|
|
417
|
-
hasDefault: true;
|
|
418
|
-
isPrimaryKey: false;
|
|
419
|
-
isAutoincrement: false;
|
|
420
|
-
hasRuntimeDefault: false;
|
|
421
|
-
enumValues: undefined;
|
|
422
|
-
baseColumn: never;
|
|
423
|
-
identity: undefined;
|
|
424
|
-
generated: undefined;
|
|
425
|
-
}, {}, {}>;
|
|
426
|
-
updated_at: import("drizzle-orm/pg-core").PgColumn<{
|
|
427
|
-
name: "updated_at";
|
|
428
|
-
tableName: "byline_admin_roles";
|
|
451
|
+
name: string;
|
|
452
|
+
tableName: "byline_admin_role_admin_user";
|
|
429
453
|
dataType: "date";
|
|
430
454
|
columnType: "PgTimestamp";
|
|
431
455
|
data: Date;
|
|
@@ -440,13 +464,6 @@ export declare const adminRoles: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
440
464
|
identity: undefined;
|
|
441
465
|
generated: undefined;
|
|
442
466
|
}, {}, {}>;
|
|
443
|
-
};
|
|
444
|
-
dialect: "pg";
|
|
445
|
-
}>;
|
|
446
|
-
export declare const adminRoleAdminUser: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
447
|
-
name: "byline_admin_role_admin_user";
|
|
448
|
-
schema: undefined;
|
|
449
|
-
columns: {
|
|
450
467
|
admin_role_id: import("drizzle-orm/pg-core").PgColumn<{
|
|
451
468
|
name: "admin_role_id";
|
|
452
469
|
tableName: "byline_admin_role_admin_user";
|
|
@@ -481,9 +498,33 @@ export declare const adminRoleAdminUser: import("drizzle-orm/pg-core").PgTableWi
|
|
|
481
498
|
identity: undefined;
|
|
482
499
|
generated: undefined;
|
|
483
500
|
}, {}, {}>;
|
|
501
|
+
};
|
|
502
|
+
dialect: "pg";
|
|
503
|
+
}>;
|
|
504
|
+
export declare const adminPermissions: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
505
|
+
name: "byline_admin_permissions";
|
|
506
|
+
schema: undefined;
|
|
507
|
+
columns: {
|
|
484
508
|
created_at: import("drizzle-orm/pg-core").PgColumn<{
|
|
485
|
-
name:
|
|
486
|
-
tableName: "
|
|
509
|
+
name: string;
|
|
510
|
+
tableName: "byline_admin_permissions";
|
|
511
|
+
dataType: "date";
|
|
512
|
+
columnType: "PgTimestamp";
|
|
513
|
+
data: Date;
|
|
514
|
+
driverParam: string;
|
|
515
|
+
notNull: true;
|
|
516
|
+
hasDefault: true;
|
|
517
|
+
isPrimaryKey: false;
|
|
518
|
+
isAutoincrement: false;
|
|
519
|
+
hasRuntimeDefault: false;
|
|
520
|
+
enumValues: undefined;
|
|
521
|
+
baseColumn: never;
|
|
522
|
+
identity: undefined;
|
|
523
|
+
generated: undefined;
|
|
524
|
+
}, {}, {}>;
|
|
525
|
+
updated_at: import("drizzle-orm/pg-core").PgColumn<{
|
|
526
|
+
name: string;
|
|
527
|
+
tableName: "byline_admin_permissions";
|
|
487
528
|
dataType: "date";
|
|
488
529
|
columnType: "PgTimestamp";
|
|
489
530
|
data: Date;
|
|
@@ -498,13 +539,6 @@ export declare const adminRoleAdminUser: import("drizzle-orm/pg-core").PgTableWi
|
|
|
498
539
|
identity: undefined;
|
|
499
540
|
generated: undefined;
|
|
500
541
|
}, {}, {}>;
|
|
501
|
-
};
|
|
502
|
-
dialect: "pg";
|
|
503
|
-
}>;
|
|
504
|
-
export declare const adminPermissions: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
505
|
-
name: "byline_admin_permissions";
|
|
506
|
-
schema: undefined;
|
|
507
|
-
columns: {
|
|
508
542
|
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
509
543
|
name: "id";
|
|
510
544
|
tableName: "byline_admin_permissions";
|
|
@@ -575,9 +609,23 @@ export declare const adminPermissions: import("drizzle-orm/pg-core").PgTableWith
|
|
|
575
609
|
}, {}, {
|
|
576
610
|
length: 128;
|
|
577
611
|
}>;
|
|
612
|
+
};
|
|
613
|
+
dialect: "pg";
|
|
614
|
+
}>;
|
|
615
|
+
/**
|
|
616
|
+
* Refresh tokens are opaque random strings minted by `JwtSessionProvider`.
|
|
617
|
+
* We never store the plaintext — only a SHA-256 hash (`token_hash`). When
|
|
618
|
+
* a token is rotated, `revoked_at` is stamped and `rotated_to_id` points
|
|
619
|
+
* at the replacement row; presenting a rotated token is treated as replay
|
|
620
|
+
* and revokes the whole chain.
|
|
621
|
+
*/
|
|
622
|
+
export declare const adminRefreshTokens: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
623
|
+
name: "byline_admin_refresh_tokens";
|
|
624
|
+
schema: undefined;
|
|
625
|
+
columns: {
|
|
578
626
|
created_at: import("drizzle-orm/pg-core").PgColumn<{
|
|
579
|
-
name:
|
|
580
|
-
tableName: "
|
|
627
|
+
name: string;
|
|
628
|
+
tableName: "byline_admin_refresh_tokens";
|
|
581
629
|
dataType: "date";
|
|
582
630
|
columnType: "PgTimestamp";
|
|
583
631
|
data: Date;
|
|
@@ -593,8 +641,8 @@ export declare const adminPermissions: import("drizzle-orm/pg-core").PgTableWith
|
|
|
593
641
|
generated: undefined;
|
|
594
642
|
}, {}, {}>;
|
|
595
643
|
updated_at: import("drizzle-orm/pg-core").PgColumn<{
|
|
596
|
-
name:
|
|
597
|
-
tableName: "
|
|
644
|
+
name: string;
|
|
645
|
+
tableName: "byline_admin_refresh_tokens";
|
|
598
646
|
dataType: "date";
|
|
599
647
|
columnType: "PgTimestamp";
|
|
600
648
|
data: Date;
|
|
@@ -609,20 +657,6 @@ export declare const adminPermissions: import("drizzle-orm/pg-core").PgTableWith
|
|
|
609
657
|
identity: undefined;
|
|
610
658
|
generated: undefined;
|
|
611
659
|
}, {}, {}>;
|
|
612
|
-
};
|
|
613
|
-
dialect: "pg";
|
|
614
|
-
}>;
|
|
615
|
-
/**
|
|
616
|
-
* Refresh tokens are opaque random strings minted by `JwtSessionProvider`.
|
|
617
|
-
* We never store the plaintext — only a SHA-256 hash (`token_hash`). When
|
|
618
|
-
* a token is rotated, `revoked_at` is stamped and `rotated_to_id` points
|
|
619
|
-
* at the replacement row; presenting a rotated token is treated as replay
|
|
620
|
-
* and revokes the whole chain.
|
|
621
|
-
*/
|
|
622
|
-
export declare const adminRefreshTokens: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
623
|
-
name: "byline_admin_refresh_tokens";
|
|
624
|
-
schema: undefined;
|
|
625
|
-
columns: {
|
|
626
660
|
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
627
661
|
name: "id";
|
|
628
662
|
tableName: "byline_admin_refresh_tokens";
|
|
@@ -799,40 +833,6 @@ export declare const adminRefreshTokens: import("drizzle-orm/pg-core").PgTableWi
|
|
|
799
833
|
}, {}, {
|
|
800
834
|
length: 45;
|
|
801
835
|
}>;
|
|
802
|
-
created_at: import("drizzle-orm/pg-core").PgColumn<{
|
|
803
|
-
name: "created_at";
|
|
804
|
-
tableName: "byline_admin_refresh_tokens";
|
|
805
|
-
dataType: "date";
|
|
806
|
-
columnType: "PgTimestamp";
|
|
807
|
-
data: Date;
|
|
808
|
-
driverParam: string;
|
|
809
|
-
notNull: true;
|
|
810
|
-
hasDefault: true;
|
|
811
|
-
isPrimaryKey: false;
|
|
812
|
-
isAutoincrement: false;
|
|
813
|
-
hasRuntimeDefault: false;
|
|
814
|
-
enumValues: undefined;
|
|
815
|
-
baseColumn: never;
|
|
816
|
-
identity: undefined;
|
|
817
|
-
generated: undefined;
|
|
818
|
-
}, {}, {}>;
|
|
819
|
-
updated_at: import("drizzle-orm/pg-core").PgColumn<{
|
|
820
|
-
name: "updated_at";
|
|
821
|
-
tableName: "byline_admin_refresh_tokens";
|
|
822
|
-
dataType: "date";
|
|
823
|
-
columnType: "PgTimestamp";
|
|
824
|
-
data: Date;
|
|
825
|
-
driverParam: string;
|
|
826
|
-
notNull: true;
|
|
827
|
-
hasDefault: true;
|
|
828
|
-
isPrimaryKey: false;
|
|
829
|
-
isAutoincrement: false;
|
|
830
|
-
hasRuntimeDefault: false;
|
|
831
|
-
enumValues: undefined;
|
|
832
|
-
baseColumn: never;
|
|
833
|
-
identity: undefined;
|
|
834
|
-
generated: undefined;
|
|
835
|
-
}, {}, {}>;
|
|
836
836
|
};
|
|
837
837
|
dialect: "pg";
|
|
838
838
|
}>;
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
*/
|
|
26
26
|
import { relations } from 'drizzle-orm';
|
|
27
27
|
import { boolean, index, integer, pgTable, primaryKey, text, timestamp, unique, uuid, varchar, } from 'drizzle-orm/pg-core';
|
|
28
|
+
import { createdAt, timestamps } from './common.js';
|
|
28
29
|
// ---------------------------------------------------------------------------
|
|
29
30
|
// byline_admin_users
|
|
30
31
|
// ---------------------------------------------------------------------------
|
|
@@ -55,8 +56,7 @@ export const adminUsers = pgTable('byline_admin_users', {
|
|
|
55
56
|
*/
|
|
56
57
|
is_enabled: boolean('is_enabled').notNull().default(false),
|
|
57
58
|
is_email_verified: boolean('is_email_verified').notNull().default(false),
|
|
58
|
-
|
|
59
|
-
updated_at: timestamp('updated_at').notNull().defaultNow(),
|
|
59
|
+
...timestamps,
|
|
60
60
|
}, (table) => [index('idx_byline_admin_users_email').on(table.email)]);
|
|
61
61
|
// ---------------------------------------------------------------------------
|
|
62
62
|
// byline_admin_roles
|
|
@@ -71,8 +71,7 @@ export const adminRoles = pgTable('byline_admin_roles', {
|
|
|
71
71
|
description: text('description'),
|
|
72
72
|
/** Display ordering in the role-editor UI. */
|
|
73
73
|
order: integer('order').notNull().default(0),
|
|
74
|
-
|
|
75
|
-
updated_at: timestamp('updated_at').notNull().defaultNow(),
|
|
74
|
+
...timestamps,
|
|
76
75
|
}, (table) => [index('idx_byline_admin_roles_machine_name').on(table.machine_name)]);
|
|
77
76
|
// ---------------------------------------------------------------------------
|
|
78
77
|
// byline_admin_role_admin_user — many-to-many join
|
|
@@ -84,7 +83,7 @@ export const adminRoleAdminUser = pgTable('byline_admin_role_admin_user', {
|
|
|
84
83
|
admin_user_id: uuid('admin_user_id')
|
|
85
84
|
.notNull()
|
|
86
85
|
.references(() => adminUsers.id, { onDelete: 'cascade' }),
|
|
87
|
-
|
|
86
|
+
...createdAt,
|
|
88
87
|
}, (table) => [
|
|
89
88
|
primaryKey({ columns: [table.admin_role_id, table.admin_user_id] }),
|
|
90
89
|
index('idx_byline_admin_role_admin_user_user').on(table.admin_user_id),
|
|
@@ -100,8 +99,7 @@ export const adminPermissions = pgTable('byline_admin_permissions', {
|
|
|
100
99
|
.references(() => adminRoles.id, { onDelete: 'cascade' }),
|
|
101
100
|
/** Flat dotted ability key — see `@byline/auth` AbilityRegistry. */
|
|
102
101
|
ability: varchar('ability', { length: 128 }).notNull(),
|
|
103
|
-
|
|
104
|
-
updated_at: timestamp('updated_at').notNull().defaultNow(),
|
|
102
|
+
...timestamps,
|
|
105
103
|
}, (table) => [
|
|
106
104
|
unique('uq_byline_admin_permissions_role_ability').on(table.admin_role_id, table.ability),
|
|
107
105
|
index('idx_byline_admin_permissions_role').on(table.admin_role_id),
|
|
@@ -134,8 +132,7 @@ export const adminRefreshTokens = pgTable('byline_admin_refresh_tokens', {
|
|
|
134
132
|
last_used_at: timestamp('last_used_at', { precision: 6, withTimezone: true }),
|
|
135
133
|
user_agent: varchar('user_agent', { length: 512 }),
|
|
136
134
|
ip: varchar('ip', { length: 45 }),
|
|
137
|
-
|
|
138
|
-
updated_at: timestamp('updated_at').notNull().defaultNow(),
|
|
135
|
+
...timestamps,
|
|
139
136
|
}, (table) => [
|
|
140
137
|
index('idx_byline_admin_refresh_tokens_user').on(table.admin_user_id),
|
|
141
138
|
index('idx_byline_admin_refresh_tokens_token_hash').on(table.token_hash),
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Both `created_at` and `updated_at` for tables whose rows are
|
|
10
|
+
* mutated in place (most application tables — users, roles, documents,
|
|
11
|
+
* store rows, paths).
|
|
12
|
+
*
|
|
13
|
+
* Spread into a `pgTable` definition:
|
|
14
|
+
*
|
|
15
|
+
* pgTable('byline_admin_users', {
|
|
16
|
+
* id: uuid('id').primaryKey(),
|
|
17
|
+
* ...timestamps,
|
|
18
|
+
* })
|
|
19
|
+
*/
|
|
20
|
+
export declare const timestamps: {
|
|
21
|
+
created_at: import("drizzle-orm").HasDefault<import("drizzle-orm").NotNull<import("drizzle-orm/pg-core").PgTimestampBuilderInitial<string>>>;
|
|
22
|
+
updated_at: import("drizzle-orm").HasDefault<import("drizzle-orm").NotNull<import("drizzle-orm/pg-core").PgTimestampBuilderInitial<string>>>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* `created_at` only — for tables whose rows are immutable once
|
|
26
|
+
* inserted (junction tables like `byline_admin_role_admin_user`,
|
|
27
|
+
* append-only relationship rows like `byline_document_relationships`,
|
|
28
|
+
* registry rows like `byline_counter_groups`).
|
|
29
|
+
*
|
|
30
|
+
* Spread into a `pgTable` definition the same way as `timestamps`.
|
|
31
|
+
*/
|
|
32
|
+
export declare const createdAt: {
|
|
33
|
+
created_at: import("drizzle-orm").HasDefault<import("drizzle-orm").NotNull<import("drizzle-orm/pg-core").PgTimestampBuilderInitial<string>>>;
|
|
34
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
import { timestamp } from 'drizzle-orm/pg-core';
|
|
9
|
+
/**
|
|
10
|
+
* Audit-timestamp column shape used across every Byline table.
|
|
11
|
+
* `TIMESTAMPTZ` with microsecond precision; stored in UTC, converted
|
|
12
|
+
* to/from the session timezone automatically.
|
|
13
|
+
*
|
|
14
|
+
* Defined once here so adding a new column to every table — or
|
|
15
|
+
* changing the precision/timezone behaviour across the schema — is a
|
|
16
|
+
* one-line edit.
|
|
17
|
+
*/
|
|
18
|
+
const auditTimestamp = (name) => timestamp(name, { precision: 6, withTimezone: true }).notNull().defaultNow();
|
|
19
|
+
/**
|
|
20
|
+
* Both `created_at` and `updated_at` for tables whose rows are
|
|
21
|
+
* mutated in place (most application tables — users, roles, documents,
|
|
22
|
+
* store rows, paths).
|
|
23
|
+
*
|
|
24
|
+
* Spread into a `pgTable` definition:
|
|
25
|
+
*
|
|
26
|
+
* pgTable('byline_admin_users', {
|
|
27
|
+
* id: uuid('id').primaryKey(),
|
|
28
|
+
* ...timestamps,
|
|
29
|
+
* })
|
|
30
|
+
*/
|
|
31
|
+
export const timestamps = {
|
|
32
|
+
created_at: auditTimestamp('created_at'),
|
|
33
|
+
updated_at: auditTimestamp('updated_at'),
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* `created_at` only — for tables whose rows are immutable once
|
|
37
|
+
* inserted (junction tables like `byline_admin_role_admin_user`,
|
|
38
|
+
* append-only relationship rows like `byline_document_relationships`,
|
|
39
|
+
* registry rows like `byline_counter_groups`).
|
|
40
|
+
*
|
|
41
|
+
* Spread into a `pgTable` definition the same way as `timestamps`.
|
|
42
|
+
*/
|
|
43
|
+
export const createdAt = {
|
|
44
|
+
created_at: auditTimestamp('created_at'),
|
|
45
|
+
};
|