Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create table blog_posts (
- id uuid not null,
- tenant_id uuid not null,
- title text not null,
- content text not null,
- primary key (id)
- );
- create unique index blog_posts_tenant_id_id_idx on blog_posts (tenant_id, id);
- create table comments (
- id uuid not null,
- tenant_id uuid not null,
- blog_post_id uuid not null references blog_posts (id),
- content text not null,
- primary key (id)
- );
- alter table comments add foreign key (tenant_id, blog_post_id)
- references blog_posts (tenant_id, id)
- on update cascade;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement