Files
lablesys_backend/src/main/resources/sql/schema.sql

48 lines
1.6 KiB
SQL

create table if not exists sys_company (
id bigint primary key,
company_code varchar(64) not null unique,
company_name varchar(128) not null,
status varchar(32) not null,
created_at timestamp default current_timestamp,
updated_at timestamp default current_timestamp
);
create table if not exists sys_user (
id bigint primary key,
company_id bigint not null,
phone varchar(32) not null,
username varchar(64),
role varchar(32) not null,
position varchar(32) not null,
real_name varchar(64) not null,
password_hash varchar(255) not null,
must_change_password boolean not null default true,
status varchar(32) not null,
session_version integer not null default 1,
created_at timestamp default current_timestamp,
updated_at timestamp default current_timestamp,
constraint uq_sys_user_company_phone unique (company_id, phone)
);
create table if not exists sys_menu (
id bigint primary key,
company_id bigint not null,
permission_code varchar(64) not null,
menu_code varchar(64) not null,
menu_name varchar(128) not null,
path varchar(255) not null,
sort_order integer not null default 0,
created_at timestamp default current_timestamp,
updated_at timestamp default current_timestamp
);
create table if not exists biz_data_record (
id bigint primary key,
company_id bigint not null,
creator_id bigint not null,
creator_role varchar(32) not null,
record_name varchar(255) not null,
created_at timestamp default current_timestamp,
updated_at timestamp default current_timestamp
);