candle-annotator/src/lib/db/schema.ts
Marko Djordjevic d04b673cfa feat: initialize Next.js project with database schema
- Set up Next.js with App Router, TypeScript, Tailwind CSS
- Configure shadcn/ui with dark theme
- Install dependencies: lightweight-charts, papaparse, lucide-react
- Set up Drizzle ORM with better-sqlite3
- Create database schema for candles and annotations tables
- Generate migration SQL
2026-02-12 10:23:02 +01:00

18 lines
678 B
TypeScript

import { sqliteTable, integer, real, text } from 'drizzle-orm/sqlite-core';
export const candles = sqliteTable('candles', {
id: integer('id').primaryKey({ autoIncrement: true }),
time: integer('time').notNull().unique(),
open: real('open').notNull(),
high: real('high').notNull(),
low: real('low').notNull(),
close: real('close').notNull(),
});
export const annotations = sqliteTable('annotations', {
id: integer('id').primaryKey({ autoIncrement: true }),
timestamp: integer('timestamp').notNull(),
label_type: text('label_type').notNull(),
geometry: text('geometry'), // JSON string for line coordinates
created_at: integer('created_at').notNull(),
});