feat: 회원, 관리자 및 상태 / 로그인 변경 이력 스키마 정의

This commit is contained in:
이상진 2025-09-11 16:24:25 +09:00
parent 59907bd643
commit 75acdc2c2f
2 changed files with 108 additions and 0 deletions

View File

@ -18,6 +18,60 @@ create table if not exists members (
last_modified_at timestamp last_modified_at timestamp
); );
create table if not exists users(
id bigint primary key,
name varchar(50) not null,
email varchar(255) not null,
password varchar(255) not null,
phone varchar(20) not null,
region_code varchar(10) not null,
status varchar(20) not null,
created_at timestamp not null,
created_by bigint not null,
updated_at timestamp not null,
updated_by bigint not null,
constraint uk__users_email unique (email),
constraint uk__users_phone unique (phone),
constraint fk__users_region_code foreign key (region_code) references region (code)
);
create table if not exists user_status_history(
id bigint primary key,
user_id bigint not null,
status varchar(20) not null,
reason varchar(255) not null,
created_at timestamp not null,
created_by bigint not null,
updated_at timestamp not null,
updated_by bigint not null,
constraint fk__user_status_history_user_id foreign key (user_id) references users (id)
);
create table if not exists admin(
id bigint primary key,
account varchar(20) not null,
password varchar(255) not null,
name varchar(20) not null,
phone varchar(20) not null,
permission_level varchar(20) not null,
created_at timestamp not null,
created_by bigint not null,
updated_at timestamp not null,
updated_by bigint not null
);
create table if not exists login_history(
id bigint primary key,
principal_id bigint not null,
principal_type varchar(20) not null,
success boolean not null,
ip_address varchar(45) not null,
user_agent varchar(255) not null,
created_at timestamp not null
);
create table if not exists theme ( create table if not exists theme (
id bigint primary key , id bigint primary key ,
name varchar(30) not null, name varchar(30) not null,

View File

@ -19,6 +19,60 @@ create table if not exists members
last_modified_at datetime(6) null last_modified_at datetime(6) null
); );
create table if not exists users(
id bigint primary key,
name varchar(50) not null,
email varchar(255) not null,
password varchar(255) not null,
phone varchar(20) not null,
region_code varchar(10) not null,
status varchar(20) not null,
created_at datetime(6) not null,
created_by bigint not null,
updated_at datetime(6) not null,
updated_by bigint not null,
constraint uk__users_email unique (email),
constraint uk__users_phone unique (phone),
constraint fk__users_region_code foreign key (region_code) references region (code)
);
create table if not exists user_status_history(
id bigint primary key,
user_id bigint not null,
status varchar(20) not null,
reason varchar(255) not null,
created_at datetime(6) not null,
created_by bigint not null,
updated_at datetime(6) not null,
updated_by bigint not null,
constraint fk__user_status_history_user_id foreign key (user_id) references users (id)
);
create table if not exists admin(
id bigint primary key,
account varchar(20) not null,
password varchar(255) not null,
name varchar(20) not null,
phone varchar(20) not null,
permission_level varchar(20) not null,
created_at datetime(6) not null,
created_by bigint not null,
updated_at datetime(6) not null,
updated_by bigint not null
);
create table if not exists login_history(
id bigint primary key,
principal_id bigint not null,
principal_type varchar(20) not null,
success boolean not null,
ip_address varchar(45) not null,
user_agent varchar(255) not null,
created_at datetime(6) not null
);
create table if not exists theme ( create table if not exists theme (
id bigint primary key , id bigint primary key ,
name varchar(30) not null, name varchar(30) not null,