<commit_before>--The following field used to emulate unique index with null value
--Base HSQL unique index does not support nulls http://hsqldb.org/doc/guide/ch02.html#N102DF
alter table TS_TIME_ENTRY add column INDEX_FIELD varchar(200)
GENERATED ALWAYS AS (USER_ID || ' ' || TASK_ID || ' ' || DATE_ || ' ' || case when DELETE_TS is not null then '-'||DELETE_TS else '-NOT_DELETED' end )^
create unique index IDX_TS_TIME_ENTRY_UNIQ_TASK_DATE on TS_TIME_ENTRY (INDEX_FIELD)^

alter table TS_PROJECT_PARTICIPANT add column INDEX_FIELD varchar(200)
GENERATED ALWAYS AS (USER_ID || ' ' || PROJECT_ID || case when DELETE_TS is not null then '-'||DELETE_TS else '-NOT_DELETED' end )^
create unique index IDX_TS_PROJECT_PARTICIPANT_UNIQ_USER_PROJECT on TS_PROJECT_PARTICIPANT (INDEX_FIELD)^

alter table TS_PROJECT add column INDEX_FIELD varchar(200)
GENERATED ALWAYS AS (CODE || case when DELETE_TS is not null then '-'||DELETE_TS else '-NOT_DELETED' end )^
create unique index IDX_TS_PROJECT_UNIQ_CODE on TS_PROJECT (INDEX_FIELD)^

alter table TS_CLIENT add column INDEX_FIELD varchar(200)
GENERATED ALWAYS AS (CODE || case when DELETE_TS is not null then '-'||DELETE_TS else '-NOT_DELETED' end )^
create unique index IDX_TS_CLIENT_UNIQ_CODE on TS_CLIENT (INDEX_FIELD)^

alter table TS_PROJECT_ROLE add column INDEX_FIELD varchar(200)
GENERATED ALWAYS AS (CODE || case when DELETE_TS is not null then '-'||DELETE_TS else '-NOT_DELETED' end )^
create unique index IDX_TS_PROJECT_ROLE_UNIQ_CODE on TS_PROJECT_ROLE (INDEX_FIELD)^

alter table TS_TAG add column INDEX_FIELD varchar(200)
GENERATED ALWAYS AS (CODE || case when DELETE_TS is not null then '-'||DELETE_TS else '-NOT_DELETED' end )^
create unique index IDX_TS_TAG_UNIQ_CODE on TS_TAG (INDEX_FIELD)^

alter table TS_TAG_TYPE add column INDEX_FIELD varchar(200)
GENERATED ALWAYS AS (CODE || case when DELETE_TS is not null then '-'||DELETE_TS else '-NOT_DELETED' end )^
create unique index IDX_TS_TAG_TYPE_UNIQ_CODE on TS_TAG_TYPE (INDEX_FIELD)^

alter table TS_TASK add column INDEX_FIELD varchar(200)
GENERATED ALWAYS AS (CODE || case when DELETE_TS is not null then '-'||DELETE_TS else '-NOT_DELETED' end )^
create unique index IDX_TS_TASK_UNIQ_CODE on TS_TASK (INDEX_FIELD)^

alter table TS_TASK_TYPE add column INDEX_FIELD varchar(200)
GENERATED ALWAYS AS (CODE || case when DELETE_TS is not null then '-'||DELETE_TS else '-NOT_DELETED' end )^
create unique index IDX_TS_TASK_TYPE_UNIQ_CODE on TS_TASK_TYPE (INDEX_FIELD)^

------------------------------------------------------------------------------------------------------------------------

insert into TS_PROJECT_ROLE
(ID, NAME, CODE, DESCRIPTION, VERSION, CREATE_TS)
values ('5bc577ab-44f3-a652-da29-4ae06c02d43b', 'Manager', 'manager', 'Can create sub-projects, tasks, change project properties, approve timesheets', 0, current_timestamp);

insert into TS_PROJECT_ROLE
(ID, NAME, CODE, DESCRIPTION, VERSION, CREATE_TS)
values ('6a8e8c24-d639-ef26-fac8-57e13bbfed48', 'Worker', 'worker', 'Can create time entries. Only see time entries related to him.', 0, current_timestamp);

insert into TS_PROJECT_ROLE
(ID, NAME, CODE, DESCRIPTION, VERSION, CREATE_TS)
values ('3182a9b0-5ffb-6062-d58c-0148b7b3af3e', 'Approver', 'approver', 'Can approve timesheets', 0, current_timestamp);

insert into TS_PROJECT_ROLE
(ID, NAME, CODE, DESCRIPTION, VERSION, CREATE_TS)
values ('4111a014-534c-3935-bf70-146a2e5c0970', 'Observer', 'observer', 'Can only view projects, task and time entries.', 0, current_timestamp);

------------------------------------------------------------------------------------------------------------------------
insert into SEC_ROLE
(NAME, LOC_NAME, DESCRIPTION, ROLE_TYPE, IS_DEFAULT_ROLE, VERSION, UPDATE_TS, UPDATED_BY, DELETE_TS, DELETED_BY, ID, CREATE_TS, CREATED_BY)
values ('Base role', 'Базовая роль', null, 0, true, 3, '2015-05-22 10:52:43', 'admin', null, null, 'daba747f-8376-b3b5-ccfa-e19e8e841fa2', '2015-05-22 10:46:37', 'admin');

insert into SEC_PERMISSION
(PERMISSION_TYPE, TARGET, VALUE, ROLE_ID, VERSION, UPDATE_TS, UPDATED_BY, DELETE_TS, DELETED_BY, ID, CREATE_TS, CREATED_BY)
values (20, 'ts$Project:update', 0, 'daba747f-8376-b3b5-ccfa-e19e8e841fa2', 1, '2015-05-22 10:57:56', null, null, null, '48f19459-a075-daf6-265c-7c61aee243cd', '2015-05-22 10:57:56', 'admin');

insert into SEC_PERMISSION
(PERMISSION_TYPE, TARGET, VALUE, ROLE_ID, VERSION, UPDATE_TS, UPDATED_BY, DELETE_TS, DELETED_BY, ID, CREATE_TS, CREATED_BY)
values (20, 'ts$Project:read', 0, 'daba747f-8376-b3b5-ccfa-e19e8e841fa2', 1, '2015-05-22 10:57:56', null, null, null, 'f4a70a8d-1604-7d28-ae28-563fb821b325', '2015-05-22 10:57:56', 'admin');

insert into SEC_PERMISSION
(PERMISSION_TYPE, TARGET, VALUE, ROLE_ID, VERSION, UPDATE_TS, UPDATED_BY, DELETE_TS, DELETED_BY, ID, CREATE_TS, CREATED_BY)
values (20, 'sec$Group:update', 0, 'daba747f-8376-b3b5-ccfa-e19e8e841fa2', 1, '2015-05-22 10:57:56', null, null, null, '73766a21-0f50-c85f-d93c-1c9b28ea0cab', '2015-05-22 10:57:56', 'admin');

insert into SEC_PERMISSION
(PERMISSION_TYPE, TARGET, VALUE, ROLE_ID, VERSION, UPDATE_TS, UPDATED_BY, DELETE_TS, DELETED_BY, ID, CREATE_TS, CREATED_BY)<commit_msg>hide reports for base role<commit_after>--The following field used to emulate unique index with null value
--Base HSQL unique index does not support nulls http://hsqldb.org/doc/guide/ch02.html#N102DF
alter table TS_TIME_ENTRY add column INDEX_FIELD varchar(200)
GENERATED ALWAYS AS (USER_ID || ' ' || TASK_ID || ' ' || DATE_ || ' ' || case when DELETE_TS is not null then '-'||DELETE_TS else '-NOT_DELETED' end )^
create unique index IDX_TS_TIME_ENTRY_UNIQ_TASK_DATE on TS_TIME_ENTRY (INDEX_FIELD)^

alter table TS_PROJECT_PARTICIPANT add column INDEX_FIELD varchar(200)
GENERATED ALWAYS AS (USER_ID || ' ' || PROJECT_ID || case when DELETE_TS is not null then '-'||DELETE_TS else '-NOT_DELETED' end )^
create unique index IDX_TS_PROJECT_PARTICIPANT_UNIQ_USER_PROJECT on TS_PROJECT_PARTICIPANT (INDEX_FIELD)^

alter table TS_PROJECT add column INDEX_FIELD varchar(200)
GENERATED ALWAYS AS (CODE || case when DELETE_TS is not null then '-'||DELETE_TS else '-NOT_DELETED' end )^
create unique index IDX_TS_PROJECT_UNIQ_CODE on TS_PROJECT (INDEX_FIELD)^

alter table TS_CLIENT add column INDEX_FIELD varchar(200)
GENERATED ALWAYS AS (CODE || case when DELETE_TS is not null then '-'||DELETE_TS else '-NOT_DELETED' end )^
create unique index IDX_TS_CLIENT_UNIQ_CODE on TS_CLIENT (INDEX_FIELD)^

alter table TS_PROJECT_ROLE add column INDEX_FIELD varchar(200)
GENERATED ALWAYS AS (CODE || case when DELETE_TS is not null then '-'||DELETE_TS else '-NOT_DELETED' end )^
create unique index IDX_TS_PROJECT_ROLE_UNIQ_CODE on TS_PROJECT_ROLE (INDEX_FIELD)^

alter table TS_TAG add column INDEX_FIELD varchar(200)
GENERATED ALWAYS AS (CODE || case when DELETE_TS is not null then '-'||DELETE_TS else '-NOT_DELETED' end )^
create unique index IDX_TS_TAG_UNIQ_CODE on TS_TAG (INDEX_FIELD)^

alter table TS_TAG_TYPE add column INDEX_FIELD varchar(200)
GENERATED ALWAYS AS (CODE || case when DELETE_TS is not null then '-'||DELETE_TS else '-NOT_DELETED' end )^
create unique index IDX_TS_TAG_TYPE_UNIQ_CODE on TS_TAG_TYPE (INDEX_FIELD)^

alter table TS_TASK add column INDEX_FIELD varchar(200)
GENERATED ALWAYS AS (CODE || case when DELETE_TS is not null then '-'||DELETE_TS else '-NOT_DELETED' end )^
create unique index IDX_TS_TASK_UNIQ_CODE on TS_TASK (INDEX_FIELD)^

alter table TS_TASK_TYPE add column INDEX_FIELD varchar(200)
GENERATED ALWAYS AS (CODE || case when DELETE_TS is not null then '-'||DELETE_TS else '-NOT_DELETED' end )^
create unique index IDX_TS_TASK_TYPE_UNIQ_CODE on TS_TASK_TYPE (INDEX_FIELD)^

------------------------------------------------------------------------------------------------------------------------

insert into TS_PROJECT_ROLE
(ID, NAME, CODE, DESCRIPTION, VERSION, CREATE_TS)
values ('5bc577ab-44f3-a652-da29-4ae06c02d43b', 'Manager', 'manager', 'Can create sub-projects, tasks, change project properties, approve timesheets', 0, current_timestamp);

insert into TS_PROJECT_ROLE
(ID, NAME, CODE, DESCRIPTION, VERSION, CREATE_TS)
values ('6a8e8c24-d639-ef26-fac8-57e13bbfed48', 'Worker', 'worker', 'Can create time entries. Only see time entries related to him.', 0, current_timestamp);

insert into TS_PROJECT_ROLE
(ID, NAME, CODE, DESCRIPTION, VERSION, CREATE_TS)
values ('3182a9b0-5ffb-6062-d58c-0148b7b3af3e', 'Approver', 'approver', 'Can approve timesheets', 0, current_timestamp);

insert into TS_PROJECT_ROLE
(ID, NAME, CODE, DESCRIPTION, VERSION, CREATE_TS)
values ('4111a014-534c-3935-bf70-146a2e5c0970', 'Observer', 'observer', 'Can only view projects, task and time entries.', 0, current_timestamp);

------------------------------------------------------------------------------------------------------------------------
insert into SEC_ROLE
(NAME, LOC_NAME, DESCRIPTION, ROLE_TYPE, IS_DEFAULT_ROLE, VERSION, UPDATE_TS, UPDATED_BY, DELETE_TS, DELETED_BY, ID, CREATE_TS, CREATED_BY)
values ('Base role', 'Базовая роль', null, 0, true, 3, '2015-05-22 10:52:43', 'admin', null, null, 'daba747f-8376-b3b5-ccfa-e19e8e841fa2', '2015-05-22 10:46:37', 'admin');

insert into SEC_PERMISSION
(PERMISSION_TYPE, TARGET, VALUE, ROLE_ID, VERSION, UPDATE_TS, UPDATED_BY, DELETE_TS, DELETED_BY, ID, CREATE_TS, CREATED_BY)
values (10, 'reports', 0, 'daba747f-8376-b3b5-ccfa-e19e8e841fa2', 1, '2015-05-26 12:24:45', null, null, null, '042ad508-625e-b16c-8143-37e71d731f34', '2015-05-26 12:24:45', 'admin');

insert into SEC_PERMISSION
(PERMISSION_TYPE, TARGET, VALUE, ROLE_ID, VERSION, UPDATE_TS, UPDATED_BY, DELETE_TS, DELETED_BY, ID, CREATE_TS, CREATED_BY)
values (20, 'ts$Project:update', 0, 'daba747f-8376-b3b5-ccfa-e19e8e841fa2', 1, '2015-05-22 10:57:56', null, null, null, '48f19459-a075-daf6-265c-7c61aee243cd', '2015-05-22 10:57:56', 'admin');

insert into SEC_PERMISSION
(PERMISSION_TYPE, TARGET, VALUE, ROLE_ID, VERSION, UPDATE_TS, UPDATED_BY, DELETE_TS, DELETED_BY, ID, CREATE_TS, CREATED_BY)
values (20, 'ts$Project:read', 0, 'daba747f-8376-b3b5-ccfa-e19e8e841fa2', 1, '2015-05-22 10:57:56', null, null, null, 'f4a70a8d-1604-7d28-ae28-563fb821b325', '2015-05-22 10:57:56', 'admin');

insert into SEC_PERMISSION
(PERMISSION_TYPE, TARGET, VALUE, ROLE_ID, VERSION, UPDATE_TS, UPDATED_BY, DELETE_TS, DELETED_BY, ID, CREATE_TS, CREATED_BY)
values (20, 'sec$Group:update', 0, 'daba747f-8376-b3b5-ccfa-e19e8e841fa2', 1, '2015-05-22 10:57:56', null, null, null, '73766a21-0f50-c85f-d93c-1c9b28ea0cab', '2015-05-22 10:57:56', 'admin');

insert into SEC_PERMISSION
(PERMISSION_TYPE, TARGET, VALUE, ROLE_ID, VERSION, UPDATE_TS, UPDATED_BY, DELETE_TS, DELETED_BY, ID, CREATE_TS, CREATED_BY)
{'fraction_non_alphanumeric': 0.1541127974517519, 'fraction_numerical': 0.0756979576541128, 'mean_word_length': 4.782773564463706, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2261672', 'n_tokens_mistral': 4570, 'n_tokens_neox': 3958, 'n_words': 1061}