create table sys_dept
(
    id          bigint generated by default as identity
        constraint _copy_7
            primary key,
    pid         bigint,
    sub_count   integer,
    name        varchar(50) not null,
    dept_sort   integer,
    enabled     boolean,
    create_by   varchar(50),
    update_by   varchar(50),
    create_time timestamp(6),
    update_time timestamp(6),
    remark      varchar(255)
);

comment
on table sys_dept is '部门';

comment
on column sys_dept.id is 'ID';

comment
on column sys_dept.pid is '上级部门';

comment
on column sys_dept.sub_count is '子部门数目';

comment
on column sys_dept.name is '名称';

comment
on column sys_dept.dept_sort is '排序';

comment
on column sys_dept.enabled is '状态';

comment
on column sys_dept.create_by is '创建者';

comment
on column sys_dept.update_by is '更新者';

comment
on column sys_dept.create_time is '创建日期';

comment
on column sys_dept.update_time is '更新时间';

alter table sys_dept
    owner to gitea;

create index inx_pid
    on sys_dept (pid);

create index inx_enabled
    on sys_dept (enabled);

