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

@ -3,13 +3,14 @@
#include "catalog/PgAttribute.h"
#include "catalog/PgDatabaseCatalog.h"
#include "catalog/PgIndexContainer.h"
#include "catalog/PgTriggerContainer.h"
#include "ColumnPage.h"
#include "ColumnTableModel.h"
#include "ConstraintModel.h"
#include "IconColumnDelegate.h"
#include "IndexModel.h"
#include "MainWindow.h"
#include "catalog/PgIndexContainer.h"
#include "PgLabItemDelegate.h"
#include "PropertiesPage.h"
#include "ResultTableModelUtil.h"
@ -264,10 +265,15 @@ void TablesPage::updateSqlTab(const std::optional<PgClass> &table)
// Triggers
drop_sql += "-- drop Triggers\n";
create_sql += "-- create Triggers\n";
auto && triggers = m_catalog->triggers()->getTriggersForRelation(table->oid());
for (auto && trg : triggers) {
drop_sql += trg.dropSql() % "\n";
create_sql += trg.createSql() % "\n";
}
// Privileges
create_sql += "-- set Privileges\n";
create_sql += table->grantSql();
create_sql += table->grantSql() % "\n";
// Comments
create_sql += "-- set Comments table + columns\n";