Skip to content

Commit

Permalink
Fix rbac_context table constraint name
Browse files Browse the repository at this point in the history
The constraint naming strategy we follow is to use the table name
followed by the full columns names involved in the constraint, plus
`_uniq` or `_fk` depending on the type of the constraint.

In this case, we were using a shortened column name, instead of the
full column name.
  • Loading branch information
iarenaza committed Oct 14, 2024
1 parent 3a3318e commit 0fffca6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion resources/dev.gethop.rbac.next/rbac-tables.pg.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CREATE TABLE IF NOT EXISTS rbac_context (
context_type_name VARCHAR(127),
resource_id UUID NOT NULL,
CONSTRAINT rbac_context_context_type_name_fk FOREIGN KEY(context_type_name) REFERENCES rbac_context_type(name) ON UPDATE CASCADE,
CONSTRAINT rbac_context_type_name_resource_id_uniq UNIQUE(context_type_name, resource_id));
CONSTRAINT rbac_context_context_type_name_resource_id_uniq UNIQUE(context_type_name, resource_id));
--;;
CREATE INDEX IF NOT EXISTS rbac_context_resource_id_idx ON rbac_context(resource_id);
--;;
Expand Down

0 comments on commit 0fffca6

Please sign in to comment.