Recreate view and triggers
Views and triggers allow your applications to interact with the encrypted data seamlessly. When you create a view on a table, the base table is renamed and a view is created with the original name of the table. Additionally, unique triggers are created for inserts and updates.
Views and triggers are created as part of the data migration. Perform this operation only if the views and triggers were previously deleted.
To recreate views and triggers, a user must have the following permissions within the schema in which the table resides:
Connect
Create any view
Drop any view
Create any trigger
Drop any trigger
Note
If the table is referenced in a view, materialized query table, trigger, SQL function, SQL method, check constraint, or referential constraint, or has a column that is a foreign key, manually drop those constraints before creating views and triggers. Those attributes can be recreated after the views and triggers are in place.
Prerequisite
The pdbctl utility must be installed.
Steps
To recreate views and triggers for a table, run the following command:
./pdbctl createview -a <database_alias> -t <table_name>
Flags description
The following table describes the flags and parameters associated with this command:
Flag | Data Type | Description |
---|---|---|
-a | string | Database alias associated with the database user. |
-h | Flag to view help for createview command. | |
-i | string | Insert trigger name. This is an optional parameter. |
-n | string | New table name. This is an optional parameter. |
-t | string | Table name on which views and triggers will be created. |
-u | string | Updated trigger name. This is an optional parameter. |
-- verbose | Print verbose logs. | |
-v | string | View name. This is an optional parameter. |
Example
The following sample command creates the views and triggers for the table CUSTOMERS:
./pdbctl createview -a demo -t CUSTOMERS