Bläddra i källkod

Fix database schema timestamp columns mismatch

- Add missing updated_at column to candles_1h table
- Add missing created_at and updated_at columns to live_prices table
- Fix Sequelize timestamps configuration mismatch between models and schema
- Resolves 'column does not exist' errors in production deployment
uzairrizwan1 3 månader sedan
förälder
incheckning
8dae0bca17
1 ändrade filer med 5 tillägg och 2 borttagningar
  1. 5 2
      schema.sql

+ 5 - 2
schema.sql

@@ -29,7 +29,8 @@ CREATE TABLE candles_1h (
29
     volume NUMERIC(20,8),
29
     volume NUMERIC(20,8),
30
     trades_count INT,
30
     trades_count INT,
31
     quote_volume NUMERIC(20,8),
31
     quote_volume NUMERIC(20,8),
32
-    created_at TIMESTAMPTZ DEFAULT NOW()
32
+    created_at TIMESTAMPTZ DEFAULT NOW(),
33
+    updated_at TIMESTAMPTZ DEFAULT NOW()
33
 );
34
 );
34
 
35
 
35
 CREATE UNIQUE INDEX idx_candles_symbol_time ON candles_1h(symbol_id, open_time);
36
 CREATE UNIQUE INDEX idx_candles_symbol_time ON candles_1h(symbol_id, open_time);
@@ -44,7 +45,9 @@ CREATE TABLE live_prices (
44
     ask NUMERIC(18,8),
45
     ask NUMERIC(18,8),
45
     bid_size NUMERIC(18,8),
46
     bid_size NUMERIC(18,8),
46
     ask_size NUMERIC(18,8),
47
     ask_size NUMERIC(18,8),
47
-    last_updated TIMESTAMPTZ DEFAULT NOW()
48
+    last_updated TIMESTAMPTZ DEFAULT NOW(),
49
+    created_at TIMESTAMPTZ DEFAULT NOW(),
50
+    updated_at TIMESTAMPTZ DEFAULT NOW()
48
 );
51
 );
49
 
52
 
50
 CREATE INDEX idx_live_prices_price ON live_prices(price);
53
 CREATE INDEX idx_live_prices_price ON live_prices(price);