apiVersion : v1
kind : ConfigMap
metadata :
name : mariadb-init-sql
namespace : etri-aisw
data :
init.sql : |
CREATE TABLE BATCH_JOB_INSTANCE (
JOB_INSTANCE_ID BIGINT NOT NULL PRIMARY KEY,
VERSION BIGINT,
JOB_NAME VARCHAR(100) NOT NULL,
JOB_KEY VARCHAR(32) NOT NULL,
constraint JOB_INST_UN unique (JOB_NAME, JOB_KEY)
) ENGINE=InnoDB;
CREATE TABLE BATCH_JOB_EXECUTION (
JOB_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY,
VERSION BIGINT,
JOB_INSTANCE_ID BIGINT NOT NULL,
CREATE_TIME DATETIME(6) NOT NULL,
START_TIME DATETIME(6) DEFAULT NULL,
END_TIME DATETIME(6) DEFAULT NULL,
STATUS VARCHAR(10),
EXIT_CODE VARCHAR(2500),
EXIT_MESSAGE VARCHAR(2500),
LAST_UPDATED DATETIME(6),
constraint JOB_INST_EXEC_FK foreign key (JOB_INSTANCE_ID)
references BATCH_JOB_INSTANCE(JOB_INSTANCE_ID)
) ENGINE=InnoDB;
CREATE TABLE BATCH_JOB_EXECUTION_PARAMS (
JOB_EXECUTION_ID BIGINT NOT NULL,
PARAMETER_NAME VARCHAR(100) NOT NULL,
PARAMETER_TYPE VARCHAR(100) NOT NULL,
PARAMETER_VALUE VARCHAR(2500),
IDENTIFYING CHAR(1) NOT NULL,
constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
) ENGINE=InnoDB;
CREATE TABLE BATCH_STEP_EXECUTION (
STEP_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY,
VERSION BIGINT NOT NULL,
STEP_NAME VARCHAR(100) NOT NULL,
JOB_EXECUTION_ID BIGINT NOT NULL,
CREATE_TIME DATETIME(6) NOT NULL,
START_TIME DATETIME(6) DEFAULT NULL,
END_TIME DATETIME(6) DEFAULT NULL,
STATUS VARCHAR(10),
COMMIT_COUNT BIGINT,
READ_COUNT BIGINT,
FILTER_COUNT BIGINT,
WRITE_COUNT BIGINT,
READ_SKIP_COUNT BIGINT,
WRITE_SKIP_COUNT BIGINT,
PROCESS_SKIP_COUNT BIGINT,
ROLLBACK_COUNT BIGINT,
EXIT_CODE VARCHAR(2500),
EXIT_MESSAGE VARCHAR(2500),
LAST_UPDATED DATETIME(6),
constraint JOB_EXEC_STEP_FK foreign key (JOB_EXECUTION_ID)
references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
) ENGINE=InnoDB;
CREATE TABLE BATCH_STEP_EXECUTION_CONTEXT (
STEP_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY,
SHORT_CONTEXT VARCHAR(2500) NOT NULL,
SERIALIZED_CONTEXT TEXT,
constraint STEP_EXEC_CTX_FK foreign key (STEP_EXECUTION_ID)
references BATCH_STEP_EXECUTION(STEP_EXECUTION_ID)
) ENGINE=InnoDB;
CREATE TABLE BATCH_JOB_EXECUTION_CONTEXT (
JOB_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY,
SHORT_CONTEXT VARCHAR(2500) NOT NULL,
SERIALIZED_CONTEXT TEXT,
constraint JOB_EXEC_CTX_FK foreign key (JOB_EXECUTION_ID)
references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
) ENGINE=InnoDB;
CREATE SEQUENCE BATCH_STEP_EXECUTION_SEQ START WITH 1 MINVALUE 1 MAXVALUE 9223372036854775806 INCREMENT BY 1 NOCACHE NOCYCLE ENGINE=InnoDB;
CREATE SEQUENCE BATCH_JOB_EXECUTION_SEQ START WITH 1 MINVALUE 1 MAXVALUE 9223372036854775806 INCREMENT BY 1 NOCACHE NOCYCLE ENGINE=InnoDB;
CREATE SEQUENCE BATCH_JOB_INSTANCE_SEQ START WITH 1 MINVALUE 1 MAXVALUE 9223372036854775806 INCREMENT BY 1 NOCACHE NOCYCLE ENGINE=InnoDB;
create table tb_datagroup
(
id bigint auto_increment comment 'ID'
primary key,
mod_date datetime(6) null comment '수정 일자',
project_id bigint not null,
reg_date datetime(6) null comment '등록 일자',
ref_type varchar(50) not null comment '첨부파일 종류',
del_yn varchar(255) null comment '삭제 여부',
ds_desc varchar(255) null comment '데이터셋 설명',
ds_nm varchar(255) null comment '데이터셋 이름',
mod_user_id varchar(255) null comment '수정 유저 ID',
mod_user_nm varchar(255) null comment '수정 유저 이름',
reg_user_id varchar(255) null comment '등록 유저 ID',
reg_user_nm varchar(255) null comment '등록 유저 이름'
)
comment '데이터그룹';
create table tb_experiments
(
id bigint auto_increment
primary key,
kubeflow_created_at datetime(6) null,
kubeflow_last_run_created_at datetime(6) null,
last_update_time datetime(6) null,
mlflow_created_at datetime(6) null,
project_id bigint not null,
description varchar(255) null,
display_name varchar(255) null,
kube_flow_id varchar(255) null,
kubeflow_storage_state varchar(255) null,
ml_flow_id varchar(255) null,
mlflow_artifact_location varchar(255) null,
mlflow_lifecycle_stage varchar(255) null,
name varchar(255) null,
reg_user_id varchar(255) null
);
create table tb_minio_attachment
(
version int not null comment '파일 버전',
id bigint auto_increment comment '첨부파일 ID'
primary key,
project_id bigint not null,
ref_id bigint not null comment '연관 엔티티 ID',
reg_dt datetime(6) not null comment '업로드 일시',
size bigint not null comment '파일 크기',
ref_type varchar(50) not null comment '첨부파일 종류',
reg_user_id varchar(50) not null comment '업로더 ID',
content_type varchar(100) not null comment 'MIME 타입',
title varchar(200) null comment '파일 제목',
storage_path varchar(500) not null comment '스토리지 경로',
description varchar(1000) null comment '파일 설명',
original_name varchar(255) not null comment '원본 파일명',
stored_name varchar(255) not null comment '저장된 파일명'
)
comment 'MinIO 첨부파일';
create table tb_project
(
prj_end_dt date null comment '프로젝트 종료일',
prj_start_dt date null comment '프로젝트 시작일',
id bigint auto_increment comment 'ID'
primary key,
mod_date datetime(6) null comment '수정 일자',
reg_date datetime(6) null comment '등록 일자',
del_yn varchar(255) null comment '삭제 여부',
mod_user_id varchar(255) null comment '수정 유저 ID',
mod_user_nm varchar(255) null comment '수정 유저 이름',
prj_cd varchar(255) null comment '프로젝트 코드',
prj_desc varchar(255) null comment '프로젝트 설명',
prj_nm varchar(255) null comment '프로젝트 이름',
reg_user_id varchar(255) null comment '등록 유저 ID',
reg_user_nm varchar(255) null comment '등록 유저 이름',
constraint UKr4j59jsw44w7lklim967h3y68
unique (prj_cd)
)
comment '프로젝트';
create table tb_refreshtoken_seq
(
next_not_cached_value bigint(21) not null,
minimum_value bigint(21) not null,
maximum_value bigint(21) not null,
start_value bigint(21) not null comment 'start value when sequences is created or value if RESTART is used',
increment bigint(21) not null comment 'increment value',
cache_size bigint(21) unsigned not null,
cycle_option tinyint(1) unsigned not null comment '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
cycle_count bigint(21) not null comment 'How many cycles have been done'
);
create table tb_role
(
id int auto_increment comment '아이디'
primary key,
name enum ('ROLE_ADMIN', 'ROLE_MODERATOR', 'ROLE_USER') null comment '이름'
)
comment '역할';
create table tb_runs
(
created_at datetime(6) null,
finished_at datetime(6) null,
id bigint auto_increment
primary key,
scheduled_at datetime(6) null,
description varchar(255) null,
display_name varchar(255) null,
experiment_id varchar(255) null,
pipeline_id varchar(255) null,
pipeline_version_id varchar(255) null,
run_id varchar(255) not null,
service_account varchar(255) null,
state varchar(255) null,
storage_state varchar(255) null,
constraint UKo50j5wvoq8yfljyrwhwchrmwf
unique (run_id)
);
create table tb_user
(
id bigint auto_increment comment '아이디'
primary key,
username varchar(20) not null comment '유저이름',
email varchar(50) not null,
password varchar(120) not null,
constraint UK4vih17mube9j7cqyjlfbcrk4m
unique (email),
constraint UK4wv83hfajry5tdoamn8wsqa6x
unique (username)
)
comment '유저';
create table tb_refreshtoken
(
expiry_date datetime(6) not null,
id bigint not null
primary key,
user_id bigint null,
token varchar(255) not null,
constraint UKdis2d9uh6810rtsujb61a79dh
unique (token),
constraint UKgswd16e98xyda2y0mjm1wvln6
unique (user_id),
constraint FKpk3u23d8d7klynbhbaf9t9phw
foreign key (user_id) references tb_user (id)
)
comment '새로고침 토큰';
create table tb_user_project_map
(
id bigint auto_increment
primary key,
project_id bigint not null,
user_id bigint not null,
constraint FK9hgfnekphk923u837c4djs43d
foreign key (project_id) references tb_project (id),
constraint FKfba014j3xk0akg933ywmhry5r
foreign key (user_id) references tb_user (id)
);
create table tb_user_project_permission
(
user_project_id bigint not null,
permissions enum ('CREATE', 'DELETE', 'READ', 'UPDATE') null,
constraint FKq3vj28y7guss18yhrgosbnuu7
foreign key (user_project_id) references tb_user_project_map (id)
);
create table tb_user_roles
(
role_id int not null,
user_id bigint not null,
primary key (role_id, user_id),
constraint FK19t64ocsol5x06fy2cytp7gey
foreign key (user_id) references tb_user (id),
constraint FKft1jmfcluls775jqp5142wvl8
foreign key (role_id) references tb_role (id)
);
create table tb_workflows
(
version int null,
id bigint auto_increment comment 'ID'
primary key,
mod_dt datetime(6) null,
project_id bigint not null,
reg_dt datetime(6) null,
description varchar(255) null,
display_name varchar(255) null,
kubeflow_status varchar(255) null,
name varchar(255) null,
namespace varchar(255) null,
pipeline_id varchar(255) null,
reg_user_id varchar(255) null
);