Advertisement
Guest User

Untitled

a guest
Oct 12th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. # schema.yml of moneyMaintance
  2.  
  3. User:
  4. columns:
  5. username:
  6. type: string(255)
  7. notnull: true
  8. password:
  9. type: string(255)
  10. notnull: true
  11. indexes:
  12. userUsername:
  13. fields: [username]
  14. type: unique
  15. relations:
  16. BankAccounts:
  17. type: many
  18. class: BankAccout
  19. local: id
  20. foreign: user_id
  21. onDelete: CASCADE
  22. Bills:
  23. type: many
  24. class: Bill
  25. local: id
  26. foreign: user_id
  27. onDelete: CASCADE
  28.  
  29.  
  30. BankAccount:
  31. columns:
  32. name:
  33. type: string(255)
  34. notnull: true
  35. credit: float
  36. user_id: integer
  37. relations:
  38. User:
  39. local: user_id
  40. foreign: id
  41. foreignAlias: BankAccounts
  42. onDelete: CASCADE
  43. Bills:
  44. type: many
  45. class: Bill
  46. local: id
  47. foreign: bankAccount_id
  48. onDelete: CASCADE
  49.  
  50. Bill:
  51. columns:
  52. size: float
  53. name:
  54. type: string(255)
  55. notnull: true
  56. user_id: integer
  57. bankAccount_id: integer
  58. indexes:
  59. billName:
  60. fields: [name]
  61. type: unique
  62. relations:
  63. BankAccount:
  64. local: bankAccount_id
  65. foreign: id
  66. onDelete: CASCADE
  67. User:
  68. local: user_id
  69. foreign: id
  70. onDelete: CASCADE
  71. Articles:
  72. class: Article
  73. local: bill_id
  74. foreign: article_id
  75. refClass: BillArticle
  76. cascade: [delete]
  77.  
  78. Article:
  79. columns:
  80. name:
  81. type: string(255)
  82. notnull: true
  83. price: float
  84. category_id: integer
  85. indexes:
  86. articleName:
  87. fields: [name]
  88. type: unique
  89. articlePrice:
  90. fields: [price]
  91. relations:
  92. Category:
  93. local: category_id
  94. foreign: id
  95. foreignAlias: Articles
  96. onDelete: SET NULL
  97. Bills:
  98. class: Bill
  99. local: article_id
  100. foreign: bill_id
  101. refClass: BillArticle
  102. cascade: [delete]
  103.  
  104. Category:
  105. columns:
  106. name:
  107. type: string(255)
  108. notnull: true
  109. indexes:
  110. categoryName:
  111. fields: [name]
  112. type: unique
  113. relations:
  114. Articles:
  115. type: many
  116. class: Article
  117. local: id
  118. foreign: category_id
  119. #onDelete: NULL
  120.  
  121. # MANY TO MANY CLASSES!
  122.  
  123. BillArticle:
  124. columns:
  125. bill_id:
  126. type: integer
  127. primary: true
  128. article_id:
  129. type: integer
  130. primary: true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement