@secondlayer/shared 11.3.0 → 11.4.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.
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Kysely, sql } from "kysely";
|
|
2
|
+
import { onControlPlane } from "../src/db/migration-role.ts";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Revoke active scoped `streams`/`index` API keys. Hosted `/v1` accepts
|
|
6
|
+
* `account` keys only (auth-007). The `product` column stays.
|
|
7
|
+
*/
|
|
8
|
+
export async function up(db: Kysely<unknown>): Promise<void> {
|
|
9
|
+
await onControlPlane(async () => {
|
|
10
|
+
await sql`SET lock_timeout = '30s'`.execute(db);
|
|
11
|
+
|
|
12
|
+
await sql`
|
|
13
|
+
UPDATE api_keys
|
|
14
|
+
SET status = 'revoked', revoked_at = NOW()
|
|
15
|
+
WHERE product IN ('streams', 'index') AND status = 'active'
|
|
16
|
+
`.execute(db);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export async function down(_db: Kysely<unknown>): Promise<void> {
|
|
21
|
+
// No-op: cannot know which rows were already revoked before this migration.
|
|
22
|
+
}
|