@coffre/db 0.1.11 → 0.1.12
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/connect.d.ts +1 -1
- package/dist/{database-BhLco7OA.d.ts → database-CNMfHZwF.d.ts} +1 -1
- package/dist/dialect.d.ts +1 -1
- package/dist/hyperdrive.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/log.d.ts +1 -1
- package/dist/migrations/postgres/0001_remove_syncs.sql +13 -0
- package/dist/migrations/postgres/meta/0001_snapshot.json +1707 -0
- package/dist/migrations/postgres/meta/_journal.json +7 -0
- package/dist/migrations/sqlite/0001_remove_syncs.sql +13 -0
- package/dist/migrations/sqlite/meta/0001_snapshot.json +1575 -0
- package/dist/migrations/sqlite/meta/_journal.json +7 -0
- package/dist/portable.d.ts +2 -2
- package/dist/{relations-DqgxtlKu.js → relations-BfR3JjT1.js} +2 -22
- package/dist/{schema-Cd4WOnB5.d.ts → schema-AmvM6w0D.d.ts} +2 -362
- package/dist/schema-sqlite.d.ts +1 -369
- package/dist/schema-sqlite.js +5 -59
- package/dist/schema-version.d.ts +5 -3
- package/dist/schema-version.js +4 -2
- package/dist/schema.d.ts +2 -2
- package/dist/schema.js +5 -79
- package/package.json +2 -2
- package/src/baseline.ts +11 -19
- package/src/migrations/postgres/0001_remove_syncs.sql +13 -0
- package/src/migrations/postgres/meta/0001_snapshot.json +1707 -0
- package/src/migrations/postgres/meta/_journal.json +7 -0
- package/src/migrations/sqlite/0001_remove_syncs.sql +13 -0
- package/src/migrations/sqlite/meta/0001_snapshot.json +1575 -0
- package/src/migrations/sqlite/meta/_journal.json +7 -0
- package/src/relations.ts +1 -14
- package/src/schema-version.ts +4 -2
- package/src/schema.sqlite.ts +1 -65
- package/src/schema.ts +1 -81
package/dist/schema-sqlite.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare namespace schema_sqlite_d_exports {
|
|
2
|
-
export { auditChainHead, auditLog, credentials, deviceAuthorizations, environments, environmentsRelations, identities, projects, secretVersions, secrets, secretsRelations,
|
|
2
|
+
export { auditChainHead, auditLog, credentials, deviceAuthorizations, environments, environmentsRelations, identities, projects, secretVersions, secrets, secretsRelations, vaultGrants, vaultMembers };
|
|
3
3
|
}
|
|
4
4
|
export declare const projects: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
5
5
|
name: "projects";
|
|
@@ -2209,379 +2209,11 @@ export declare const deviceAuthorizations: import("drizzle-orm/sqlite-core").SQL
|
|
|
2209
2209
|
};
|
|
2210
2210
|
dialect: "sqlite";
|
|
2211
2211
|
}>;
|
|
2212
|
-
export declare const syncs: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
2213
|
-
name: "syncs";
|
|
2214
|
-
schema: undefined;
|
|
2215
|
-
columns: {
|
|
2216
|
-
id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2217
|
-
name: "id";
|
|
2218
|
-
tableName: "syncs";
|
|
2219
|
-
dataType: "string";
|
|
2220
|
-
columnType: "SQLiteText";
|
|
2221
|
-
data: string;
|
|
2222
|
-
driverParam: string;
|
|
2223
|
-
notNull: true;
|
|
2224
|
-
hasDefault: false;
|
|
2225
|
-
isPrimaryKey: true;
|
|
2226
|
-
isAutoincrement: false;
|
|
2227
|
-
hasRuntimeDefault: false;
|
|
2228
|
-
enumValues: [string, ...string[]];
|
|
2229
|
-
baseColumn: never;
|
|
2230
|
-
identity: undefined;
|
|
2231
|
-
generated: undefined;
|
|
2232
|
-
}, {}, {
|
|
2233
|
-
length: undefined;
|
|
2234
|
-
}>;
|
|
2235
|
-
projectId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2236
|
-
name: "project_id";
|
|
2237
|
-
tableName: "syncs";
|
|
2238
|
-
dataType: "string";
|
|
2239
|
-
columnType: "SQLiteText";
|
|
2240
|
-
data: string;
|
|
2241
|
-
driverParam: string;
|
|
2242
|
-
notNull: true;
|
|
2243
|
-
hasDefault: false;
|
|
2244
|
-
isPrimaryKey: false;
|
|
2245
|
-
isAutoincrement: false;
|
|
2246
|
-
hasRuntimeDefault: false;
|
|
2247
|
-
enumValues: [string, ...string[]];
|
|
2248
|
-
baseColumn: never;
|
|
2249
|
-
identity: undefined;
|
|
2250
|
-
generated: undefined;
|
|
2251
|
-
}, {}, {
|
|
2252
|
-
length: number | undefined;
|
|
2253
|
-
}>;
|
|
2254
|
-
environmentId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2255
|
-
name: "environment_id";
|
|
2256
|
-
tableName: "syncs";
|
|
2257
|
-
dataType: "string";
|
|
2258
|
-
columnType: "SQLiteText";
|
|
2259
|
-
data: string;
|
|
2260
|
-
driverParam: string;
|
|
2261
|
-
notNull: true;
|
|
2262
|
-
hasDefault: false;
|
|
2263
|
-
isPrimaryKey: false;
|
|
2264
|
-
isAutoincrement: false;
|
|
2265
|
-
hasRuntimeDefault: false;
|
|
2266
|
-
enumValues: [string, ...string[]];
|
|
2267
|
-
baseColumn: never;
|
|
2268
|
-
identity: undefined;
|
|
2269
|
-
generated: undefined;
|
|
2270
|
-
}, {}, {
|
|
2271
|
-
length: number | undefined;
|
|
2272
|
-
}>;
|
|
2273
|
-
provider: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2274
|
-
name: "provider";
|
|
2275
|
-
tableName: "syncs";
|
|
2276
|
-
dataType: "string";
|
|
2277
|
-
columnType: "SQLiteText";
|
|
2278
|
-
data: string;
|
|
2279
|
-
driverParam: string;
|
|
2280
|
-
notNull: true;
|
|
2281
|
-
hasDefault: false;
|
|
2282
|
-
isPrimaryKey: false;
|
|
2283
|
-
isAutoincrement: false;
|
|
2284
|
-
hasRuntimeDefault: false;
|
|
2285
|
-
enumValues: [string, ...string[]];
|
|
2286
|
-
baseColumn: never;
|
|
2287
|
-
identity: undefined;
|
|
2288
|
-
generated: undefined;
|
|
2289
|
-
}, {}, {
|
|
2290
|
-
length: undefined;
|
|
2291
|
-
}>;
|
|
2292
|
-
config: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2293
|
-
name: "config";
|
|
2294
|
-
tableName: "syncs";
|
|
2295
|
-
dataType: "string";
|
|
2296
|
-
columnType: "SQLiteText";
|
|
2297
|
-
data: string;
|
|
2298
|
-
driverParam: string;
|
|
2299
|
-
notNull: true;
|
|
2300
|
-
hasDefault: false;
|
|
2301
|
-
isPrimaryKey: false;
|
|
2302
|
-
isAutoincrement: false;
|
|
2303
|
-
hasRuntimeDefault: false;
|
|
2304
|
-
enumValues: [string, ...string[]];
|
|
2305
|
-
baseColumn: never;
|
|
2306
|
-
identity: undefined;
|
|
2307
|
-
generated: undefined;
|
|
2308
|
-
}, {}, {
|
|
2309
|
-
length: undefined;
|
|
2310
|
-
}>;
|
|
2311
|
-
credentialSecretId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2312
|
-
name: "credential_secret_id";
|
|
2313
|
-
tableName: "syncs";
|
|
2314
|
-
dataType: "string";
|
|
2315
|
-
columnType: "SQLiteText";
|
|
2316
|
-
data: string;
|
|
2317
|
-
driverParam: string;
|
|
2318
|
-
notNull: true;
|
|
2319
|
-
hasDefault: false;
|
|
2320
|
-
isPrimaryKey: false;
|
|
2321
|
-
isAutoincrement: false;
|
|
2322
|
-
hasRuntimeDefault: false;
|
|
2323
|
-
enumValues: [string, ...string[]];
|
|
2324
|
-
baseColumn: never;
|
|
2325
|
-
identity: undefined;
|
|
2326
|
-
generated: undefined;
|
|
2327
|
-
}, {}, {
|
|
2328
|
-
length: number | undefined;
|
|
2329
|
-
}>;
|
|
2330
|
-
createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2331
|
-
name: string;
|
|
2332
|
-
tableName: "syncs";
|
|
2333
|
-
dataType: "date";
|
|
2334
|
-
columnType: "SQLiteTimestamp";
|
|
2335
|
-
data: Date;
|
|
2336
|
-
driverParam: number;
|
|
2337
|
-
notNull: true;
|
|
2338
|
-
hasDefault: true;
|
|
2339
|
-
isPrimaryKey: false;
|
|
2340
|
-
isAutoincrement: false;
|
|
2341
|
-
hasRuntimeDefault: false;
|
|
2342
|
-
enumValues: undefined;
|
|
2343
|
-
baseColumn: never;
|
|
2344
|
-
identity: undefined;
|
|
2345
|
-
generated: undefined;
|
|
2346
|
-
}, {}, {}>;
|
|
2347
|
-
createdBy: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2348
|
-
name: "created_by";
|
|
2349
|
-
tableName: "syncs";
|
|
2350
|
-
dataType: "string";
|
|
2351
|
-
columnType: "SQLiteText";
|
|
2352
|
-
data: string;
|
|
2353
|
-
driverParam: string;
|
|
2354
|
-
notNull: true;
|
|
2355
|
-
hasDefault: false;
|
|
2356
|
-
isPrimaryKey: false;
|
|
2357
|
-
isAutoincrement: false;
|
|
2358
|
-
hasRuntimeDefault: false;
|
|
2359
|
-
enumValues: [string, ...string[]];
|
|
2360
|
-
baseColumn: never;
|
|
2361
|
-
identity: undefined;
|
|
2362
|
-
generated: undefined;
|
|
2363
|
-
}, {}, {
|
|
2364
|
-
length: number | undefined;
|
|
2365
|
-
}>;
|
|
2366
|
-
pausedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2367
|
-
name: string;
|
|
2368
|
-
tableName: "syncs";
|
|
2369
|
-
dataType: "date";
|
|
2370
|
-
columnType: "SQLiteTimestamp";
|
|
2371
|
-
data: Date;
|
|
2372
|
-
driverParam: number;
|
|
2373
|
-
notNull: false;
|
|
2374
|
-
hasDefault: false;
|
|
2375
|
-
isPrimaryKey: false;
|
|
2376
|
-
isAutoincrement: false;
|
|
2377
|
-
hasRuntimeDefault: false;
|
|
2378
|
-
enumValues: undefined;
|
|
2379
|
-
baseColumn: never;
|
|
2380
|
-
identity: undefined;
|
|
2381
|
-
generated: undefined;
|
|
2382
|
-
}, {}, {}>;
|
|
2383
|
-
archivedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2384
|
-
name: string;
|
|
2385
|
-
tableName: "syncs";
|
|
2386
|
-
dataType: "date";
|
|
2387
|
-
columnType: "SQLiteTimestamp";
|
|
2388
|
-
data: Date;
|
|
2389
|
-
driverParam: number;
|
|
2390
|
-
notNull: false;
|
|
2391
|
-
hasDefault: false;
|
|
2392
|
-
isPrimaryKey: false;
|
|
2393
|
-
isAutoincrement: false;
|
|
2394
|
-
hasRuntimeDefault: false;
|
|
2395
|
-
enumValues: undefined;
|
|
2396
|
-
baseColumn: never;
|
|
2397
|
-
identity: undefined;
|
|
2398
|
-
generated: undefined;
|
|
2399
|
-
}, {}, {}>;
|
|
2400
|
-
leaseUntil: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2401
|
-
name: string;
|
|
2402
|
-
tableName: "syncs";
|
|
2403
|
-
dataType: "date";
|
|
2404
|
-
columnType: "SQLiteTimestamp";
|
|
2405
|
-
data: Date;
|
|
2406
|
-
driverParam: number;
|
|
2407
|
-
notNull: false;
|
|
2408
|
-
hasDefault: false;
|
|
2409
|
-
isPrimaryKey: false;
|
|
2410
|
-
isAutoincrement: false;
|
|
2411
|
-
hasRuntimeDefault: false;
|
|
2412
|
-
enumValues: undefined;
|
|
2413
|
-
baseColumn: never;
|
|
2414
|
-
identity: undefined;
|
|
2415
|
-
generated: undefined;
|
|
2416
|
-
}, {}, {}>;
|
|
2417
|
-
lastRunAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2418
|
-
name: string;
|
|
2419
|
-
tableName: "syncs";
|
|
2420
|
-
dataType: "date";
|
|
2421
|
-
columnType: "SQLiteTimestamp";
|
|
2422
|
-
data: Date;
|
|
2423
|
-
driverParam: number;
|
|
2424
|
-
notNull: false;
|
|
2425
|
-
hasDefault: false;
|
|
2426
|
-
isPrimaryKey: false;
|
|
2427
|
-
isAutoincrement: false;
|
|
2428
|
-
hasRuntimeDefault: false;
|
|
2429
|
-
enumValues: undefined;
|
|
2430
|
-
baseColumn: never;
|
|
2431
|
-
identity: undefined;
|
|
2432
|
-
generated: undefined;
|
|
2433
|
-
}, {}, {}>;
|
|
2434
|
-
lastStatus: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2435
|
-
name: "last_status";
|
|
2436
|
-
tableName: "syncs";
|
|
2437
|
-
dataType: "string";
|
|
2438
|
-
columnType: "SQLiteText";
|
|
2439
|
-
data: string;
|
|
2440
|
-
driverParam: string;
|
|
2441
|
-
notNull: false;
|
|
2442
|
-
hasDefault: false;
|
|
2443
|
-
isPrimaryKey: false;
|
|
2444
|
-
isAutoincrement: false;
|
|
2445
|
-
hasRuntimeDefault: false;
|
|
2446
|
-
enumValues: [string, ...string[]];
|
|
2447
|
-
baseColumn: never;
|
|
2448
|
-
identity: undefined;
|
|
2449
|
-
generated: undefined;
|
|
2450
|
-
}, {}, {
|
|
2451
|
-
length: number | undefined;
|
|
2452
|
-
}>;
|
|
2453
|
-
lastError: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2454
|
-
name: "last_error";
|
|
2455
|
-
tableName: "syncs";
|
|
2456
|
-
dataType: "string";
|
|
2457
|
-
columnType: "SQLiteText";
|
|
2458
|
-
data: string;
|
|
2459
|
-
driverParam: string;
|
|
2460
|
-
notNull: false;
|
|
2461
|
-
hasDefault: false;
|
|
2462
|
-
isPrimaryKey: false;
|
|
2463
|
-
isAutoincrement: false;
|
|
2464
|
-
hasRuntimeDefault: false;
|
|
2465
|
-
enumValues: [string, ...string[]];
|
|
2466
|
-
baseColumn: never;
|
|
2467
|
-
identity: undefined;
|
|
2468
|
-
generated: undefined;
|
|
2469
|
-
}, {}, {
|
|
2470
|
-
length: number | undefined;
|
|
2471
|
-
}>;
|
|
2472
|
-
};
|
|
2473
|
-
dialect: "sqlite";
|
|
2474
|
-
}>;
|
|
2475
|
-
export declare const syncKeys: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
2476
|
-
name: "sync_keys";
|
|
2477
|
-
schema: undefined;
|
|
2478
|
-
columns: {
|
|
2479
|
-
syncId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2480
|
-
name: "sync_id";
|
|
2481
|
-
tableName: "sync_keys";
|
|
2482
|
-
dataType: "string";
|
|
2483
|
-
columnType: "SQLiteText";
|
|
2484
|
-
data: string;
|
|
2485
|
-
driverParam: string;
|
|
2486
|
-
notNull: true;
|
|
2487
|
-
hasDefault: false;
|
|
2488
|
-
isPrimaryKey: false;
|
|
2489
|
-
isAutoincrement: false;
|
|
2490
|
-
hasRuntimeDefault: false;
|
|
2491
|
-
enumValues: [string, ...string[]];
|
|
2492
|
-
baseColumn: never;
|
|
2493
|
-
identity: undefined;
|
|
2494
|
-
generated: undefined;
|
|
2495
|
-
}, {}, {
|
|
2496
|
-
length: number | undefined;
|
|
2497
|
-
}>;
|
|
2498
|
-
key: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2499
|
-
name: "key";
|
|
2500
|
-
tableName: "sync_keys";
|
|
2501
|
-
dataType: "string";
|
|
2502
|
-
columnType: "SQLiteText";
|
|
2503
|
-
data: string;
|
|
2504
|
-
driverParam: string;
|
|
2505
|
-
notNull: true;
|
|
2506
|
-
hasDefault: false;
|
|
2507
|
-
isPrimaryKey: false;
|
|
2508
|
-
isAutoincrement: false;
|
|
2509
|
-
hasRuntimeDefault: false;
|
|
2510
|
-
enumValues: [string, ...string[]];
|
|
2511
|
-
baseColumn: never;
|
|
2512
|
-
identity: undefined;
|
|
2513
|
-
generated: undefined;
|
|
2514
|
-
}, {}, {
|
|
2515
|
-
length: undefined;
|
|
2516
|
-
}>;
|
|
2517
|
-
secretVersionId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2518
|
-
name: "secret_version_id";
|
|
2519
|
-
tableName: "sync_keys";
|
|
2520
|
-
dataType: "string";
|
|
2521
|
-
columnType: "SQLiteText";
|
|
2522
|
-
data: string;
|
|
2523
|
-
driverParam: string;
|
|
2524
|
-
notNull: false;
|
|
2525
|
-
hasDefault: false;
|
|
2526
|
-
isPrimaryKey: false;
|
|
2527
|
-
isAutoincrement: false;
|
|
2528
|
-
hasRuntimeDefault: false;
|
|
2529
|
-
enumValues: [string, ...string[]];
|
|
2530
|
-
baseColumn: never;
|
|
2531
|
-
identity: undefined;
|
|
2532
|
-
generated: undefined;
|
|
2533
|
-
}, {}, {
|
|
2534
|
-
length: number | undefined;
|
|
2535
|
-
}>;
|
|
2536
|
-
pushedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2537
|
-
name: string;
|
|
2538
|
-
tableName: "sync_keys";
|
|
2539
|
-
dataType: "date";
|
|
2540
|
-
columnType: "SQLiteTimestamp";
|
|
2541
|
-
data: Date;
|
|
2542
|
-
driverParam: number;
|
|
2543
|
-
notNull: true;
|
|
2544
|
-
hasDefault: true;
|
|
2545
|
-
isPrimaryKey: false;
|
|
2546
|
-
isAutoincrement: false;
|
|
2547
|
-
hasRuntimeDefault: false;
|
|
2548
|
-
enumValues: undefined;
|
|
2549
|
-
baseColumn: never;
|
|
2550
|
-
identity: undefined;
|
|
2551
|
-
generated: undefined;
|
|
2552
|
-
}, {}, {}>;
|
|
2553
|
-
removedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2554
|
-
name: string;
|
|
2555
|
-
tableName: "sync_keys";
|
|
2556
|
-
dataType: "date";
|
|
2557
|
-
columnType: "SQLiteTimestamp";
|
|
2558
|
-
data: Date;
|
|
2559
|
-
driverParam: number;
|
|
2560
|
-
notNull: false;
|
|
2561
|
-
hasDefault: false;
|
|
2562
|
-
isPrimaryKey: false;
|
|
2563
|
-
isAutoincrement: false;
|
|
2564
|
-
hasRuntimeDefault: false;
|
|
2565
|
-
enumValues: undefined;
|
|
2566
|
-
baseColumn: never;
|
|
2567
|
-
identity: undefined;
|
|
2568
|
-
generated: undefined;
|
|
2569
|
-
}, {}, {}>;
|
|
2570
|
-
};
|
|
2571
|
-
dialect: "sqlite";
|
|
2572
|
-
}>;
|
|
2573
2212
|
export declare const environmentsRelations: import("drizzle-orm").Relations<"environments", {
|
|
2574
2213
|
project: import("drizzle-orm").One<"projects", true>;
|
|
2575
2214
|
}>, secretsRelations: import("drizzle-orm").Relations<"secrets", {
|
|
2576
2215
|
project: import("drizzle-orm").One<"projects", true>;
|
|
2577
2216
|
environment: import("drizzle-orm").One<"environments", true>;
|
|
2578
|
-
}>, syncsRelations: import("drizzle-orm").Relations<"syncs", {
|
|
2579
|
-
project: import("drizzle-orm").One<"projects", true>;
|
|
2580
|
-
environment: import("drizzle-orm").One<"environments", true>;
|
|
2581
|
-
credential: import("drizzle-orm").One<"secrets", true>;
|
|
2582
|
-
keys: import("drizzle-orm").Many<"sync_keys">;
|
|
2583
|
-
}>, syncKeysRelations: import("drizzle-orm").Relations<"sync_keys", {
|
|
2584
|
-
sync: import("drizzle-orm").One<"syncs", true>;
|
|
2585
2217
|
}>;
|
|
2586
2218
|
//#endregion
|
|
2587
2219
|
export { schema_sqlite_d_exports as t };
|
package/dist/schema-sqlite.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as relationsOf, t as ACTIVE_SUBJECT } from "./relations-
|
|
1
|
+
import { n as relationsOf, t as ACTIVE_SUBJECT } from "./relations-BfR3JjT1.js";
|
|
2
2
|
import { asPostgres } from "./portable.js";
|
|
3
3
|
import { sql } from "drizzle-orm";
|
|
4
4
|
import { ROLE_NAMES, assignableToEnvironment } from "@coffre/core/access";
|
|
5
|
-
import { blob, check, customType, foreignKey, index, integer,
|
|
5
|
+
import { blob, check, customType, foreignKey, index, integer, sqliteTable, text, unique, uniqueIndex } from "drizzle-orm/sqlite-core";
|
|
6
6
|
//#region src/schema.sqlite.ts
|
|
7
7
|
/**
|
|
8
8
|
* The schema in schema.ts, for SQLite (through libsql). Same tables,
|
|
@@ -337,65 +337,11 @@ const deviceAuthorizations = sqliteTable("device_authorizations", {
|
|
|
337
337
|
foreignColumns: [vaultMembers.principal]
|
|
338
338
|
}).onDelete("restrict")
|
|
339
339
|
]);
|
|
340
|
-
const
|
|
341
|
-
id: text().primaryKey(),
|
|
342
|
-
projectId: text("project_id").notNull(),
|
|
343
|
-
environmentId: text("environment_id").notNull(),
|
|
344
|
-
provider: text().notNull(),
|
|
345
|
-
config: text().notNull(),
|
|
346
|
-
credentialSecretId: text("credential_secret_id").notNull(),
|
|
347
|
-
createdAt: createdAt(),
|
|
348
|
-
createdBy: text("created_by").notNull(),
|
|
349
|
-
pausedAt: time("paused_at"),
|
|
350
|
-
archivedAt: time("archived_at"),
|
|
351
|
-
leaseUntil: time("lease_until"),
|
|
352
|
-
lastRunAt: time("last_run_at"),
|
|
353
|
-
lastStatus: text("last_status"),
|
|
354
|
-
lastError: text("last_error")
|
|
355
|
-
}, (table) => [
|
|
356
|
-
check("syncs_config_check", sql`json_valid(${table.config})`),
|
|
357
|
-
check("syncs_last_status_check", sql`${table.lastStatus} IS NULL OR ${table.lastStatus} IN ('ok', 'partial', 'failed')`),
|
|
358
|
-
foreignKey({
|
|
359
|
-
name: "syncs_environment_in_project",
|
|
360
|
-
columns: [table.environmentId, table.projectId],
|
|
361
|
-
foreignColumns: [environments.id, environments.projectId]
|
|
362
|
-
}).onDelete("restrict"),
|
|
363
|
-
foreignKey({
|
|
364
|
-
name: "syncs_credential_secret_id_fkey",
|
|
365
|
-
columns: [table.credentialSecretId],
|
|
366
|
-
foreignColumns: [secrets.id]
|
|
367
|
-
}).onDelete("restrict"),
|
|
368
|
-
index("syncs_environment_idx").on(table.environmentId)
|
|
369
|
-
]);
|
|
370
|
-
const syncKeys = sqliteTable("sync_keys", {
|
|
371
|
-
syncId: text("sync_id").notNull(),
|
|
372
|
-
key: text().notNull(),
|
|
373
|
-
secretVersionId: text("secret_version_id"),
|
|
374
|
-
pushedAt: time("pushed_at").notNull().default(now),
|
|
375
|
-
removedAt: time("removed_at")
|
|
376
|
-
}, (table) => [
|
|
377
|
-
primaryKey({
|
|
378
|
-
name: "sync_keys_pkey",
|
|
379
|
-
columns: [table.syncId, table.key]
|
|
380
|
-
}),
|
|
381
|
-
foreignKey({
|
|
382
|
-
name: "sync_keys_sync_id_fkey",
|
|
383
|
-
columns: [table.syncId],
|
|
384
|
-
foreignColumns: [syncs.id]
|
|
385
|
-
}).onDelete("restrict"),
|
|
386
|
-
foreignKey({
|
|
387
|
-
name: "sync_keys_secret_version_id_fkey",
|
|
388
|
-
columns: [table.secretVersionId],
|
|
389
|
-
foreignColumns: [secretVersions.id]
|
|
390
|
-
}).onDelete("restrict")
|
|
391
|
-
]);
|
|
392
|
-
const { environmentsRelations, secretsRelations, syncsRelations, syncKeysRelations } = relationsOf(asPostgres({
|
|
340
|
+
const { environmentsRelations, secretsRelations } = relationsOf(asPostgres({
|
|
393
341
|
projects,
|
|
394
342
|
environments,
|
|
395
343
|
secrets,
|
|
396
|
-
secretVersions
|
|
397
|
-
syncs,
|
|
398
|
-
syncKeys
|
|
344
|
+
secretVersions
|
|
399
345
|
}));
|
|
400
346
|
//#endregion
|
|
401
|
-
export { auditChainHead, auditLog, credentials, deviceAuthorizations, environments, environmentsRelations, identities, projects, secretVersions, secrets, secretsRelations,
|
|
347
|
+
export { auditChainHead, auditLog, credentials, deviceAuthorizations, environments, environmentsRelations, identities, projects, secretVersions, secrets, secretsRelations, vaultGrants, vaultMembers };
|
package/dist/schema-version.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { i as Queryable } from "./database-
|
|
1
|
+
import { i as Queryable } from "./database-CNMfHZwF.js";
|
|
2
2
|
import { Engine } from "./dialect.js";
|
|
3
3
|
//#region src/schema-version.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Minimum migration prefix required by this application image, per engine:
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Advance this only when the runtime needs the new schema. The sync-removal
|
|
7
|
+
* migration only drops unused tables: new code works with either prefix,
|
|
8
|
+
* so Workers Builds can deploy before an owner runs the migration.
|
|
9
|
+
* Applied migrations remain immutable (see baseline.ts).
|
|
8
10
|
*/
|
|
9
11
|
export declare const REQUIRED_MIGRATIONS: Record<Engine, number>;
|
|
10
12
|
export declare function requiredMigrations(db: Queryable): number;
|
package/dist/schema-version.js
CHANGED
|
@@ -2,8 +2,10 @@ import { engineOf } from "./dialect.js";
|
|
|
2
2
|
//#region src/schema-version.ts
|
|
3
3
|
/**
|
|
4
4
|
* Minimum migration prefix required by this application image, per engine:
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Advance this only when the runtime needs the new schema. The sync-removal
|
|
6
|
+
* migration only drops unused tables: new code works with either prefix,
|
|
7
|
+
* so Workers Builds can deploy before an owner runs the migration.
|
|
8
|
+
* Applied migrations remain immutable (see baseline.ts).
|
|
7
9
|
*/
|
|
8
10
|
const REQUIRED_MIGRATIONS = {
|
|
9
11
|
postgres: 1,
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { auditChainHead, auditLog, credentials, deviceAuthorizations, environments, environmentsRelations, identities, projects, secretVersions, secrets, secretsRelations,
|
|
1
|
+
import { a as environments, c as projects, d as secrets, f as secretsRelations, i as deviceAuthorizations, m as vaultMembers, n as auditLog, o as environmentsRelations, p as vaultGrants, r as credentials, s as identities, t as auditChainHead, u as secretVersions } from "./schema-AmvM6w0D.js";
|
|
2
|
+
export { auditChainHead, auditLog, credentials, deviceAuthorizations, environments, environmentsRelations, identities, projects, secretVersions, secrets, secretsRelations, vaultGrants, vaultMembers };
|
package/dist/schema.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import { n as relationsOf, t as ACTIVE_SUBJECT } from "./relations-
|
|
2
|
+
import { n as relationsOf, t as ACTIVE_SUBJECT } from "./relations-BfR3JjT1.js";
|
|
3
3
|
import { sql } from "drizzle-orm";
|
|
4
4
|
import { ROLE_NAMES, assignableToEnvironment } from "@coffre/core/access";
|
|
5
|
-
import { bigint, boolean, check, customType, foreignKey, index, integer, pgTable,
|
|
5
|
+
import { bigint, boolean, check, customType, foreignKey, index, integer, pgTable, text, timestamp, unique, uniqueIndex, uuid } from "drizzle-orm/pg-core";
|
|
6
6
|
//#region src/schema.ts
|
|
7
7
|
var schema_exports = /* @__PURE__ */ __exportAll({
|
|
8
8
|
auditChainHead: () => auditChainHead,
|
|
@@ -16,10 +16,6 @@ var schema_exports = /* @__PURE__ */ __exportAll({
|
|
|
16
16
|
secretVersions: () => secretVersions,
|
|
17
17
|
secrets: () => secrets,
|
|
18
18
|
secretsRelations: () => secretsRelations,
|
|
19
|
-
syncKeys: () => syncKeys,
|
|
20
|
-
syncKeysRelations: () => syncKeysRelations,
|
|
21
|
-
syncs: () => syncs,
|
|
22
|
-
syncsRelations: () => syncsRelations,
|
|
23
19
|
vaultGrants: () => vaultGrants,
|
|
24
20
|
vaultMembers: () => vaultMembers
|
|
25
21
|
});
|
|
@@ -368,81 +364,11 @@ const deviceAuthorizations = pgTable("device_authorizations", {
|
|
|
368
364
|
foreignColumns: [vaultMembers.principal]
|
|
369
365
|
}).onDelete("restrict")
|
|
370
366
|
]);
|
|
371
|
-
|
|
372
|
-
* An environment kept in step with a third-party service: GitHub Actions
|
|
373
|
-
* secrets, Vercel or Railway variables, Worker secrets.
|
|
374
|
-
*
|
|
375
|
-
* The destination's API token is itself a coffre secret, referenced by id, so
|
|
376
|
-
* it is encrypted, versioned and audited like everything else and never sits
|
|
377
|
-
* in this table.
|
|
378
|
-
*/
|
|
379
|
-
const syncs = pgTable("syncs", {
|
|
380
|
-
id: uuid().primaryKey().defaultRandom(),
|
|
381
|
-
projectId: uuid("project_id").notNull(),
|
|
382
|
-
environmentId: uuid("environment_id").notNull(),
|
|
383
|
-
provider: text().notNull(),
|
|
384
|
-
config: text().notNull(),
|
|
385
|
-
credentialSecretId: uuid("credential_secret_id").notNull(),
|
|
386
|
-
createdAt: createdAt(),
|
|
387
|
-
createdBy: text("created_by").notNull(),
|
|
388
|
-
pausedAt: timestamp("paused_at", { withTimezone: true }),
|
|
389
|
-
archivedAt: timestamp("archived_at", { withTimezone: true }),
|
|
390
|
-
leaseUntil: timestamp("lease_until", { withTimezone: true }),
|
|
391
|
-
lastRunAt: timestamp("last_run_at", { withTimezone: true }),
|
|
392
|
-
lastStatus: text("last_status"),
|
|
393
|
-
lastError: text("last_error")
|
|
394
|
-
}, (table) => [
|
|
395
|
-
check("syncs_config_check", sql`${table.config}::jsonb IS NOT NULL`),
|
|
396
|
-
check("syncs_last_status_check", sql`${table.lastStatus} IS NULL OR ${table.lastStatus} IN ('ok', 'partial', 'failed')`),
|
|
397
|
-
foreignKey({
|
|
398
|
-
name: "syncs_environment_in_project",
|
|
399
|
-
columns: [table.environmentId, table.projectId],
|
|
400
|
-
foreignColumns: [environments.id, environments.projectId]
|
|
401
|
-
}).onDelete("restrict"),
|
|
402
|
-
foreignKey({
|
|
403
|
-
name: "syncs_credential_secret_id_fkey",
|
|
404
|
-
columns: [table.credentialSecretId],
|
|
405
|
-
foreignColumns: [secrets.id]
|
|
406
|
-
}).onDelete("restrict"),
|
|
407
|
-
index("syncs_environment_idx").on(table.environmentId)
|
|
408
|
-
]);
|
|
409
|
-
/**
|
|
410
|
-
* What a sync last pushed, one row per key.
|
|
411
|
-
*
|
|
412
|
-
* Most destinations are write-only, so coffre cannot diff against them. It
|
|
413
|
-
* diffs against this instead: a key is stale when its secret has moved past
|
|
414
|
-
* the version recorded here. It is also the list of keys coffre may delete at
|
|
415
|
-
* the destination; a key it never pushed is never removed.
|
|
416
|
-
*/
|
|
417
|
-
const syncKeys = pgTable("sync_keys", {
|
|
418
|
-
syncId: uuid("sync_id").notNull(),
|
|
419
|
-
key: text().notNull(),
|
|
420
|
-
secretVersionId: uuid("secret_version_id"),
|
|
421
|
-
pushedAt: timestamp("pushed_at", { withTimezone: true }).notNull().defaultNow(),
|
|
422
|
-
removedAt: timestamp("removed_at", { withTimezone: true })
|
|
423
|
-
}, (table) => [
|
|
424
|
-
primaryKey({
|
|
425
|
-
name: "sync_keys_pkey",
|
|
426
|
-
columns: [table.syncId, table.key]
|
|
427
|
-
}),
|
|
428
|
-
foreignKey({
|
|
429
|
-
name: "sync_keys_sync_id_fkey",
|
|
430
|
-
columns: [table.syncId],
|
|
431
|
-
foreignColumns: [syncs.id]
|
|
432
|
-
}).onDelete("restrict"),
|
|
433
|
-
foreignKey({
|
|
434
|
-
name: "sync_keys_secret_version_id_fkey",
|
|
435
|
-
columns: [table.secretVersionId],
|
|
436
|
-
foreignColumns: [secretVersions.id]
|
|
437
|
-
}).onDelete("restrict")
|
|
438
|
-
]);
|
|
439
|
-
const { environmentsRelations, secretsRelations, syncsRelations, syncKeysRelations } = relationsOf({
|
|
367
|
+
const { environmentsRelations, secretsRelations } = relationsOf({
|
|
440
368
|
projects,
|
|
441
369
|
environments,
|
|
442
370
|
secrets,
|
|
443
|
-
secretVersions
|
|
444
|
-
syncs,
|
|
445
|
-
syncKeys
|
|
371
|
+
secretVersions
|
|
446
372
|
});
|
|
447
373
|
//#endregion
|
|
448
|
-
export { auditChainHead, auditLog, credentials, deviceAuthorizations, environments, environmentsRelations, identities, projects, secretVersions, secrets, secretsRelations,
|
|
374
|
+
export { auditChainHead, auditLog, credentials, deviceAuthorizations, environments, environmentsRelations, identities, projects, secretVersions, secrets, secretsRelations, schema_exports as t, vaultGrants, vaultMembers };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coffre/db",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "coffre's database: the schema, its migrations and the connections, on Postgres or SQLite.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"drizzle-orm": "0.45.2",
|
|
75
75
|
"pg": "8.16.3",
|
|
76
76
|
"pg-connection-string": "2.14.0",
|
|
77
|
-
"@coffre/core": "0.1.
|
|
77
|
+
"@coffre/core": "0.1.12"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@types/node": "26.1.1",
|