-- 建表语句
create table sqmdb_rpt.acl_city
(
    city_id      serial not null
        constraint city_pk
            primary key,
    city_name_zh varchar,
    city_name_en varchar,
    ord          integer
);

alter table sqmdb_rpt.acl_city
    owner to sqmdb;

create table sqmdb_rpt.acl_role
(
    role_id     serial not null
        constraint role_pk
            primary key,
    role_name   varchar,
    create_time date,
    update_time date
);

alter table sqmdb_rpt.acl_role
    owner to sqmdb;

drop table sqmdb_rpt.acl_user;

create table sqmdb_rpt.acl_user
(
    user_id    serial not null
        constraint user_pk
            primary key,
    login_name  varchar,
    user_name   varchar,
    phone       varchar,
    email       varchar,
    province    varchar,
    city        varchar,
    county      varchar,
    tsfx_per    integer,
    tsys_per    integer,
    tsdp_per    integer,
    tsgdlz_per  integer,
    ceate_time  date,
    update_time date
);

alter table sqmdb_rpt.acl_user
    owner to sqmdb;

create table sqmdb_rpt.acl_user_role
(
    id          serial not null
        constraint user_role_pk
            primary key,
    user_id     integer,
    role_id     integer,
    create_time date,
    update_time date
);

alter table sqmdb_rpt.acl_user_role
    owner to sqmdb;

create table sqmdb_rpt.acl_org
(
    org_id      serial not null
        constraint org_pk
            primary key,
    org_name    varchar,
    create_time date,
    update_time date
);

alter table sqmdb_rpt.acl_org
    owner to sqmdb;
