schema.sql 878 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. create table user
  2. ( id integer primary key
  3. , name text unique not null
  4. , is_admin bool
  5. );
  6. create table link
  7. ( id integer primary key
  8. , url text not null
  9. , name text not null
  10. , description text not null
  11. , created datetime not null
  12. , private bool not null
  13. , user integer not null
  14. , foreign key(user) references user(id)
  15. );
  16. create table tag
  17. ( id integer primary key
  18. , name text not null
  19. , parent integer not null
  20. , user integer not null
  21. , foreign key(parent) references tag(id)
  22. , foreign key(user) references user(id)
  23. , unique(name, user)
  24. );
  25. create table has_tag
  26. ( id integer primary key
  27. , link integer not null
  28. , user integer not null
  29. , foreign key(link) references link(id)
  30. , foreign key(user) references user(id)
  31. , unique(link, user)
  32. );
  33. create table user_invite
  34. ( id integer primary key
  35. , token text not null
  36. );