feat: DB-Schema (candles, backtest_runs), Migration, CandleStore

This commit is contained in:
2026-06-09 20:56:24 +00:00
parent f318446ebf
commit 27a10dc794
9 changed files with 243 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
CREATE TABLE "backtest_runs" (
"id" serial PRIMARY KEY NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"kind" text NOT NULL,
"config" jsonb NOT NULL,
"result" jsonb NOT NULL
);
--> statement-breakpoint
CREATE TABLE "candles" (
"pair" varchar(16) NOT NULL,
"ts" timestamp with time zone NOT NULL,
"open" double precision NOT NULL,
"high" double precision NOT NULL,
"low" double precision NOT NULL,
"close" double precision NOT NULL,
"volume" double precision NOT NULL,
CONSTRAINT "candles_pair_ts_pk" PRIMARY KEY("pair","ts")
);

View File

@@ -0,0 +1,126 @@
{
"id": "00b411bc-669e-4667-881c-c9161fa42bb0",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.backtest_runs": {
"name": "backtest_runs",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"kind": {
"name": "kind",
"type": "text",
"primaryKey": false,
"notNull": true
},
"config": {
"name": "config",
"type": "jsonb",
"primaryKey": false,
"notNull": true
},
"result": {
"name": "result",
"type": "jsonb",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.candles": {
"name": "candles",
"schema": "",
"columns": {
"pair": {
"name": "pair",
"type": "varchar(16)",
"primaryKey": false,
"notNull": true
},
"ts": {
"name": "ts",
"type": "timestamp with time zone",
"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
},
"volume": {
"name": "volume",
"type": "double precision",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {
"candles_pair_ts_pk": {
"name": "candles_pair_ts_pk",
"columns": [
"pair",
"ts"
]
}
},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

View File

@@ -0,0 +1,13 @@
{
"version": "7",
"dialect": "postgresql",
"entries": [
{
"idx": 0,
"version": "7",
"when": 1781038570957,
"tag": "0000_nifty_brood",
"breakpoints": true
}
]
}