-- auto-generated definition
create table schedule
(
    id         bigserial
        primary key,
    anchor_id  bigint       default 0                     not null,
    account_id bigint       default 0                     not null,
    start_time timestamp                                  not null,
    end_time   timestamp                                  not null,
    status     smallint     default 0                     not null,
    remark     varchar(500) default ''::character varying not null,
    created_by bigint       default 0                     not null,
    updated_by bigint       default 0                     not null,
    created_at timestamp    default CURRENT_TIMESTAMP     not null,
    updated_at timestamp    default CURRENT_TIMESTAMP     not null,
    deleted_at timestamp,
    tenant_id  bigint       default 0,
    product_id bigint       default 0,
    order_id   bigint       default 0
);

comment on table schedule is '排班表';

comment on column schedule.id is '排班ID';

comment on column schedule.anchor_id is '主播ID';

comment on column schedule.account_id is '直播账号ID';

comment on column schedule.start_time is '开始时间';

comment on column schedule.end_time is '结束时间';

comment on column schedule.status is '状态（0待直播 1直播中 2已结束 3已取消）';

comment on column schedule.remark is '备注';

comment on column schedule.created_by is '创建人';

comment on column schedule.updated_by is '修改人';

comment on column schedule.created_at is '创建时间';

comment on column schedule.updated_at is '修改时间';

comment on column schedule.deleted_at is '删除时间';

comment on column schedule.product_id is '商品ID';

comment on column schedule.order_id is '订单ID';

alter table schedule
    owner to postgres;

create index idx_schedule_tenant_id
    on schedule (tenant_id);




-- auto-generated definition
create table anchor
(
    id         bigint       default nextval('anchor_id_seq'::regclass) not null
        primary key,
    name       varchar(50)  default ''::character varying              not null,
    phone      varchar(20)  default ''::character varying              not null,
    code       varchar(255) default ''::character varying              not null,
    status     smallint     default 1                                  not null,
    remark     varchar(500) default ''::character varying              not null,
    created_by bigint       default 0                                  not null,
    updated_by bigint       default 0                                  not null,
    created_at timestamp    default CURRENT_TIMESTAMP                  not null,
    updated_at timestamp    default CURRENT_TIMESTAMP                  not null,
    deleted_at timestamp,
    tenant_id  bigint       default 0
);

comment on table anchor is '主播表';

comment on column anchor.id is '主播ID';

comment on column anchor.name is '主播姓名';

comment on column anchor.phone is '联系电话';

comment on column anchor.code is '工号';

comment on column anchor.status is '状态（0停用 1正常）';

comment on column anchor.remark is '备注';

comment on column anchor.created_by is '创建人';

comment on column anchor.updated_by is '修改人';

comment on column anchor.created_at is '创建时间';

comment on column anchor.updated_at is '修改时间';

comment on column anchor.deleted_at is '删除时间';

alter table anchor
    owner to postgres;

create index idx_anchor_tenant_id
    on anchor (tenant_id);




-- auto-generated definition
create table live_account
(
    id           bigint       default nextval('live_account_id_seq'::regclass) not null
        primary key,
    platform     varchar(50)  default ''::character varying                    not null,
    account_name varchar(100) default ''::character varying                    not null,
    account_id   varchar(100) default ''::character varying                    not null,
    status       smallint     default 1                                        not null,
    remark       varchar(500) default ''::character varying                    not null,
    created_by   bigint       default 0                                        not null,
    updated_by   bigint       default 0                                        not null,
    created_at   timestamp    default CURRENT_TIMESTAMP                        not null,
    updated_at   timestamp    default CURRENT_TIMESTAMP                        not null,
    deleted_at   timestamp,
    tenant_id    bigint       default 0
);

comment on table live_account is '直播账号表';

comment on column live_account.id is '账号ID';

comment on column live_account.platform is '直播平台（抖音/快手/淘宝等）';

comment on column live_account.account_name is '账号名称';

comment on column live_account.account_id is '账号ID';

comment on column live_account.status is '状态（0停用 1正常）';

comment on column live_account.remark is '备注';

comment on column live_account.created_by is '创建人';

comment on column live_account.updated_by is '修改人';

comment on column live_account.created_at is '创建时间';

comment on column live_account.updated_at is '修改时间';

comment on column live_account.deleted_at is '删除时间';

alter table live_account
    owner to postgres;

create index idx_live_account_tenant_id
    on live_account (tenant_id);


