IDEMPIERE-1520 Ability to delete an index within AD / Based on patch from Nicolas Micoud (nmicoud)
This commit is contained in:
parent
2f92852280
commit
1c862454ea
|
@ -0,0 +1,26 @@
|
||||||
|
SET SQLBLANKLINES ON
|
||||||
|
SET DEFINE OFF
|
||||||
|
|
||||||
|
-- Nov 20, 2013 10:07:29 AM CET
|
||||||
|
-- IDEMPIERE-1520 Ability to delete an index within AD
|
||||||
|
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Element_UU,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,202628,'e7399236-2b73-40af-a72e-16158c2df11f',0,'TableIndexDrop',TO_DATE('2013-11-20 10:07:27','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Drop table index','Drop table index',TO_DATE('2013-11-20 10:07:27','YYYY-MM-DD HH24:MI:SS'),100)
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 20, 2013 10:08:06 AM CET
|
||||||
|
INSERT INTO AD_Process (AD_Client_ID,AD_Org_ID,AD_Process_ID,AD_Process_UU,AccessLevel,Classname,CopyFromProcess,Created,CreatedBy,EntityType,IsActive,IsBetaFunctionality,IsDirectPrint,IsReport,IsServerProcess,Name,ShowHelp,Statistic_Count,Statistic_Seconds,Updated,UpdatedBy,Value) VALUES (0,0,200065,'e93b81bb-e3a1-4fb4-b825-39ebfbbe212f','4','org.compiere.process.TableIndexDrop','N',TO_DATE('2013-11-20 10:08:06','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','N','N','N','Drop Table Index','Y',0,0,TO_DATE('2013-11-20 10:08:06','YYYY-MM-DD HH24:MI:SS'),100,'TableIndexDrop')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 20, 2013 10:08:30 AM CET
|
||||||
|
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Column_UU,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FKConstraintType,FieldLength,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSecure,IsSelectionColumn,IsSyncDatabase,IsToolbarButton,IsTranslated,IsUpdateable,Name,SeqNo,SeqNoSelection,Updated,UpdatedBy,Version) VALUES (0,210889,'5a7e6f14-4e5f-4051-ae2d-88cc6642fa24',202628,0,200065,28,200085,'TableIndexDrop',TO_DATE('2013-11-20 10:08:30','YYYY-MM-DD HH24:MI:SS'),100,'D','N',1,'Y','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','N','Y','Drop table index',0,0,TO_DATE('2013-11-20 10:08:30','YYYY-MM-DD HH24:MI:SS'),100,0)
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 20, 2013 10:08:33 AM CET
|
||||||
|
ALTER TABLE AD_TableIndex ADD TableIndexDrop CHAR(1) DEFAULT NULL
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 20, 2013 10:09:27 AM CET
|
||||||
|
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Field_UU,AD_Org_ID,AD_Tab_ID,ColumnSpan,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,Updated,UpdatedBy,XPosition) VALUES (0,210889,202535,'25be136d-efd6-4afc-8792-c47e3e0b53ef',0,200096,2,TO_DATE('2013-11-20 10:09:26','YYYY-MM-DD HH24:MI:SS'),100,1,'D','Y','Y','Y','N','N','N','N','N','Drop table index',130,TO_DATE('2013-11-20 10:09:26','YYYY-MM-DD HH24:MI:SS'),100,2)
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201311201011_IDEMPIERE-1520.sql') FROM dual
|
||||||
|
;
|
|
@ -0,0 +1,23 @@
|
||||||
|
-- Nov 20, 2013 10:07:29 AM CET
|
||||||
|
-- IDEMPIERE-1520 Ability to delete an index within AD
|
||||||
|
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Element_UU,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,202628,'e7399236-2b73-40af-a72e-16158c2df11f',0,'TableIndexDrop',TO_TIMESTAMP('2013-11-20 10:07:27','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Drop table index','Drop table index',TO_TIMESTAMP('2013-11-20 10:07:27','YYYY-MM-DD HH24:MI:SS'),100)
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 20, 2013 10:08:06 AM CET
|
||||||
|
INSERT INTO AD_Process (AD_Client_ID,AD_Org_ID,AD_Process_ID,AD_Process_UU,AccessLevel,Classname,CopyFromProcess,Created,CreatedBy,EntityType,IsActive,IsBetaFunctionality,IsDirectPrint,IsReport,IsServerProcess,Name,ShowHelp,Statistic_Count,Statistic_Seconds,Updated,UpdatedBy,Value) VALUES (0,0,200065,'e93b81bb-e3a1-4fb4-b825-39ebfbbe212f','4','org.compiere.process.TableIndexDrop','N',TO_TIMESTAMP('2013-11-20 10:08:06','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','N','N','N','Drop Table Index','Y',0,0,TO_TIMESTAMP('2013-11-20 10:08:06','YYYY-MM-DD HH24:MI:SS'),100,'TableIndexDrop')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 20, 2013 10:08:30 AM CET
|
||||||
|
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Column_UU,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FKConstraintType,FieldLength,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSecure,IsSelectionColumn,IsSyncDatabase,IsToolbarButton,IsTranslated,IsUpdateable,Name,SeqNo,SeqNoSelection,Updated,UpdatedBy,Version) VALUES (0,210889,'5a7e6f14-4e5f-4051-ae2d-88cc6642fa24',202628,0,200065,28,200085,'TableIndexDrop',TO_TIMESTAMP('2013-11-20 10:08:30','YYYY-MM-DD HH24:MI:SS'),100,'D','N',1,'Y','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','N','Y','Drop table index',0,0,TO_TIMESTAMP('2013-11-20 10:08:30','YYYY-MM-DD HH24:MI:SS'),100,0)
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 20, 2013 10:08:33 AM CET
|
||||||
|
ALTER TABLE AD_TableIndex ADD COLUMN TableIndexDrop CHAR(1) DEFAULT NULL
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 20, 2013 10:09:27 AM CET
|
||||||
|
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Field_UU,AD_Org_ID,AD_Tab_ID,ColumnSpan,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,Updated,UpdatedBy,XPosition) VALUES (0,210889,202535,'25be136d-efd6-4afc-8792-c47e3e0b53ef',0,200096,2,TO_TIMESTAMP('2013-11-20 10:09:26','YYYY-MM-DD HH24:MI:SS'),100,1,'D','Y','Y','Y','N','N','N','N','N','Drop table index',130,TO_TIMESTAMP('2013-11-20 10:09:26','YYYY-MM-DD HH24:MI:SS'),100,2)
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201311201011_IDEMPIERE-1520.sql') FROM dual
|
||||||
|
;
|
|
@ -0,0 +1,39 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||||
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
* by the Free Software Foundation. This program is distributed in the hope *
|
||||||
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||||
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
|
* See the GNU General Public License for more details. *
|
||||||
|
* You should have received a copy of the GNU General Public License along *
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
|
******************************************************************************/
|
||||||
|
package org.compiere.process;
|
||||||
|
|
||||||
|
import org.compiere.model.MTableIndex;
|
||||||
|
import org.compiere.util.DB;
|
||||||
|
|
||||||
|
public class TableIndexDrop extends SvrProcess {
|
||||||
|
|
||||||
|
private int p_AD_TableIndex_ID = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void prepare()
|
||||||
|
{
|
||||||
|
p_AD_TableIndex_ID = getRecord_ID();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String doIt() throws Exception
|
||||||
|
{
|
||||||
|
MTableIndex index = new MTableIndex(getCtx(), p_AD_TableIndex_ID, get_TrxName());
|
||||||
|
log.info(index.toString());
|
||||||
|
|
||||||
|
String sql = "DROP INDEX " + index.getName();
|
||||||
|
int rvalue = DB.executeUpdateEx(sql, get_TrxName());
|
||||||
|
|
||||||
|
return rvalue + " - " + sql;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // TableIndexDrop
|
|
@ -95,13 +95,10 @@ public class TableIndexValidate extends SvrProcess {
|
||||||
else if (!found)
|
else if (!found)
|
||||||
{
|
{
|
||||||
String sql = index.getDDL();
|
String sql = index.getDDL();
|
||||||
int rvalue = DB.executeUpdate(sql, (Object[]) null, true, trxName);
|
int rvalue = DB.executeUpdateEx(sql, (Object[]) null, trxName);
|
||||||
if (pi != null)
|
if (pi != null)
|
||||||
pi.addLog(0, null, new BigDecimal(rvalue), sql);
|
pi.addLog(0, null, new BigDecimal(rvalue), sql);
|
||||||
if (rvalue == -1)
|
return Msg.getMsg(ctx, "CreatedIndexSuccess");
|
||||||
throw new AdempiereException(Msg.getMsg(ctx, "Failed to create index"));
|
|
||||||
else
|
|
||||||
return Msg.getMsg(ctx, "CreatedIndexSuccess");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue