Skip to content

Latest commit

 

History

History
60 lines (40 loc) · 2.23 KB

policies.md

File metadata and controls

60 lines (40 loc) · 2.23 KB

Policies Operations

pgm.createPolicy( tableName, policyName, options )

Create a new policy - postgres docs

Arguments:

  • tableName [Name] - name of the table to alter
  • policyName [string] - name of the new policy
  • options [object] - options:
    • restrictive [boolean] - RESTRICTIVE instead of PERMISSIVE
    • command [string] - ALL, SELECT, INSERT, UPDATE, or DELETE
    • role [string or array] - the role(s) to which the policy is to be applied
    • using [string] - SQL conditional expression for visibility check
    • check [string] - SQL conditional expression for insert/update check
    • comment [string or null] - comment on the policy

Reverse Operation: dropPolicy


pgm.dropPolicy( tableName, policyName, options )

Drop a policy - postgres docs

Arguments:

  • tableName [Name] - name of the table where the policy is
  • policyName [string] - name of the policy to delete
  • options [object] - options:
    • ifExists [boolean] - drops policy only if it exists

pgm.alterPolicy( tableName, policyName, options )

Alter a policy - postgres docs

Arguments:

  • tableName [Name] - name of the table where the policy is
  • policyName [string] - name of the policy to alter
  • options [object] - options:
    • role [string or array] - the role(s) to which the policy is to be applied
    • using [string] - SQL conditional expression for visibility check
    • check [string] - SQL conditional expression for insert/update check
    • comment [string or null] - comment on the policy

pgm.renamePolicy( tableName, policyName, newPolicyName )

Rename a policy - postgres docs

Arguments:

  • tableName [Name] - name of the table where the policy is
  • policyName [string] - old name of the policy
  • newPolicyName [string] - new name of the policy