dbschema.json 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. {
  2. "db_name": "ZeroTalk",
  3. "db_file": "data/users/zerotalk.db",
  4. "version": 2,
  5. "maps": {
  6. ".+/data.json": {
  7. "to_table": [
  8. {"node": "topic", "table": "topic"},
  9. {"node": "topic_vote", "table": "topic_vote", "key_col": "topic_uri", "val_col": "vote"},
  10. {"node": "comment", "table": "comment", "key_col": "topic_uri"},
  11. {"node": "comment_vote", "table": "comment_vote", "key_col": "comment_uri", "val_col": "vote"}
  12. ],
  13. "to_keyvalue": ["next_comment_id", "next_topic_id"]
  14. },
  15. ".+/content.json": {
  16. "to_keyvalue": [ "cert_user_id" ]
  17. }
  18. },
  19. "tables": {
  20. "topic": {
  21. "cols": [
  22. ["topic_id", "INTEGER"],
  23. ["title", "TEXT"],
  24. ["body", "TEXT"],
  25. ["type", "TEXT"],
  26. ["parent_topic_uri", "TEXT"],
  27. ["added", "DATETIME"],
  28. ["json_id", "INTEGER REFERENCES json (json_id)"]
  29. ],
  30. "indexes": ["CREATE UNIQUE INDEX topic_key ON topic(topic_id, json_id)"],
  31. "schema_changed": 1
  32. },
  33. "comment": {
  34. "cols": [
  35. ["comment_id", "INTEGER"],
  36. ["body", "TEXT"],
  37. ["topic_uri", "TEXT"],
  38. ["added", "DATETIME"],
  39. ["json_id", "INTEGER REFERENCES json (json_id)"]
  40. ],
  41. "indexes": ["CREATE INDEX topic_uri ON comment(topic_uri)", "CREATE UNIQUE INDEX comment_key ON comment(json_id, comment_id)"],
  42. "schema_changed": 1
  43. },
  44. "comment_vote": {
  45. "cols": [
  46. ["comment_uri", "TEXT"],
  47. ["vote", "INTEGER"],
  48. ["json_id", "INTEGER REFERENCES json (json_id)"]
  49. ],
  50. "indexes": ["CREATE UNIQUE INDEX comment_vote_key ON comment_vote(comment_uri, json_id)", "CREATE INDEX comment_vote_uri ON comment_vote(comment_uri)"],
  51. "schema_changed": 1
  52. },
  53. "topic_vote": {
  54. "cols": [
  55. ["topic_uri", "TEXT"],
  56. ["vote", "INTEGER"],
  57. ["json_id", "INTEGER REFERENCES json (json_id)"]
  58. ],
  59. "indexes": ["CREATE UNIQUE INDEX topic_vote_topic_key ON topic_vote(topic_uri, json_id)", "CREATE INDEX topic_vote_uri ON topic_vote(topic_uri)"],
  60. "schema_changed": 1
  61. }
  62. }
  63. }