feat: migrate from SQLite to PostgreSQL - complete schema and API updates

- Remove better-sqlite3, add pg driver
- Convert schema to PostgreSQL types (serial, timestamp, boolean, jsonb)
- Generate fresh PostgreSQL migrations
- Update database connection layer with pg.Pool
- Fix all API routes: remove JSON.parse/stringify, use native timestamps and booleans
- Update drizzle.config.ts and .env.example for PostgreSQL
This commit is contained in:
Marko Djordjevic 2026-02-17 13:43:06 +01:00
parent 4605283d2b
commit 5f70f13da3
37 changed files with 1164 additions and 1825 deletions

View file

@ -1,19 +0,0 @@
CREATE TABLE `annotations` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`timestamp` integer NOT NULL,
`label_type` text NOT NULL,
`geometry` text,
`color` text DEFAULT '#3b82f6',
`created_at` integer NOT NULL
);
--> statement-breakpoint
CREATE TABLE `candles` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`time` integer NOT NULL,
`open` real NOT NULL,
`high` real NOT NULL,
`low` real NOT NULL,
`close` real NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `candles_time_unique` ON `candles` (`time`);

View file

@ -0,0 +1,71 @@
CREATE TABLE "annotation_types" (
"id" serial PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"display_name" text NOT NULL,
"color" text NOT NULL,
"category" text NOT NULL,
"icon" text,
"is_active" boolean DEFAULT true NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "annotation_types_name_unique" UNIQUE("name")
);
--> statement-breakpoint
CREATE TABLE "annotations" (
"id" serial PRIMARY KEY NOT NULL,
"chart_id" integer NOT NULL,
"timestamp" timestamp NOT NULL,
"label_type" text NOT NULL,
"geometry" jsonb,
"color" text DEFAULT '#3b82f6',
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "candles" (
"id" serial PRIMARY KEY NOT NULL,
"chart_id" integer NOT NULL,
"time" timestamp NOT NULL,
"open" double precision NOT NULL,
"high" double precision NOT NULL,
"low" double precision NOT NULL,
"close" double precision NOT NULL
);
--> statement-breakpoint
CREATE TABLE "charts" (
"id" serial PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "charts_name_unique" UNIQUE("name")
);
--> statement-breakpoint
CREATE TABLE "span_annotations" (
"id" serial PRIMARY KEY NOT NULL,
"chart_id" integer NOT NULL,
"start_time" timestamp NOT NULL,
"end_time" timestamp NOT NULL,
"label" text NOT NULL,
"confidence" integer,
"outcome" text,
"notes" text,
"sub_spans" jsonb,
"color" text DEFAULT '#2196F3' NOT NULL,
"source" text DEFAULT 'human' NOT NULL,
"model_prediction" jsonb,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "span_label_types" (
"id" serial PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"display_name" text NOT NULL,
"color" text NOT NULL,
"hotkey" text,
"is_active" boolean DEFAULT true NOT NULL,
"sort_order" integer DEFAULT 0 NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "span_label_types_name_unique" UNIQUE("name")
);
--> statement-breakpoint
ALTER TABLE "annotations" ADD CONSTRAINT "annotations_chart_id_charts_id_fk" FOREIGN KEY ("chart_id") REFERENCES "public"."charts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "candles" ADD CONSTRAINT "candles_chart_id_charts_id_fk" FOREIGN KEY ("chart_id") REFERENCES "public"."charts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "span_annotations" ADD CONSTRAINT "span_annotations_chart_id_charts_id_fk" FOREIGN KEY ("chart_id") REFERENCES "public"."charts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
CREATE UNIQUE INDEX "candles_chart_time_unique" ON "candles" USING btree ("chart_id","time");

View file

@ -1,12 +0,0 @@
CREATE TABLE `annotation_types` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`name` text NOT NULL,
`display_name` text NOT NULL,
`color` text NOT NULL,
`category` text NOT NULL,
`icon` text,
`is_active` integer DEFAULT 1 NOT NULL,
`created_at` integer NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `annotation_types_name_unique` ON `annotation_types` (`name`);

View file

@ -1,74 +0,0 @@
-- Create charts table
CREATE TABLE `charts` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`name` text NOT NULL,
`created_at` integer NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `charts_name_unique` ON `charts` (`name`);
--> statement-breakpoint
-- Insert default chart if candles exist
INSERT INTO `charts` (`name`, `created_at`)
SELECT 'Imported Data', CAST(strftime('%s', 'now') AS INTEGER)
WHERE EXISTS (SELECT 1 FROM `candles` LIMIT 1);
--> statement-breakpoint
-- Drop old unique index on candles.time
DROP INDEX IF EXISTS `candles_time_unique`;
--> statement-breakpoint
-- Add chart_id column to candles (nullable first for backfill)
ALTER TABLE `candles` ADD `chart_id` integer REFERENCES charts(id);
--> statement-breakpoint
-- Backfill existing candles with the default chart id
UPDATE `candles` SET `chart_id` = (SELECT `id` FROM `charts` WHERE `name` = 'Imported Data') WHERE `chart_id` IS NULL;
--> statement-breakpoint
-- Add chart_id column to annotations (nullable first for backfill)
ALTER TABLE `annotations` ADD `chart_id` integer REFERENCES charts(id);
--> statement-breakpoint
-- Backfill existing annotations with the default chart id
UPDATE `annotations` SET `chart_id` = (SELECT `id` FROM `charts` WHERE `name` = 'Imported Data') WHERE `chart_id` IS NULL;
--> statement-breakpoint
-- Recreate candles table with NOT NULL constraint and composite unique index
CREATE TABLE `candles_new` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`chart_id` integer NOT NULL REFERENCES charts(id),
`time` integer NOT NULL,
`open` real NOT NULL,
`high` real NOT NULL,
`low` real NOT NULL,
`close` real NOT NULL
);
--> statement-breakpoint
INSERT INTO `candles_new` (`id`, `chart_id`, `time`, `open`, `high`, `low`, `close`)
SELECT `id`, `chart_id`, `time`, `open`, `high`, `low`, `close` FROM `candles`;
--> statement-breakpoint
DROP TABLE `candles`;
--> statement-breakpoint
ALTER TABLE `candles_new` RENAME TO `candles`;
--> statement-breakpoint
CREATE UNIQUE INDEX `candles_chart_time_unique` ON `candles` (`chart_id`, `time`);
--> statement-breakpoint
-- Recreate annotations table with NOT NULL constraint
CREATE TABLE `annotations_new` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`chart_id` integer NOT NULL REFERENCES charts(id),
`timestamp` integer NOT NULL,
`label_type` text NOT NULL,
`geometry` text,
`color` text DEFAULT '#3b82f6',
`created_at` integer NOT NULL
);
--> statement-breakpoint
INSERT INTO `annotations_new` (`id`, `chart_id`, `timestamp`, `label_type`, `geometry`, `color`, `created_at`)
SELECT `id`, `chart_id`, `timestamp`, `label_type`, `geometry`, `color`, `created_at` FROM `annotations`;
--> statement-breakpoint
DROP TABLE `annotations`;
--> statement-breakpoint
ALTER TABLE `annotations_new` RENAME TO `annotations`;

View file

@ -1,27 +0,0 @@
CREATE TABLE `span_annotations` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`chart_id` integer NOT NULL,
`start_time` integer NOT NULL,
`end_time` integer NOT NULL,
`label` text NOT NULL,
`confidence` integer,
`outcome` text,
`notes` text,
`sub_spans` text,
`color` text DEFAULT '#2196F3' NOT NULL,
`created_at` integer NOT NULL,
FOREIGN KEY (`chart_id`) REFERENCES `charts`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE TABLE `span_label_types` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`name` text NOT NULL,
`display_name` text NOT NULL,
`color` text NOT NULL,
`hotkey` text,
`is_active` integer DEFAULT 1 NOT NULL,
`sort_order` integer DEFAULT 0 NOT NULL,
`created_at` integer NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `span_label_types_name_unique` ON `span_label_types` (`name`);

View file

@ -1,8 +0,0 @@
-- Insert default span label types (idempotent - skip if already exists)
INSERT OR IGNORE INTO `span_label_types` (`name`, `display_name`, `color`, `hotkey`, `is_active`, `sort_order`, `created_at`) VALUES
('bull_flag', 'Bull Flag', '#4CAF50', '1', 1, 1, strftime('%s', 'now')),
('bear_flag', 'Bear Flag', '#F44336', '2', 1, 2, strftime('%s', 'now')),
('triangle', 'Triangle', '#FF9800', '3', 1, 3, strftime('%s', 'now')),
('wedge', 'Wedge', '#9C27B0', '4', 1, 4, strftime('%s', 'now')),
('channel', 'Channel', '#2196F3', '5', 1, 5, strftime('%s', 'now')),
('consolidation', 'Consolidation', '#607D8B', '6', 1, 6, strftime('%s', 'now'));

View file

@ -1,11 +0,0 @@
-- Migration: Add source and model_prediction fields to span_annotations
-- Supports tracking annotation origin and model feedback loop
-- Add source field (defaults to 'human')
-- Possible values: 'human', 'model', 'human_correction'
ALTER TABLE `span_annotations` ADD COLUMN `source` TEXT NOT NULL DEFAULT 'human';
--> statement-breakpoint
-- Add model_prediction field (nullable JSON)
-- Stores model prediction metadata when user confirms/corrects a prediction
-- Example: {"label": "bull_flag", "confidence": 0.85, "model_version": "xgb_v1"}
ALTER TABLE `span_annotations` ADD COLUMN `model_prediction` TEXT;

View file

@ -1,131 +1,472 @@
{
"version": "6",
"dialect": "sqlite",
"id": "8c883f15-4c03-4681-bf49-aac5b35c6610",
"id": "2ac019ff-95bf-4bc3-9aa5-456fe6213f25",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
"tables": {
"annotations": {
"name": "annotations",
"public.annotation_types": {
"name": "annotation_types",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"display_name": {
"name": "display_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": true
},
"category": {
"name": "category",
"type": "text",
"primaryKey": false,
"notNull": true
},
"icon": {
"name": "icon",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"autoincrement": true
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"annotation_types_name_unique": {
"name": "annotation_types_name_unique",
"nullsNotDistinct": false,
"columns": [
"name"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.annotations": {
"name": "annotations",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"chart_id": {
"name": "chart_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"timestamp": {
"name": "timestamp",
"type": "integer",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"autoincrement": false
"notNull": true
},
"label_type": {
"name": "label_type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
"notNull": true
},
"geometry": {
"name": "geometry",
"type": "text",
"type": "jsonb",
"primaryKey": false,
"notNull": false,
"autoincrement": false
"notNull": false
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "'#3b82f6'"
},
"created_at": {
"name": "created_at",
"type": "integer",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"autoincrement": false
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"annotations_chart_id_charts_id_fk": {
"name": "annotations_chart_id_charts_id_fk",
"tableFrom": "annotations",
"tableTo": "charts",
"columnsFrom": [
"chart_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.candles": {
"name": "candles",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"chart_id": {
"name": "chart_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"time": {
"name": "time",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"open": {
"name": "open",
"type": "double precision",
"primaryKey": false,
"notNull": true
},
"high": {
"name": "high",
"type": "double precision",
"primaryKey": false,
"notNull": true
},
"low": {
"name": "low",
"type": "double precision",
"primaryKey": false,
"notNull": true
},
"close": {
"name": "close",
"type": "double precision",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"candles_chart_time_unique": {
"name": "candles_chart_time_unique",
"columns": [
{
"expression": "chart_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "time",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"candles_chart_id_charts_id_fk": {
"name": "candles_chart_id_charts_id_fk",
"tableFrom": "candles",
"tableTo": "charts",
"columnsFrom": [
"chart_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.charts": {
"name": "charts",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
"uniqueConstraints": {
"charts_name_unique": {
"name": "charts_name_unique",
"nullsNotDistinct": false,
"columns": [
"name"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"candles": {
"name": "candles",
"public.span_annotations": {
"name": "span_annotations",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "integer",
"type": "serial",
"primaryKey": true,
"notNull": true,
"autoincrement": true
"notNull": true
},
"time": {
"name": "time",
"chart_id": {
"name": "chart_id",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
"notNull": true
},
"open": {
"name": "open",
"type": "real",
"start_time": {
"name": "start_time",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"end_time": {
"name": "end_time",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"label": {
"name": "label",
"type": "text",
"primaryKey": false,
"notNull": true
},
"confidence": {
"name": "confidence",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"outcome": {
"name": "outcome",
"type": "text",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"sub_spans": {
"name": "sub_spans",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
"default": "'#2196F3'"
},
"high": {
"name": "high",
"type": "real",
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
"default": "'human'"
},
"low": {
"name": "low",
"type": "real",
"model_prediction": {
"name": "model_prediction",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"close": {
"name": "close",
"type": "real",
"primaryKey": false,
"notNull": true,
"autoincrement": false
"default": "now()"
}
},
"indexes": {
"candles_time_unique": {
"name": "candles_time_unique",
"columns": [
"time"
"indexes": {},
"foreignKeys": {
"span_annotations_chart_id_charts_id_fk": {
"name": "span_annotations_chart_id_charts_id_fk",
"tableFrom": "span_annotations",
"tableTo": "charts",
"columnsFrom": [
"chart_id"
],
"isUnique": true
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.span_label_types": {
"name": "span_label_types",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"display_name": {
"name": "display_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": true
},
"hotkey": {
"name": "hotkey",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"sort_order": {
"name": "sort_order",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"span_label_types_name_unique": {
"name": "span_label_types_name_unique",
"nullsNotDistinct": false,
"columns": [
"name"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"views": {},
"enums": {},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {},
"columns": {}
},
"internal": {
"indexes": {}
"tables": {}
}
}

View file

@ -1,206 +0,0 @@
{
"version": "6",
"dialect": "sqlite",
"id": "111e1b91-6d7b-45e4-aeb9-9762725d6905",
"prevId": "9a43200c-01b1-41fc-ac10-8071afa36f6f",
"tables": {
"annotation_types": {
"name": "annotation_types",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"display_name": {
"name": "display_name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"category": {
"name": "category",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"icon": {
"name": "icon",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"is_active": {
"name": "is_active",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 1
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"annotation_types_name_unique": {
"name": "annotation_types_name_unique",
"columns": [
"name"
],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"annotations": {
"name": "annotations",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"timestamp": {
"name": "timestamp",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"label_type": {
"name": "label_type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"geometry": {
"name": "geometry",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "'#3b82f6'"
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"candles": {
"name": "candles",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"time": {
"name": "time",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"open": {
"name": "open",
"type": "real",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"high": {
"name": "high",
"type": "real",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"low": {
"name": "low",
"type": "real",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"close": {
"name": "close",
"type": "real",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"candles_time_unique": {
"name": "candles_time_unique",
"columns": [
"time"
],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
}
},
"views": {},
"enums": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
},
"internal": {
"indexes": {}
}
}

View file

@ -1,288 +0,0 @@
{
"version": "6",
"dialect": "sqlite",
"id": "8eb771d5-6d44-473e-8bce-144d195ae2b5",
"prevId": "111e1b91-6d7b-45e4-aeb9-9762725d6905",
"tables": {
"annotation_types": {
"name": "annotation_types",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"display_name": {
"name": "display_name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"category": {
"name": "category",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"icon": {
"name": "icon",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"is_active": {
"name": "is_active",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 1
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"annotation_types_name_unique": {
"name": "annotation_types_name_unique",
"columns": [
"name"
],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"annotations": {
"name": "annotations",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"chart_id": {
"name": "chart_id",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"timestamp": {
"name": "timestamp",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"label_type": {
"name": "label_type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"geometry": {
"name": "geometry",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "'#3b82f6'"
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"annotations_chart_id_charts_id_fk": {
"name": "annotations_chart_id_charts_id_fk",
"tableFrom": "annotations",
"tableTo": "charts",
"columnsFrom": [
"chart_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"candles": {
"name": "candles",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"chart_id": {
"name": "chart_id",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"time": {
"name": "time",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"open": {
"name": "open",
"type": "real",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"high": {
"name": "high",
"type": "real",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"low": {
"name": "low",
"type": "real",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"close": {
"name": "close",
"type": "real",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"candles_chart_time_unique": {
"name": "candles_chart_time_unique",
"columns": [
"chart_id",
"time"
],
"isUnique": true
}
},
"foreignKeys": {
"candles_chart_id_charts_id_fk": {
"name": "candles_chart_id_charts_id_fk",
"tableFrom": "candles",
"tableTo": "charts",
"columnsFrom": [
"chart_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"charts": {
"name": "charts",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"charts_name_unique": {
"name": "charts_name_unique",
"columns": [
"name"
],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
}
},
"views": {},
"enums": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
},
"internal": {
"indexes": {}
}
}

View file

@ -1,466 +0,0 @@
{
"version": "6",
"dialect": "sqlite",
"id": "17f9ee96-d37f-4c25-97d8-45f8f1a4c868",
"prevId": "8eb771d5-6d44-473e-8bce-144d195ae2b5",
"tables": {
"annotation_types": {
"name": "annotation_types",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"display_name": {
"name": "display_name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"category": {
"name": "category",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"icon": {
"name": "icon",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"is_active": {
"name": "is_active",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 1
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"annotation_types_name_unique": {
"name": "annotation_types_name_unique",
"columns": [
"name"
],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"annotations": {
"name": "annotations",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"chart_id": {
"name": "chart_id",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"timestamp": {
"name": "timestamp",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"label_type": {
"name": "label_type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"geometry": {
"name": "geometry",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "'#3b82f6'"
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"annotations_chart_id_charts_id_fk": {
"name": "annotations_chart_id_charts_id_fk",
"tableFrom": "annotations",
"tableTo": "charts",
"columnsFrom": [
"chart_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"candles": {
"name": "candles",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"chart_id": {
"name": "chart_id",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"time": {
"name": "time",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"open": {
"name": "open",
"type": "real",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"high": {
"name": "high",
"type": "real",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"low": {
"name": "low",
"type": "real",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"close": {
"name": "close",
"type": "real",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"candles_chart_time_unique": {
"name": "candles_chart_time_unique",
"columns": [
"chart_id",
"time"
],
"isUnique": true
}
},
"foreignKeys": {
"candles_chart_id_charts_id_fk": {
"name": "candles_chart_id_charts_id_fk",
"tableFrom": "candles",
"tableTo": "charts",
"columnsFrom": [
"chart_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"charts": {
"name": "charts",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"charts_name_unique": {
"name": "charts_name_unique",
"columns": [
"name"
],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"span_annotations": {
"name": "span_annotations",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"chart_id": {
"name": "chart_id",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"start_time": {
"name": "start_time",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"end_time": {
"name": "end_time",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"label": {
"name": "label",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"confidence": {
"name": "confidence",
"type": "integer",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"outcome": {
"name": "outcome",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"sub_spans": {
"name": "sub_spans",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'#2196F3'"
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"span_annotations_chart_id_charts_id_fk": {
"name": "span_annotations_chart_id_charts_id_fk",
"tableFrom": "span_annotations",
"tableTo": "charts",
"columnsFrom": [
"chart_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"span_label_types": {
"name": "span_label_types",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"display_name": {
"name": "display_name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"hotkey": {
"name": "hotkey",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"is_active": {
"name": "is_active",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 1
},
"sort_order": {
"name": "sort_order",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"span_label_types_name_unique": {
"name": "span_label_types_name_unique",
"columns": [
"name"
],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
}
},
"views": {},
"enums": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
},
"internal": {
"indexes": {}
}
}

View file

@ -1,466 +0,0 @@
{
"version": "6",
"dialect": "sqlite",
"id": "a8c3f2d1-e5b7-4a9f-b2d3-6c8e9f1a3b5c",
"prevId": "17f9ee96-d37f-4c25-97d8-45f8f1a4c868",
"tables": {
"annotation_types": {
"name": "annotation_types",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"display_name": {
"name": "display_name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"category": {
"name": "category",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"icon": {
"name": "icon",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"is_active": {
"name": "is_active",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 1
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"annotation_types_name_unique": {
"name": "annotation_types_name_unique",
"columns": [
"name"
],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"annotations": {
"name": "annotations",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"chart_id": {
"name": "chart_id",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"timestamp": {
"name": "timestamp",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"label_type": {
"name": "label_type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"geometry": {
"name": "geometry",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "'#3b82f6'"
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"annotations_chart_id_charts_id_fk": {
"name": "annotations_chart_id_charts_id_fk",
"tableFrom": "annotations",
"tableTo": "charts",
"columnsFrom": [
"chart_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"candles": {
"name": "candles",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"chart_id": {
"name": "chart_id",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"time": {
"name": "time",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"open": {
"name": "open",
"type": "real",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"high": {
"name": "high",
"type": "real",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"low": {
"name": "low",
"type": "real",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"close": {
"name": "close",
"type": "real",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"candles_chart_time_unique": {
"name": "candles_chart_time_unique",
"columns": [
"chart_id",
"time"
],
"isUnique": true
}
},
"foreignKeys": {
"candles_chart_id_charts_id_fk": {
"name": "candles_chart_id_charts_id_fk",
"tableFrom": "candles",
"tableTo": "charts",
"columnsFrom": [
"chart_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"charts": {
"name": "charts",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"charts_name_unique": {
"name": "charts_name_unique",
"columns": [
"name"
],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"span_annotations": {
"name": "span_annotations",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"chart_id": {
"name": "chart_id",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"start_time": {
"name": "start_time",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"end_time": {
"name": "end_time",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"label": {
"name": "label",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"confidence": {
"name": "confidence",
"type": "integer",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"outcome": {
"name": "outcome",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"sub_spans": {
"name": "sub_spans",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'#2196F3'"
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"span_annotations_chart_id_charts_id_fk": {
"name": "span_annotations_chart_id_charts_id_fk",
"tableFrom": "span_annotations",
"tableTo": "charts",
"columnsFrom": [
"chart_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"span_label_types": {
"name": "span_label_types",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"display_name": {
"name": "display_name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"hotkey": {
"name": "hotkey",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"is_active": {
"name": "is_active",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 1
},
"sort_order": {
"name": "sort_order",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"span_label_types_name_unique": {
"name": "span_label_types_name_unique",
"columns": [
"name"
],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
}
},
"views": {},
"enums": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
},
"internal": {
"indexes": {}
}
}

View file

@ -1,47 +1,12 @@
{
"version": "7",
"dialect": "sqlite",
"dialect": "postgresql",
"entries": [
{
"idx": 0,
"version": "6",
"when": 1770907611962,
"tag": "0000_goofy_captain_midlands",
"breakpoints": true
},
{
"idx": 1,
"version": "6",
"when": 1770915891699,
"tag": "0001_sticky_shinko_yamashiro",
"breakpoints": true
},
{
"idx": 2,
"version": "6",
"when": 1770937855462,
"tag": "0002_careful_synch",
"breakpoints": true
},
{
"idx": 3,
"version": "6",
"when": 1771044740273,
"tag": "0003_demonic_captain_flint",
"breakpoints": true
},
{
"idx": 4,
"version": "6",
"when": 1771055000000,
"tag": "0004_add_default_span_label_types",
"breakpoints": true
},
{
"idx": 5,
"version": "6",
"when": 1771156000000,
"tag": "0005_add_source_and_model_prediction_to_span_annotations",
"version": "7",
"when": 1771332001387,
"tag": "0000_nifty_gauntlet",
"breakpoints": true
}
]