feat: 归档旧迁移文件,创建初始化数据迁移和重置脚本
This commit is contained in:
10
migrations/archive/000097_create_card_daily_usage.up.sql
Normal file
10
migrations/archive/000097_create_card_daily_usage.up.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
CREATE TABLE IF NOT EXISTS tb_card_daily_usage (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
iot_card_id BIGINT NOT NULL,
|
||||
date DATE NOT NULL,
|
||||
usage_mb NUMERIC(12,2) NOT NULL DEFAULT 0,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ DEFAULT NOW(),
|
||||
CONSTRAINT uk_card_daily UNIQUE (iot_card_id, date)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_card_daily_date ON tb_card_daily_usage (date);
|
||||
Reference in New Issue
Block a user