Advertisement
Guest User

Untitled

a guest
Jun 29th, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. ALTER TABLE tag_memberships
  2. ADD CONSTRAINT tag_memberships_tag_id_fkey FOREIGN KEY (tag_id)
  3. REFERENCES tags (id) MATCH SIMPLE
  4. ON UPDATE NO ACTION ON DELETE CASCADE
  5.  
  6. ALTER TABLE tag_memberships
  7. ADD CONSTRAINT tag_memberships_organization_id_fkey1 FOREIGN KEY (organization_id, tag_id)
  8. REFERENCES tags (organization_id, id) MATCH SIMPLE
  9. ON UPDATE CASCADE ON DELETE NO ACTION;
  10.  
  11. -- Create table script
  12.  
  13. CREATE TABLE tag_memberships (
  14. id uuid NOT NULL,
  15. tag_id uuid NOT NULL,
  16. template_id uuid NOT NULL,
  17. organization_id uuid NOT NULL, -- tenant id
  18. PRIMARY KEY (id)
  19. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement