Move to drizzle
This commit is contained in:
3
src/db/db.ts
Normal file
3
src/db/db.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { drizzle } from 'drizzle-orm/better-sqlite3';
|
||||
|
||||
export default drizzle(`${process.cwd()}/db.sql`);
|
||||
22
src/db/schema/photo.ts
Normal file
22
src/db/schema/photo.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { int, sqliteTable, text, blob, real } from "drizzle-orm/sqlite-core";
|
||||
|
||||
export const photosTable = sqliteTable(
|
||||
"photo",
|
||||
{
|
||||
id: int().primaryKey({ autoIncrement: true }),
|
||||
src: text().notNull().unique(),
|
||||
width: int().notNull(),
|
||||
height: int().notNull(),
|
||||
blur: blob().notNull(),
|
||||
|
||||
camera: text(),
|
||||
title: text(),
|
||||
description: text(),
|
||||
exposureBiasValue: int(),
|
||||
fNumber: real(),
|
||||
isoSpeedRatings: int(),
|
||||
focalLength: int(),
|
||||
dateTimeOriginal: int({ mode: 'timestamp' }),
|
||||
lensModel: text(),
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user