apiVersion: v1 kind: ConfigMap metadata: name: mariadb-init-sql namespace: etri-aisw data: init.sql: | create table batch_job_execution_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 batch_job_instance ( JOB_INSTANCE_ID bigint not null primary key, VERSION bigint null, JOB_NAME varchar(100) not null, JOB_KEY varchar(32) not null, constraint JOB_INST_UN unique (JOB_NAME, JOB_KEY) ); create table batch_job_execution ( JOB_EXECUTION_ID bigint not null primary key, VERSION bigint null, JOB_INSTANCE_ID bigint not null, CREATE_TIME datetime(6) not null, START_TIME datetime(6) null, END_TIME datetime(6) null, STATUS varchar(10) null, EXIT_CODE varchar(2500) null, EXIT_MESSAGE varchar(2500) null, LAST_UPDATED datetime(6) null, constraint JOB_INST_EXEC_FK foreign key (JOB_INSTANCE_ID) references batch_job_instance (JOB_INSTANCE_ID) ); create table batch_job_execution_context ( JOB_EXECUTION_ID bigint not null primary key, SHORT_CONTEXT varchar(2500) not null, SERIALIZED_CONTEXT text null, constraint JOB_EXEC_CTX_FK foreign key (JOB_EXECUTION_ID) references batch_job_execution (JOB_EXECUTION_ID) ); 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) null, IDENTIFYING char not null, constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID) references batch_job_execution (JOB_EXECUTION_ID) ); create table batch_job_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 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) null, END_TIME datetime(6) null, STATUS varchar(10) null, COMMIT_COUNT bigint null, READ_COUNT bigint null, FILTER_COUNT bigint null, WRITE_COUNT bigint null, READ_SKIP_COUNT bigint null, WRITE_SKIP_COUNT bigint null, PROCESS_SKIP_COUNT bigint null, ROLLBACK_COUNT bigint null, EXIT_CODE varchar(2500) null, EXIT_MESSAGE varchar(2500) null, LAST_UPDATED datetime(6) null, constraint JOB_EXEC_STEP_FK foreign key (JOB_EXECUTION_ID) references batch_job_execution (JOB_EXECUTION_ID) ); create table batch_step_execution_context ( STEP_EXECUTION_ID bigint not null primary key, SHORT_CONTEXT varchar(2500) not null, SERIALIZED_CONTEXT text null, constraint STEP_EXEC_CTX_FK foreign key (STEP_EXECUTION_ID) references batch_step_execution (STEP_EXECUTION_ID) ); create table batch_step_execution_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_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 );