pg_manage_constraints
Manage PostgreSQL constraints by listing, creating, or dropping foreign keys and other constraints. Use operations like get, create_fk, drop_fk, create, and drop to handle schema rules efficiently.
Instructions
Manage PostgreSQL constraints - get, create foreign keys, drop foreign keys, create constraints, drop constraints. Examples: operation="get" to list constraints, operation="create_fk" with constraintName, tableName, columnNames, referencedTable, referencedColumns
Input Schema
Name | Required | Description | Default |
---|---|---|---|
cascade | No | Include CASCADE clause (for drop_fk/drop operations) | |
checkExpression | No | Check expression (for create operation with check constraints) | |
columnNames | No | Column names in the table (required for create_fk) | |
connectionString | No | PostgreSQL connection string (optional) | |
constraintName | No | Constraint name (required for create_fk/drop_fk/create/drop) | |
constraintType | No | Filter by constraint type (for get operation) | |
constraintTypeCreate | No | Type of constraint to create (for create operation) | |
deferrable | No | Make constraint deferrable (for create_fk/create operations) | |
ifExists | No | Include IF EXISTS clause (for drop_fk/drop operations) | |
initiallyDeferred | No | Initially deferred (for create_fk/create operations) | |
onDelete | No | ON DELETE action (for create_fk) | |
onUpdate | No | ON UPDATE action (for create_fk) | |
operation | Yes | Operation: get (list constraints), create_fk (foreign key), drop_fk (drop foreign key), create (constraint), drop (constraint) | |
referencedColumns | No | Referenced column names (required for create_fk) | |
referencedSchema | No | Referenced table schema (for create_fk, defaults to same as table schema) | |
referencedTable | No | Referenced table name (required for create_fk) | |
schema | No | Schema name (defaults to public) | |
tableName | No | Table name (optional filter for get, required for create_fk/drop_fk/create/drop) |