fix: lazily import sharp to fix commonjs error

This commit is contained in:
Max Richter
2026-01-10 20:13:15 +01:00
parent c74a19b527
commit 47d32d68c7
18 changed files with 145 additions and 68 deletions

View File

@@ -1,20 +1,22 @@
CREATE TABLE `performance` (
`path` text NOT NULL,
`search` text,
`time` integer NOT NULL,
`created_at` integer DEFAULT (current_timestamp)
`path` text NOT NULL,
`search` text,
`time` integer NOT NULL,
`created_at` integer DEFAULT (CURRENT_TIMESTAMP)
);
--> statement-breakpoint
CREATE TABLE `session` (
`id` text PRIMARY KEY NOT NULL,
`created_at` integer DEFAULT (current_timestamp),
`expires_at` integer NOT NULL,
`user_id` text NOT NULL
`id` text PRIMARY KEY NOT NULL,
`created_at` integer DEFAULT (CURRENT_TIMESTAMP),
`expires_at` integer NOT NULL,
`user_id` text NOT NULL
);
--> statement-breakpoint
CREATE TABLE `user` (
`id` text PRIMARY KEY NOT NULL,
`created_at` integer DEFAULT (current_timestamp) NOT NULL,
`email` text NOT NULL,
`name` text NOT NULL
`id` text PRIMARY KEY NOT NULL,
`created_at` integer DEFAULT (CURRENT_TIMESTAMP) NOT NULL,
`email` text NOT NULL,
`name` text NOT NULL
);

View File

@@ -1 +1,4 @@
ALTER TABLE `performance` ALTER COLUMN "created_at" TO "created_at" integer DEFAULT (STRFTIME('%s', 'now') * 1000);
ALTER TABLE
`performance`
ALTER COLUMN
"created_at" TO "created_at" integer DEFAULT (STRFTIME('%s', 'now') * 1000);

View File

@@ -1,7 +1,7 @@
CREATE TABLE `image` (
`created_at` integer DEFAULT (current_timestamp),
`url` text NOT NULL,
`average` text NOT NULL,
`blurhash` text NOT NULL,
`mime` text NOT NULL
`created_at` integer DEFAULT (CURRENT_TIMESTAMP),
`url` text NOT NULL,
`average` text NOT NULL,
`blurhash` text NOT NULL,
`mime` text NOT NULL
);

View File

@@ -1,7 +1,7 @@
CREATE TABLE `document` (
`name` text NOT NULL,
`last_modified` integer NOT NULL,
`contentType` text NOT NULL,
`size` integer NOT NULL,
`perm` text NOT NULL
`name` text NOT NULL,
`last_modified` integer NOT NULL,
`contentType` text NOT NULL,
`size` integer NOT NULL,
`perm` text NOT NULL
);

View File

@@ -1,13 +1,38 @@
PRAGMA foreign_keys=OFF;--> statement-breakpoint
CREATE TABLE `__new_document` (
`name` text PRIMARY KEY NOT NULL,
`last_modified` integer NOT NULL,
`contentType` text NOT NULL,
`size` integer NOT NULL,
`perm` text NOT NULL
);
PRAGMA foreign_keys = OFF;
--> statement-breakpoint
INSERT INTO `__new_document`("name", "last_modified", "contentType", "size", "perm") SELECT "name", "last_modified", "contentType", "size", "perm" FROM `document`;--> statement-breakpoint
DROP TABLE `document`;--> statement-breakpoint
ALTER TABLE `__new_document` RENAME TO `document`;--> statement-breakpoint
PRAGMA foreign_keys=ON;
CREATE TABLE `__new_document` (
`name` text PRIMARY KEY NOT NULL,
`last_modified` integer NOT NULL,
`contentType` text NOT NULL,
`size` integer NOT NULL,
`perm` text NOT NULL
);
--> statement-breakpoint
INSERT INTO
`__new_document`(
"name",
"last_modified",
"contentType",
"size",
"perm"
)
SELECT
"name",
"last_modified",
"contentType",
"size",
"perm"
FROM
`document`;
--> statement-breakpoint
DROP TABLE `document`;
--> statement-breakpoint
ALTER TABLE
`__new_document` RENAME TO `document`;
--> statement-breakpoint
PRAGMA foreign_keys = ON;

View File

@@ -1 +1,2 @@
ALTER TABLE `document` RENAME COLUMN "contentType" TO "content_type";
ALTER TABLE
`document` RENAME COLUMN "contentType" TO "content_type";

View File

@@ -1 +1,4 @@
ALTER TABLE `document` ADD `content` text;
ALTER TABLE
`document`
ADD
`content` text;

View File

@@ -1 +1,4 @@
ALTER TABLE `document` ALTER COLUMN "content" TO "content" text NOT NULL;
ALTER TABLE
`document`
ALTER COLUMN
"content" TO "content" text NOT NULL;

View File

@@ -1 +1,4 @@
ALTER TABLE `document` ALTER COLUMN "content" TO "content" text;
ALTER TABLE
`document`
ALTER COLUMN
"content" TO "content" text;

View File

@@ -1,12 +1,17 @@
CREATE TABLE `cache` (
`scope` text NOT NULL,
`key` text PRIMARY KEY NOT NULL,
`json` text,
`binary` blob,
`created_at` integer DEFAULT (current_timestamp),
`expires_at` integer
`scope` text NOT NULL,
`key` text PRIMARY KEY NOT NULL,
`json` text,
`binary` blob,
`created_at` integer DEFAULT (CURRENT_TIMESTAMP),
`expires_at` integer
);
--> statement-breakpoint
CREATE INDEX `key_idx` ON `cache` (`key`);--> statement-breakpoint
CREATE INDEX `scope_idx` ON `cache` (`scope`);--> statement-breakpoint
CREATE INDEX `name_idx` ON `document` (`name`);
CREATE INDEX `key_idx` ON `cache` (`key`);
--> statement-breakpoint
CREATE INDEX `scope_idx` ON `cache` (`scope`);
--> statement-breakpoint
CREATE INDEX `name_idx` ON `document` (`name`);

View File

@@ -1 +1,2 @@
ALTER TABLE `image` RENAME COLUMN "blurhash" TO "thumbhash";
ALTER TABLE
`image` RENAME COLUMN "blurhash" TO "thumbhash";

View File

@@ -1,7 +1,22 @@
DROP INDEX "key_idx";--> statement-breakpoint
DROP INDEX "scope_idx";--> statement-breakpoint
DROP INDEX "name_idx";--> statement-breakpoint
ALTER TABLE `image` ALTER COLUMN "created_at" TO "created_at" integer DEFAULT (unixepoch());--> statement-breakpoint
CREATE INDEX `key_idx` ON `cache` (`key`);--> statement-breakpoint
CREATE INDEX `scope_idx` ON `cache` (`scope`);--> statement-breakpoint
DROP INDEX "key_idx";
--> statement-breakpoint
DROP INDEX "scope_idx";
--> statement-breakpoint
DROP INDEX "name_idx";
--> statement-breakpoint
ALTER TABLE
`image`
ALTER COLUMN
"created_at" TO "created_at" integer DEFAULT (unixepoch());
--> statement-breakpoint
CREATE INDEX `key_idx` ON `cache` (`key`);
--> statement-breakpoint
CREATE INDEX `scope_idx` ON `cache` (`scope`);
--> statement-breakpoint
CREATE INDEX `name_idx` ON `document` (`name`);

View File

@@ -306,4 +306,4 @@
"internal": {
"indexes": {}
}
}
}

View File

@@ -87,4 +87,4 @@
"breakpoints": true
}
]
}
}