/** * Retrieves the name of the function which corresponds to the field * in question (if any). If no function will be automatically created * for the specified field, <code>null</code> should be returned. * This method is to allow for databases which require the use of * explicitly created functions which correspond to triggers (e.g. * PostgreSQL). Few providers will need to override the default * implementation of this method, which returns <code>null</code>. * * @param triggerNameConverter * @param table The table which contains the field for which a function * may or may not exist. * @param field The field for which a previous migration may have * created a function. * @return The unique name of the function which was created for the * field, or <code>null</code> if none. */ protected String _getFunctionNameForField(TriggerNameConverter triggerNameConverter, DDLTable table, DDLField field) { final String triggerName = _getTriggerNameForField(triggerNameConverter, table, field); return triggerName != null ? triggerName + "()" : null; }
/** * Retrieves the name of the function which corresponds to the field * in question (if any). If no function will be automatically created * for the specified field, <code>null</code> should be returned. * This method is to allow for databases which require the use of * explicitly created functions which correspond to triggers (e.g. * PostgreSQL). Few providers will need to override the default * implementation of this method, which returns <code>null</code>. * * @param triggerNameConverter * @param table The table which contains the field for which a function * may or may not exist. * @param field The field for which a previous migration may have * created a function. * @return The unique name of the function which was created for the * field, or <code>null</code> if none. */ protected String _getFunctionNameForField(TriggerNameConverter triggerNameConverter, DDLTable table, DDLField field) { final String triggerName = _getTriggerNameForField(triggerNameConverter, table, field); return triggerName != null ? triggerName + "()" : null; }
/** * Renders SQL statement(s) to drop the trigger which corresponds to the * specified field, or <code>null</code> if none. * * @param nameConverters * @param table The table containing the field for which a trigger * may need to be rendered. * @param field The field for which the trigger should be rendered, * if any. @return A database-specific DDL statement to drop a trigger for * the field in question, or <code>null</code>. */ protected SQLAction _renderDropTriggerForField(NameConverters nameConverters, DDLTable table, DDLField field) { final String trigger = _getTriggerNameForField(nameConverters.getTriggerNameConverter(), table, field); if (trigger != null) { return SQLAction.of("DROP TRIGGER " + processID(trigger)); } return null; }
/** * Renders SQL statement(s) to drop the trigger which corresponds to the * specified field, or <code>null</code> if none. * * @param nameConverters * @param table The table containing the field for which a trigger * may need to be rendered. * @param field The field for which the trigger should be rendered, * if any. @return A database-specific DDL statement to drop a trigger for * the field in question, or <code>null</code>. */ protected SQLAction _renderDropTriggerForField(NameConverters nameConverters, DDLTable table, DDLField field) { final String trigger = _getTriggerNameForField(nameConverters.getTriggerNameConverter(), table, field); if (trigger != null) { return SQLAction.of("DROP TRIGGER " + processID(trigger)); } return null; }