IDEMPIERE-3439 IDEMPIERE-3936 - foreign constraints

This commit is contained in:
Carlos Ruiz 2019-06-17 12:24:47 +02:00
parent b5281f7f88
commit f8878b8e01
4 changed files with 147 additions and 0 deletions

View File

@ -0,0 +1,71 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-3439-3936
-- Jun 17, 2019, 12:19:10 PM CEST
UPDATE AD_Column SET FKConstraintType='N',Updated=TO_DATE('2019-06-17 12:19:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212804
;
-- Jun 17, 2019, 12:19:20 PM CEST
UPDATE AD_Column SET FKConstraintName='ADUserClient_ADCtxHelpSuggesti', FKConstraintType='N',Updated=TO_DATE('2019-06-17 12:19:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212804
;
-- Jun 17, 2019, 12:19:20 PM CEST
ALTER TABLE AD_CtxHelpSuggestion MODIFY AD_UserClient_ID NUMBER(10)
;
-- Jun 17, 2019, 12:19:20 PM CEST
ALTER TABLE AD_CtxHelpSuggestion ADD CONSTRAINT ADUserClient_ADCtxHelpSuggesti FOREIGN KEY (AD_UserClient_ID) REFERENCES ad_client(ad_client_id) DEFERRABLE INITIALLY DEFERRED
;
-- Jun 17, 2019, 12:19:40 PM CEST
UPDATE AD_Column SET FKConstraintType='N',Updated=TO_DATE('2019-06-17 12:19:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212805
;
-- Jun 17, 2019, 12:19:42 PM CEST
UPDATE AD_Column SET FKConstraintName='ADUser_ADCtxHelpSuggestion', FKConstraintType='N',Updated=TO_DATE('2019-06-17 12:19:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212805
;
-- Jun 17, 2019, 12:19:42 PM CEST
ALTER TABLE AD_CtxHelpSuggestion MODIFY AD_User_ID NUMBER(10)
;
-- Jun 17, 2019, 12:19:42 PM CEST
ALTER TABLE AD_CtxHelpSuggestion ADD CONSTRAINT ADUser_ADCtxHelpSuggestion FOREIGN KEY (AD_User_ID) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED
;
-- Jun 17, 2019, 12:20:02 PM CEST
UPDATE AD_Column SET FKConstraintType='N',Updated=TO_DATE('2019-06-17 12:20:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212779
;
-- Jun 17, 2019, 12:20:04 PM CEST
UPDATE AD_Column SET FKConstraintName='ADUserClient_ADFieldSuggestion', FKConstraintType='N',Updated=TO_DATE('2019-06-17 12:20:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212779
;
-- Jun 17, 2019, 12:20:04 PM CEST
ALTER TABLE AD_FieldSuggestion MODIFY AD_UserClient_ID NUMBER(10)
;
-- Jun 17, 2019, 12:20:04 PM CEST
ALTER TABLE AD_FieldSuggestion ADD CONSTRAINT ADUserClient_ADFieldSuggestion FOREIGN KEY (AD_UserClient_ID) REFERENCES ad_client(ad_client_id) DEFERRABLE INITIALLY DEFERRED
;
-- Jun 17, 2019, 12:20:12 PM CEST
UPDATE AD_Column SET FKConstraintType='N',Updated=TO_DATE('2019-06-17 12:20:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212780
;
-- Jun 17, 2019, 12:20:13 PM CEST
UPDATE AD_Column SET FKConstraintName='ADUser_ADFieldSuggestion', FKConstraintType='N',Updated=TO_DATE('2019-06-17 12:20:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212780
;
-- Jun 17, 2019, 12:20:13 PM CEST
ALTER TABLE AD_FieldSuggestion MODIFY AD_User_ID NUMBER(10)
;
-- Jun 17, 2019, 12:20:13 PM CEST
ALTER TABLE AD_FieldSuggestion ADD CONSTRAINT ADUser_ADFieldSuggestion FOREIGN KEY (AD_User_ID) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED
;
SELECT register_migration_script('201906171220_IDEMPIERE-3439.sql') FROM dual
;

View File

@ -0,0 +1,68 @@
-- IDEMPIERE-3439-3936
-- Jun 17, 2019, 12:19:10 PM CEST
UPDATE AD_Column SET FKConstraintType='N',Updated=TO_TIMESTAMP('2019-06-17 12:19:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212804
;
-- Jun 17, 2019, 12:19:20 PM CEST
UPDATE AD_Column SET FKConstraintName='ADUserClient_ADCtxHelpSuggesti', FKConstraintType='N',Updated=TO_TIMESTAMP('2019-06-17 12:19:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212804
;
-- Jun 17, 2019, 12:19:20 PM CEST
INSERT INTO t_alter_column values('ad_ctxhelpsuggestion','AD_UserClient_ID','NUMERIC(10)',null,null)
;
-- Jun 17, 2019, 12:19:20 PM CEST
ALTER TABLE AD_CtxHelpSuggestion ADD CONSTRAINT ADUserClient_ADCtxHelpSuggesti FOREIGN KEY (AD_UserClient_ID) REFERENCES ad_client(ad_client_id) DEFERRABLE INITIALLY DEFERRED
;
-- Jun 17, 2019, 12:19:40 PM CEST
UPDATE AD_Column SET FKConstraintType='N',Updated=TO_TIMESTAMP('2019-06-17 12:19:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212805
;
-- Jun 17, 2019, 12:19:42 PM CEST
UPDATE AD_Column SET FKConstraintName='ADUser_ADCtxHelpSuggestion', FKConstraintType='N',Updated=TO_TIMESTAMP('2019-06-17 12:19:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212805
;
-- Jun 17, 2019, 12:19:42 PM CEST
INSERT INTO t_alter_column values('ad_ctxhelpsuggestion','AD_User_ID','NUMERIC(10)',null,null)
;
-- Jun 17, 2019, 12:19:42 PM CEST
ALTER TABLE AD_CtxHelpSuggestion ADD CONSTRAINT ADUser_ADCtxHelpSuggestion FOREIGN KEY (AD_User_ID) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED
;
-- Jun 17, 2019, 12:20:02 PM CEST
UPDATE AD_Column SET FKConstraintType='N',Updated=TO_TIMESTAMP('2019-06-17 12:20:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212779
;
-- Jun 17, 2019, 12:20:04 PM CEST
UPDATE AD_Column SET FKConstraintName='ADUserClient_ADFieldSuggestion', FKConstraintType='N',Updated=TO_TIMESTAMP('2019-06-17 12:20:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212779
;
-- Jun 17, 2019, 12:20:04 PM CEST
INSERT INTO t_alter_column values('ad_fieldsuggestion','AD_UserClient_ID','NUMERIC(10)',null,null)
;
-- Jun 17, 2019, 12:20:04 PM CEST
ALTER TABLE AD_FieldSuggestion ADD CONSTRAINT ADUserClient_ADFieldSuggestion FOREIGN KEY (AD_UserClient_ID) REFERENCES ad_client(ad_client_id) DEFERRABLE INITIALLY DEFERRED
;
-- Jun 17, 2019, 12:20:12 PM CEST
UPDATE AD_Column SET FKConstraintType='N',Updated=TO_TIMESTAMP('2019-06-17 12:20:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212780
;
-- Jun 17, 2019, 12:20:13 PM CEST
UPDATE AD_Column SET FKConstraintName='ADUser_ADFieldSuggestion', FKConstraintType='N',Updated=TO_TIMESTAMP('2019-06-17 12:20:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212780
;
-- Jun 17, 2019, 12:20:13 PM CEST
INSERT INTO t_alter_column values('ad_fieldsuggestion','AD_User_ID','NUMERIC(10)',null,null)
;
-- Jun 17, 2019, 12:20:13 PM CEST
ALTER TABLE AD_FieldSuggestion ADD CONSTRAINT ADUser_ADFieldSuggestion FOREIGN KEY (AD_User_ID) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED
;
SELECT register_migration_script('201906171220_IDEMPIERE-3439.sql') FROM dual
;

View File

@ -809,6 +809,13 @@ public class MColumn extends X_AD_Column
foreignTable = "AD_Chart";
}
if (foreignTable.equals("AD_AllClients_V"))
foreignTable = "AD_Client";
else if (foreignTable.equals("AD_AllUsers_V"))
foreignTable = "AD_User";
else if (foreignTable.equals("AD_AllRoles_V"))
foreignTable = "AD_Role";
return foreignTable;
}

View File

@ -705,6 +705,7 @@ public class MTable extends X_AD_Table
tablename.equals("AD_AllClients_V") ||
tablename.equals("AD_ReportView") ||
tablename.equals("AD_Role") ||
tablename.equals("AD_AllRoles_V") ||
tablename.equals("AD_System") ||
tablename.equals("AD_User") ||
tablename.equals("AD_AllUsers_V") ||