Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. create table users (
  2. id serial primary key,
  3. login varchar(30) unique not null,
  4. password_hash varchar(100) not null
  5. );
  6.  
  7. create table `character` (
  8. id serial primary key,
  9. creator_id bigint unsigned not null,
  10. name longtext not null,
  11. bio longtext,
  12. age int,
  13. height int,
  14. temperament longtext,
  15. likes longtext,
  16. dislikes longtext,
  17. fears longtext,
  18. profileimage mediumtext,
  19. foreign key (creator_id) references users(id)
  20. );
  21.  
  22. create table character_images (
  23. character_id bigint unsigned not null,
  24. imagepath text not null,
  25. foreign key (character_id) references `character`(id)
  26. );
  27.  
  28. create table story (
  29. id serial primary key,
  30. creator_id bigint unsigned not null,
  31. name text not null,
  32. year year not null,
  33. genre text,
  34. type text,
  35. plot text,
  36. foreign key (creator_id) references users(id)
  37. );
  38.  
  39. create table character_relationships (
  40. one_char_id bigint unsigned not null,
  41. another_char_id bigint unsigned not null,
  42. relationship int not null,
  43. tag mediumtext,
  44. foreign key (one_char_id) references `character`(id),
  45. foreign key (another_char_id) references `character`(id),
  46. primary key (one_char_id, another_char_id)
  47. );
  48.  
  49. create table character_story (
  50. character_id bigint unsigned not null,
  51. story_id bigint unsigned not null,
  52. foreign key (character_id) references `character`(id),
  53. foreign key (story_id) references story(id),
  54. primary key (character_id, story_id)
  55. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement