
    create table st_auth_group (
        created_at timestamp(6) not null,
        created_oid bigint,
        oid bigint not null,
        updated_at timestamp(6) not null,
        updated_oid bigint,
        name varchar(100),
        created_id varchar(255),
        updated_id varchar(255),
        primary key (oid)
    );

    comment on column st_auth_group.created_at is
        '생성일시';

    comment on column st_auth_group.created_oid is
        '생성자 OID';

    comment on column st_auth_group.oid is
        'OID';

    comment on column st_auth_group.updated_at is
        '수정일시';

    comment on column st_auth_group.updated_oid is
        '수정자 OID';

    comment on column st_auth_group.name is
        '권한 그룹명';

    comment on column st_auth_group.created_id is
        '생성자 ID';

    comment on column st_auth_group.updated_id is
        '수정자 ID';

    create table st_auth_group_resource (
        auth_group_oid bigint,
        created_at timestamp(6) not null,
        created_oid bigint,
        oid bigint not null,
        resource_oid bigint,
        updated_at timestamp(6) not null,
        updated_oid bigint,
        created_id varchar(255),
        updated_id varchar(255),
        primary key (oid)
    );

    comment on column st_auth_group_resource.auth_group_oid is
        '권한 그룹 OID';

    comment on column st_auth_group_resource.created_at is
        '생성일시';

    comment on column st_auth_group_resource.created_oid is
        '생성자 OID';

    comment on column st_auth_group_resource.oid is
        'OID';

    comment on column st_auth_group_resource.resource_oid is
        '리소스 OID';

    comment on column st_auth_group_resource.updated_at is
        '수정일시';

    comment on column st_auth_group_resource.updated_oid is
        '수정자 OID';

    comment on column st_auth_group_resource.created_id is
        '생성자 ID';

    comment on column st_auth_group_resource.updated_id is
        '수정자 ID';

    create table st_common_code (
        sort_order integer not null,
        use_flag boolean not null,
        created_at timestamp(6) not null,
        created_oid bigint,
        oid bigint not null,
        updated_at timestamp(6) not null,
        updated_oid bigint,
        code varchar(50) not null unique,
        group_code varchar(50) not null,
        parent_code varchar(50),
        character_ref1 varchar(100),
        character_ref2 varchar(100),
        character_ref3 varchar(100),
        character_ref4 varchar(100),
        character_ref5 varchar(100),
        name varchar(100) not null,
        description varchar(500),
        created_id varchar(255),
        updated_id varchar(255),
        primary key (oid)
    );

    comment on column st_common_code.sort_order is
        '정렬 순번';

    comment on column st_common_code.use_flag is
        '사용 여부';

    comment on column st_common_code.created_at is
        '생성일시';

    comment on column st_common_code.created_oid is
        '생성자 OID';

    comment on column st_common_code.oid is
        'OID';

    comment on column st_common_code.updated_at is
        '수정일시';

    comment on column st_common_code.updated_oid is
        '수정자 OID';

    comment on column st_common_code.code is
        '코드';

    comment on column st_common_code.group_code is
        '그룹 코드';

    comment on column st_common_code.parent_code is
        '부모 코드';

    comment on column st_common_code.character_ref1 is
        '문자 참조1';

    comment on column st_common_code.character_ref2 is
        '문자 참조2';

    comment on column st_common_code.character_ref3 is
        '문자 참조3';

    comment on column st_common_code.character_ref4 is
        '문자 참조4';

    comment on column st_common_code.character_ref5 is
        '문자 참조5';

    comment on column st_common_code.name is
        '코드명';

    comment on column st_common_code.description is
        '설명';

    comment on column st_common_code.created_id is
        '생성자 ID';

    comment on column st_common_code.updated_id is
        '수정자 ID';

    create table st_common_group_code (
        sort_order integer not null,
        use_flag boolean not null,
        created_at timestamp(6) not null,
        created_oid bigint,
        oid bigint not null,
        updated_at timestamp(6) not null,
        updated_oid bigint,
        code varchar(50) not null unique,
        character_ref1_title varchar(100),
        character_ref2_title varchar(100),
        character_ref3_title varchar(100),
        character_ref4_title varchar(100),
        character_ref5_title varchar(100),
        name varchar(100) not null,
        created_id varchar(255),
        updated_id varchar(255),
        primary key (oid)
    );

    comment on column st_common_group_code.sort_order is
        '정렬 순번';

    comment on column st_common_group_code.use_flag is
        '사용 여부';

    comment on column st_common_group_code.created_at is
        '생성일시';

    comment on column st_common_group_code.created_oid is
        '생성자 OID';

    comment on column st_common_group_code.oid is
        'OID';

    comment on column st_common_group_code.updated_at is
        '수정일시';

    comment on column st_common_group_code.updated_oid is
        '수정자 OID';

    comment on column st_common_group_code.code is
        '코드';

    comment on column st_common_group_code.character_ref1_title is
        '문자 참조 타이틀1';

    comment on column st_common_group_code.character_ref2_title is
        '문자 참조 타이틀2';

    comment on column st_common_group_code.character_ref3_title is
        '문자 참조 타이틀3';

    comment on column st_common_group_code.character_ref4_title is
        '문자 참조 타이틀4';

    comment on column st_common_group_code.character_ref5_title is
        '문자 참조 타이틀5';

    comment on column st_common_group_code.name is
        '코드명';

    comment on column st_common_group_code.created_id is
        '생성자 ID';

    comment on column st_common_group_code.updated_id is
        '수정자 ID';

    create table st_file (
        use_flag boolean not null,
        created_at timestamp(6) not null,
        created_oid bigint,
        file_size bigint not null,
        group_oid bigint,
        oid bigint not null,
        updated_at timestamp(6) not null,
        updated_oid bigint,
        content_type varchar(255) not null,
        created_id varchar(255),
        description varchar(255),
        file_path varchar(255) not null,
        original_file_name varchar(255) not null,
        stored_file_name varchar(255) not null,
        updated_id varchar(255),
        primary key (oid)
    );

    comment on column st_file.use_flag is
        '사용 여부';

    comment on column st_file.created_at is
        '생성일시';

    comment on column st_file.created_oid is
        '생성자 OID';

    comment on column st_file.file_size is
        '파일 크기';

    comment on column st_file.group_oid is
        '그룹 OID';

    comment on column st_file.oid is
        'OID';

    comment on column st_file.updated_at is
        '수정일시';

    comment on column st_file.updated_oid is
        '수정자 OID';

    comment on column st_file.content_type is
        '콘텐츠 타입';

    comment on column st_file.created_id is
        '생성자 ID';

    comment on column st_file.description is
        '설명';

    comment on column st_file.file_path is
        '파일 경로';

    comment on column st_file.original_file_name is
        '원본 파일명';

    comment on column st_file.stored_file_name is
        '저장 파일명';

    comment on column st_file.updated_id is
        '수정자 ID';

    create table st_member (
        use_flag boolean not null,
        created_at timestamp(6) not null,
        created_oid bigint,
        last_login_at timestamp(6),
        oid bigint not null,
        updated_at timestamp(6) not null,
        updated_oid bigint,
        login_ip varchar(45),
        name varchar(100) not null,
        password varchar(100) not null,
        user_id varchar(100) not null,
        refresh_token varchar(1024),
        created_id varchar(255),
        email varchar(255) not null,
        updated_id varchar(255),
        primary key (oid)
    );

    comment on column st_member.use_flag is
        '사용 여부';

    comment on column st_member.created_at is
        '생성일시';

    comment on column st_member.created_oid is
        '생성자 OID';

    comment on column st_member.last_login_at is
        '마지막 로그인 일시';

    comment on column st_member.oid is
        'OID';

    comment on column st_member.updated_at is
        '수정일시';

    comment on column st_member.updated_oid is
        '수정자 OID';

    comment on column st_member.login_ip is
        '로그인 IP';

    comment on column st_member.name is
        '이름';

    comment on column st_member.password is
        '비밀번호';

    comment on column st_member.user_id is
        '사용자 ID';

    comment on column st_member.refresh_token is
        '리프레시 토큰';

    comment on column st_member.created_id is
        '생성자 ID';

    comment on column st_member.email is
        '이메일';

    comment on column st_member.updated_id is
        '수정자 ID';

    create table st_member_auth_group (
        auth_group_oid bigint,
        created_at timestamp(6) not null,
        created_oid bigint,
        member_oid bigint,
        oid bigint not null,
        updated_at timestamp(6) not null,
        updated_oid bigint,
        created_id varchar(255),
        updated_id varchar(255),
        primary key (oid)
    );

    comment on column st_member_auth_group.auth_group_oid is
        '권한 그룹 OID';

    comment on column st_member_auth_group.created_at is
        '생성일시';

    comment on column st_member_auth_group.created_oid is
        '생성자 OID';

    comment on column st_member_auth_group.member_oid is
        '사용자 OID';

    comment on column st_member_auth_group.oid is
        'OID';

    comment on column st_member_auth_group.updated_at is
        '수정일시';

    comment on column st_member_auth_group.updated_oid is
        '수정자 OID';

    comment on column st_member_auth_group.created_id is
        '생성자 ID';

    comment on column st_member_auth_group.updated_id is
        '수정자 ID';

    create table st_resource (
        menu_yn boolean,
        sort_order integer,
        created_at timestamp(6) not null,
        created_oid bigint,
        oid bigint not null,
        parent_code bigint,
        updated_at timestamp(6) not null,
        updated_oid bigint,
        type varchar(50),
        code varchar(100),
        name varchar(100),
        path varchar(100),
        created_id varchar(255),
        description varchar(255),
        updated_id varchar(255),
        primary key (oid)
    );

    comment on column st_resource.menu_yn is
        '메뉴여부';

    comment on column st_resource.sort_order is
        '정렬 순서';

    comment on column st_resource.created_at is
        '생성일시';

    comment on column st_resource.created_oid is
        '생성자 OID';

    comment on column st_resource.oid is
        'OID';

    comment on column st_resource.parent_code is
        '부모 코드';

    comment on column st_resource.updated_at is
        '수정일시';

    comment on column st_resource.updated_oid is
        '수정자 OID';

    comment on column st_resource.type is
        '리소스 유형(메뉴, 페이지, 컴포넌트)';

    comment on column st_resource.code is
        '코드';

    comment on column st_resource.name is
        '리소스명';

    comment on column st_resource.path is
        '주소';

    comment on column st_resource.created_id is
        '생성자 ID';

    comment on column st_resource.description is
        '설명';

    comment on column st_resource.updated_id is
        '수정자 ID';

    create index idx_common_code_code 
       on st_common_code (code);

    create index idx_common_code_group_code 
       on st_common_code (group_code);

    create index idx_common_code_parent_code 
       on st_common_code (parent_code);

    create index idx_common_group_code_code 
       on st_common_group_code (code);

    create index idx_member_user_id 
       on st_member (user_id);

    alter table if exists st_auth_group_resource 
       add constraint FKqw6aih072qipjh1r88f0dbfd6 
       foreign key (auth_group_oid) 
       references st_auth_group;

    alter table if exists st_auth_group_resource 
       add constraint FKrvq0ta0bwef2kt6ahklo7f3k4 
       foreign key (resource_oid) 
       references st_resource;

    alter table if exists st_member_auth_group 
       add constraint FKob027cxsjfyvewjb8xp6hjkbm 
       foreign key (auth_group_oid) 
       references st_auth_group;

    alter table if exists st_member_auth_group 
       add constraint FKqew1t81hap15dmn78p8xhunhj 
       foreign key (member_oid) 
       references st_member;
