fix: Add migration SQL files to repository
This commit is contained in:
19
migrations/002_create_hourly_summary.sql
Normal file
19
migrations/002_create_hourly_summary.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
-- Migration: Create hourly_summary table
|
||||
-- Description: Rekap per jam untuk kebutuhan grafik dashboard
|
||||
-- Date: 2024-12-28
|
||||
|
||||
CREATE TABLE IF NOT EXISTS hourly_summary (
|
||||
summary_date DATE NOT NULL,
|
||||
summary_hour TINYINT UNSIGNED NOT NULL COMMENT '0-23',
|
||||
location_code VARCHAR(64) NOT NULL,
|
||||
gate_code VARCHAR(64) NOT NULL,
|
||||
category VARCHAR(64) NOT NULL,
|
||||
total_count INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
total_amount BIGINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (summary_date, summary_hour, location_code, gate_code, category),
|
||||
INDEX idx_summary_date_location (summary_date, location_code),
|
||||
INDEX idx_summary_date_hour (summary_date, summary_hour)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
Reference in New Issue
Block a user