Added the trigger definitions to the sql for a table. Also tuned the formatting of the trigger definitions a bit.

This commit is contained in:
eelke 2018-12-27 12:15:37 +01:00
parent 4ec4e02411
commit 769307c821
2 changed files with 12 additions and 6 deletions

View file

@ -32,7 +32,7 @@ QString PgTrigger::createSql()
m_createSql += "\n ON " + fqtablename;
if (deferrable) {
m_createSql += "\n DEFERRABLE INITIALLY ";
m_createSql += " DEFERRABLE INITIALLY ";
if (initdeferred)
m_createSql += "DEFERRED";
else
@ -42,12 +42,12 @@ QString PgTrigger::createSql()
// requires atleast 8.5 don;t think we have to support older
if (!whenclause.isEmpty())
m_createSql += "\n WHEN (" + whenclause + ")";
m_createSql += " WHEN (" + whenclause + ")";
m_createSql += QString("\n EXECUTE PROCEDURE %1;\n").arg(procedure());
m_createSql += QString("\n EXECUTE PROCEDURE %1;").arg(procedure());
if (!enabled)
m_createSql += QString("ALTER TABLE %1 DISABLE TRIGGER %2;\n").arg(fqtablename, triggername);
m_createSql += QString("\nALTER TABLE %1 DISABLE TRIGGER %2;").arg(fqtablename, triggername);
// if (!GetComment().IsEmpty())
// sql += wxT("COMMENT ON TRIGGER ") + GetQuotedIdentifier() + wxT(" ON ") + GetQuotedFullTable()