fix: resolve database migration failures and startup ordering
- Add scripts/run-migrations.js to run migrations before data loading - Fix startup.sh ordering: migrations -> data load -> app start - Fix migration 0005 missing statement-breakpoint between ALTER TABLE statements - Add migration 0005 to drizzle journal (was missing) - Fix load-initial-data.js to check table existence before querying - Fix load-initial-data.js to create chart record before inserting candles (chart_id NOT NULL constraint) - Simplify db/index.ts migration error handling (remove overly broad 'already exists' catch) - Add pre-migration check for inconsistent DB state (tables without migration tracking)
This commit is contained in:
parent
573efea5b5
commit
2bde38d0bf
6 changed files with 87 additions and 17 deletions
|
|
@ -4,7 +4,7 @@
|
|||
-- 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"}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,13 @@
|
|||
"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",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue