Files
platforms/backend/migrations/0001_create_org_gas_station.sql

28 lines
1.4 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- org_gas_station可燃气体站主表。identity 由应用生成 UUID V7禁止自增主键。
CREATE TABLE IF NOT EXISTS org_gas_station (
identity uuid PRIMARY KEY,
station_code varchar(32) NOT NULL UNIQUE,
name varchar(128) NOT NULL,
principal varchar(64) NOT NULL,
service_area varchar(128) NOT NULL,
created_at timestamptz NOT NULL,
updated_at timestamptz NOT NULL,
created_by_identity uuid,
updated_by_identity uuid,
status varchar(32) NOT NULL DEFAULT 'draft',
version integer NOT NULL DEFAULT 1
);
COMMENT ON TABLE org_gas_station IS '可燃气体站主表';
COMMENT ON COLUMN org_gas_station.identity IS '主键,应用生成的 UUID V7';
COMMENT ON COLUMN org_gas_station.station_code IS '气站全局唯一业务编码';
COMMENT ON COLUMN org_gas_station.name IS '气站名称';
COMMENT ON COLUMN org_gas_station.principal IS '气站负责人姓名';
COMMENT ON COLUMN org_gas_station.service_area IS '气站授权服务区域';
COMMENT ON COLUMN org_gas_station.created_at IS '记录创建时间UTC';
COMMENT ON COLUMN org_gas_station.updated_at IS '记录更新时间UTC';
COMMENT ON COLUMN org_gas_station.created_by_identity IS '创建人 identity';
COMMENT ON COLUMN org_gas_station.updated_by_identity IS '更新人 identity';
COMMENT ON COLUMN org_gas_station.status IS '状态draft、enabled、frozen、archived';
COMMENT ON COLUMN org_gas_station.version IS '乐观锁版本';