Guest User

Untitled

a guest
Feb 24th, 2018
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. exports.seed = function(knex, Promise) {
  2. return Promise.all([
  3. knex('donor').del()
  4. .then(function () {
  5. const donors = [{
  6. name: 'Joao',
  7. address: 'RRR',
  8. age: 37,
  9. sex: 'male',
  10. phone_number: '604-333-3333',
  11. blood: 1
  12. }, {
  13. name: 'Thalita',
  14. address: 'RRR',
  15. age: 35,
  16. sex: 'female',
  17. phone_number: '604-333-3334',
  18. blood: 2
  19. }, {
  20. name: 'Livia',
  21. address: 'YYY',
  22. age: 30,
  23. sex: 'female',
  24. phone_number: '604-333-3335',
  25. blood: 3
  26. }, {
  27. name: 'Daniel',
  28. address: 'YYY',
  29. age: 37,
  30. sex: 'male',
  31. phone_number: '604-333-3337',
  32. blood: 4
  33. }]
  34. return knex('donor').insert(donors)
  35. }),
  36. knex('employee').del()
  37. .then(function () {
  38. const employees = [{
  39. name: 'Eduardo',
  40. address: 'SSS',
  41. role: 2,
  42. email: 'eduardo@bb.ca',
  43. phone_number: '604-333-3333'
  44. }, {
  45. name: 'Priscila',
  46. address: 'VVV',
  47. role: 1,
  48. email: 'priscila@bb.ca',
  49. phone_number: '604-333-3334'
  50. }]
  51. return knex('employee').insert(employees)
  52. }),
  53. knex('role').del()
  54. .then(function () {
  55. const roles = [{
  56. position: 'Receptionist'
  57. }, {
  58. position: 'Manager'
  59. }]
  60. return knex('role').insert(roles)
  61. }),
  62. knex('blood').del()
  63. .then(function () {
  64. const bloods = [{
  65. cost: 100,
  66. type: 'O-'
  67. }, {
  68. cost: 50,
  69. type: 'O+'
  70. }, {
  71. cost: 50,
  72. type: 'A-'
  73. }, {
  74. cost: 50,
  75. type: 'A+'
  76. }, {
  77. cost: 50,
  78. type: 'B-'
  79. }, {
  80. cost: 50,
  81. type: 'B+'
  82. }, {
  83. cost: 50,
  84. type: 'AB-'
  85. }, {
  86. cost: 50,
  87. type: 'AB+'
  88. }]
  89. return knex('blood').insert(bloods)
  90. }),
  91. knex('hospital').del()
  92. .then(function () {
  93. const hospitals = [{
  94. name: 'Burnaby General Hospital',
  95. address: 'BBB',
  96. phone_number: '604-333-3333'
  97. }, {
  98. name: 'Vancouver General Hospital',
  99. address: 'VVV',
  100. phone_number: '604-333-3334'
  101. }]
  102. return knex('hospital').insert(hospitals)
  103. }),
  104. knex('bloodbank').del()
  105. .then(function () {
  106. const bloodbanks = [{
  107. emp_id: 1
  108. }]
  109. return knex('bloodbank').insert(bloodbanks)
  110. })
  111. ])
  112. }
Add Comment
Please, Sign In to add comment