fix: correct timestamp/boolean types for PostgreSQL schema (Date not int, bool not 0/1)

This commit is contained in:
Marko Djordjevic 2026-02-17 22:50:31 +01:00
parent e00bd4d804
commit 69634909d1
9 changed files with 75 additions and 131 deletions

View file

@ -2,8 +2,6 @@ import { db } from './index';
import { annotationTypes } from './schema';
export async function seedAnnotationTypes() {
const now = Math.floor(Date.now() / 1000);
const defaultTypes = [
{
name: 'break_up',
@ -11,8 +9,6 @@ export async function seedAnnotationTypes() {
color: '#10b981',
category: 'marker',
icon: 'arrowUp',
is_active: 1,
created_at: now,
},
{
name: 'break_down',
@ -20,8 +16,6 @@ export async function seedAnnotationTypes() {
color: '#ef4444',
category: 'marker',
icon: 'arrowDown',
is_active: 1,
created_at: now,
},
{
name: 'line',
@ -29,14 +23,12 @@ export async function seedAnnotationTypes() {
color: '#3b82f6',
category: 'line',
icon: 'line',
is_active: 1,
created_at: now,
},
];
// Check if types already exist
const existing = await db.select().from(annotationTypes);
if (existing.length === 0) {
await db.insert(annotationTypes).values(defaultTypes);
console.log('Seeded default annotation types');

View file

@ -2,77 +2,19 @@ import { db } from './index';
import { spanLabelTypes } from './schema';
export async function seedSpanLabelTypes() {
const now = Math.floor(Date.now() / 1000);
const defaultTypes = [
{
name: 'bull_flag',
display_name: 'Bull Flag',
color: '#4CAF50',
hotkey: '1',
is_active: 1,
sort_order: 1,
created_at: now,
},
{
name: 'bear_flag',
display_name: 'Bear Flag',
color: '#F44336',
hotkey: '2',
is_active: 1,
sort_order: 2,
created_at: now,
},
{
name: 'head_and_shoulders',
display_name: 'Head and Shoulders',
color: '#9C27B0',
hotkey: '3',
is_active: 1,
sort_order: 3,
created_at: now,
},
{
name: 'double_bottom',
display_name: 'Double Bottom',
color: '#2196F3',
hotkey: '4',
is_active: 1,
sort_order: 4,
created_at: now,
},
{
name: 'wedge_up',
display_name: 'Wedge Up',
color: '#FF9800',
hotkey: '5',
is_active: 1,
sort_order: 5,
created_at: now,
},
{
name: 'wedge_down',
display_name: 'Wedge Down',
color: '#FF5722',
hotkey: '6',
is_active: 1,
sort_order: 6,
created_at: now,
},
{
name: 'custom',
display_name: 'Custom',
color: '#607D8B',
hotkey: '7',
is_active: 1,
sort_order: 7,
created_at: now,
},
{ name: 'bull_flag', display_name: 'Bull Flag', color: '#4CAF50', hotkey: '1', sort_order: 1 },
{ name: 'bear_flag', display_name: 'Bear Flag', color: '#F44336', hotkey: '2', sort_order: 2 },
{ name: 'head_and_shoulders', display_name: 'Head and Shoulders', color: '#9C27B0', hotkey: '3', sort_order: 3 },
{ name: 'double_bottom', display_name: 'Double Bottom', color: '#2196F3', hotkey: '4', sort_order: 4 },
{ name: 'wedge_up', display_name: 'Wedge Up', color: '#FF9800', hotkey: '5', sort_order: 5 },
{ name: 'wedge_down', display_name: 'Wedge Down', color: '#FF5722', hotkey: '6', sort_order: 6 },
{ name: 'custom', display_name: 'Custom', color: '#607D8B', hotkey: '7', sort_order: 7 },
];
// Check if types already exist
const existing = await db.select().from(spanLabelTypes);
if (existing.length === 0) {
await db.insert(spanLabelTypes).values(defaultTypes);
console.log('Seeded default span label types');