chore: auto-commit task -
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
CREATE TABLE "sticker_cache" (
|
||||
"name" text PRIMARY KEY NOT NULL,
|
||||
"base64" text NOT NULL,
|
||||
"mime_type" text NOT NULL,
|
||||
"size" integer NOT NULL,
|
||||
"fetched_at" bigint NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "text_analysis_cache" (
|
||||
"text" text PRIMARY KEY NOT NULL,
|
||||
"flags" text DEFAULT '[]' NOT NULL,
|
||||
"source" text DEFAULT 'local' NOT NULL,
|
||||
"analyzed_at" bigint NOT NULL,
|
||||
"expires_at" bigint NOT NULL,
|
||||
"hit_count" integer DEFAULT 0 NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX "idx_sticker_cache_fetched_at" ON "sticker_cache" USING btree ("fetched_at");--> statement-breakpoint
|
||||
CREATE INDEX "idx_text_analysis_cache_expires_at" ON "text_analysis_cache" USING btree ("expires_at");--> statement-breakpoint
|
||||
CREATE INDEX "idx_text_analysis_cache_source" ON "text_analysis_cache" USING btree ("source");
|
||||
File diff suppressed because it is too large
Load Diff
@@ -43,6 +43,13 @@
|
||||
"when": 1780218363791,
|
||||
"tag": "0006_fix_text_analysis_cache_source",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 7,
|
||||
"version": "7",
|
||||
"when": 1780396315249,
|
||||
"tag": "0007_black_nova",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
-- 0002_add_sticker_cache.sql
|
||||
-- Creates the sticker_cache table (defined in schema.ts but missing from migrations)
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "sticker_cache" (
|
||||
"name" text PRIMARY KEY NOT NULL,
|
||||
"base64" text NOT NULL,
|
||||
"mime_type" text NOT NULL,
|
||||
"size" integer NOT NULL,
|
||||
"fetched_at" bigint NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "idx_sticker_cache_fetched_at" ON "sticker_cache" ("fetched_at");
|
||||
@@ -0,0 +1,9 @@
|
||||
CREATE TABLE "sticker_cache" (
|
||||
"name" text PRIMARY KEY NOT NULL,
|
||||
"base64" text NOT NULL,
|
||||
"mime_type" text NOT NULL,
|
||||
"size" integer NOT NULL,
|
||||
"fetched_at" bigint NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX "idx_sticker_cache_fetched_at" ON "sticker_cache" USING btree ("fetched_at");
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,13 @@
|
||||
"when": 1780329074000,
|
||||
"tag": "0001_add_model_version_to_cache",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 2,
|
||||
"version": "7",
|
||||
"when": 1780396285346,
|
||||
"tag": "0002_rainy_jazinda",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -27,8 +27,23 @@ function sanitizeKey(name: string): string {
|
||||
export async function initStickerCache(): Promise<void> {
|
||||
if (ready) return;
|
||||
try {
|
||||
// Ensure the table exists — belt-and-suspenders in case the migration
|
||||
// hasn't run yet (e.g. pre-existing DB that Drizzle skips).
|
||||
await executeAll(`
|
||||
CREATE TABLE IF NOT EXISTS "sticker_cache" (
|
||||
"name" text PRIMARY KEY NOT NULL,
|
||||
"base64" text NOT NULL,
|
||||
"mime_type" text NOT NULL,
|
||||
"size" integer NOT NULL,
|
||||
"fetched_at" bigint NOT NULL
|
||||
)
|
||||
`);
|
||||
await executeAll(
|
||||
"DELETE FROM sticker_cache WHERE fetched_at < ?",
|
||||
`CREATE INDEX IF NOT EXISTS "idx_sticker_cache_fetched_at" ON "sticker_cache" USING btree ("fetched_at")`,
|
||||
);
|
||||
|
||||
await executeAll(
|
||||
"DELETE FROM sticker_cache WHERE fetched_at < $1",
|
||||
[Date.now() - TTL_MS],
|
||||
);
|
||||
const row = await executeGet(
|
||||
|
||||
@@ -27,8 +27,23 @@ function sanitizeKey(name: string): string {
|
||||
export async function initStickerCache(): Promise<void> {
|
||||
if (ready) return;
|
||||
try {
|
||||
// Ensure the table exists — belt-and-suspenders in case the migration
|
||||
// hasn't run yet (e.g. pre-existing DB that Drizzle skips).
|
||||
await executeAll(`
|
||||
CREATE TABLE IF NOT EXISTS "sticker_cache" (
|
||||
"name" text PRIMARY KEY NOT NULL,
|
||||
"base64" text NOT NULL,
|
||||
"mime_type" text NOT NULL,
|
||||
"size" integer NOT NULL,
|
||||
"fetched_at" bigint NOT NULL
|
||||
)
|
||||
`);
|
||||
await executeAll(
|
||||
"DELETE FROM sticker_cache WHERE fetched_at < ?",
|
||||
`CREATE INDEX IF NOT EXISTS "idx_sticker_cache_fetched_at" ON "sticker_cache" USING btree ("fetched_at")`,
|
||||
);
|
||||
|
||||
await executeAll(
|
||||
"DELETE FROM sticker_cache WHERE fetched_at < $1",
|
||||
[Date.now() - TTL_MS],
|
||||
);
|
||||
const row = await executeGet(
|
||||
|
||||
Reference in New Issue
Block a user