PL-5393 Category attribute code should be unique for the certain entity type

Fix scripts
#PL-5393
This commit is contained in:
Eugeny Degtyarjov 2015-05-28 14:27:23 +00:00
parent 8a393f4615
commit bef8da87a9
10 changed files with 20 additions and 20 deletions

View File

@ -671,7 +671,7 @@ create table SYS_CATEGORY_ATTR(
--
CATEGORY_ENTITY_TYPE varchar(4000),
NAME varchar(255),
CODE varchar(50) not null,
CODE varchar(100) not null,
CATEGORY_ID varchar(36),
IS_ENTITY boolean,
DATA_TYPE varchar(200),

View File

@ -727,7 +727,7 @@ create table SYS_CATEGORY_ATTR (
--
CATEGORY_ENTITY_TYPE varchar(4000),
NAME varchar(255),
CODE varchar(50) not null,
CODE varchar(100) not null,
CATEGORY_ID uniqueidentifier,
IS_ENTITY tinyint,
DATA_TYPE varchar(200),

View File

@ -58,7 +58,7 @@ create table SYS_CATEGORY_ATTR (
DELETED_BY varchar2(50),
CATEGORY_ENTITY_TYPE varchar(4000),
NAME varchar2(255),
CODE varchar2(50) not null,
CODE varchar2(100) not null,
CATEGORY_ID varchar2(32),
IS_ENTITY char(1),
DATA_TYPE varchar2(200),

View File

@ -695,7 +695,7 @@ create table SYS_CATEGORY_ATTR (
--
CATEGORY_ENTITY_TYPE varchar(4000),
NAME varchar(255),
CODE varchar(50) not null,
CODE varchar(100) not null,
CATEGORY_ID uuid,
IS_ENTITY boolean,
DATA_TYPE varchar(200),

View File

@ -1,4 +1,4 @@
-- $Id$
alter table SYS_ATTR_VALUE add column CODE varchar(100);
alter table SYS_CATEGORY_ATTR add column TARGET_SCREENS varchar(4000);
alter table SYS_ATTR_VALUE add column CODE varchar(100)^
alter table SYS_CATEGORY_ATTR add column TARGET_SCREENS varchar(4000)^

View File

@ -1,6 +1,6 @@
-- $Id$
alter table SYS_CATEGORY_ATTR add column CATEGORY_ENTITY_TYPE varchar(4000);
update SYS_CATEGORY_ATTR set CODE = NAME where CODE is null;
update SYS_CATEGORY_ATTR attr set CATEGORY_ENTITY_TYPE = (select cat.ENTITY_TYPE from SYS_CATEGORY cat where cat.ID = attr.CATEGORY_ID);
alter table SYS_CATEGORY_ATTR alter column CODE set not null;
create unique index IDX_CAT_ATTR_ENT_TYPE_AND_CODE on SYS_CATEGORY_ATTR (CATEGORY_ENTITY_TYPE, CODE);
alter table SYS_CATEGORY_ATTR add column CATEGORY_ENTITY_TYPE varchar(4000)^
update SYS_CATEGORY_ATTR set CODE = NAME where CODE is null^
update SYS_CATEGORY_ATTR attr set CATEGORY_ENTITY_TYPE = (select cat.ENTITY_TYPE from SYS_CATEGORY cat where cat.ID = attr.CATEGORY_ID)^
alter table SYS_CATEGORY_ATTR alter column CODE set not null^
create unique index IDX_CAT_ATTR_ENT_TYPE_AND_CODE on SYS_CATEGORY_ATTR (CATEGORY_ENTITY_TYPE, CODE)^

View File

@ -1,4 +1,4 @@
-- $Id$
alter table SYS_ATTR_VALUE add column CODE varchar(100);
alter table SYS_CATEGORY_ATTR add column TARGET_SCREENS varchar(4000);
alter table SYS_ATTR_VALUE add CODE varchar(100);
alter table SYS_CATEGORY_ATTR add TARGET_SCREENS varchar(4000);

View File

@ -1,6 +1,6 @@
-- $Id$
alter table SYS_CATEGORY_ATTR add column CATEGORY_ENTITY_TYPE varchar(4000);
alter table SYS_CATEGORY_ATTR add CATEGORY_ENTITY_TYPE varchar(4000);
update SYS_CATEGORY_ATTR set CODE = NAME where CODE is null;
update SYS_CATEGORY_ATTR attr set CATEGORY_ENTITY_TYPE = (select cat.ENTITY_TYPE from SYS_CATEGORY cat where cat.ID = attr.CATEGORY_ID);
alter table SYS_CATEGORY_ATTR alter column CODE set not null;
update SYS_CATEGORY_ATTR set CATEGORY_ENTITY_TYPE = (select cat.ENTITY_TYPE from SYS_CATEGORY cat where cat.ID = SYS_CATEGORY_ATTR.CATEGORY_ID);
alter table SYS_CATEGORY_ATTR alter column CODE varchar(100) not null;
create unique index IDX_CAT_ATTR_ENT_TYPE_AND_CODE on SYS_CATEGORY_ATTR (CATEGORY_ENTITY_TYPE, CODE, DELETE_TS);

View File

@ -1,4 +1,4 @@
-- $Id$
alter table SYS_ATTR_VALUE add column CODE varchar2(100);
alter table SYS_CATEGORY_ATTR add column TARGET_SCREENS varchar2(4000);
alter table SYS_ATTR_VALUE add CODE varchar2(100)^
alter table SYS_CATEGORY_ATTR add TARGET_SCREENS varchar2(4000)^

View File

@ -1,6 +1,6 @@
-- $Id$
alter table SYS_CATEGORY_ATTR add column CATEGORY_ENTITY_TYPE varchar(4000)^
alter table SYS_CATEGORY_ATTR add CATEGORY_ENTITY_TYPE varchar2(4000)^
update SYS_CATEGORY_ATTR set CODE = NAME where CODE is null^
update SYS_CATEGORY_ATTR attr set CATEGORY_ENTITY_TYPE = (select cat.ENTITY_TYPE from SYS_CATEGORY cat where cat.ID = attr.CATEGORY_ID)^
alter table SYS_CATEGORY_ATTR alter column CODE set not null^
alter table SYS_CATEGORY_ATTR MODIFY CODE varchar2(100) not null^
create unique index IDX_CAT_ATTR_ENT_TYPE_AND_CODE on SYS_CATEGORY_ATTR (CATEGORY_ENTITY_TYPE, CODE, DELETE_TS)^