@itleanchatbot/shared-models-js-postgres 1.5.91 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/package.json +6 -2
  2. package/src/migrations/2021050204551-create-extension-uuid-ossp.js +12 -0
  3. package/src/migrations/20210503140511-create-channel-types.js +56 -0
  4. package/src/migrations/20210503141113-create-channel-configurations.js +56 -0
  5. package/src/migrations/20210503141528-create-enterprises.js +47 -0
  6. package/src/migrations/20210503142049-create-permissions.js.js +44 -0
  7. package/src/migrations/20210503142205-create-profiles.js.js +33 -0
  8. package/src/migrations/20210503142259-create-profiles-permissions.js +45 -0
  9. package/src/migrations/20210503142433-create-system-users.js +61 -0
  10. package/src/migrations/20210503142528-create-system-users-profiles.js +45 -0
  11. package/src/migrations/20210503142645-create-departments.js +49 -0
  12. package/src/migrations/20210503142739-create-clients.js +44 -0
  13. package/src/migrations/20210503142857-create-intelligences.js +48 -0
  14. package/src/migrations/20210503142959-create-ibm-providers.js +71 -0
  15. package/src/migrations/20210503151909-create-itlean-providers.js +53 -0
  16. package/src/migrations/20210503154612-create-skills.js +114 -0
  17. package/src/migrations/20210503161006-create-files.js +53 -0
  18. package/src/migrations/20210503161236-create-channels.js +66 -0
  19. package/src/migrations/20210503161308-create-sessions.js +67 -0
  20. package/src/migrations/20210503161503-create-subdepartments.js +49 -0
  21. package/src/migrations/20210503161543-create-branches.js +53 -0
  22. package/src/migrations/20210503161909-create-lines.js +55 -0
  23. package/src/migrations/20210503161947-create-entities.js +56 -0
  24. package/src/migrations/20210503162126-create-intentions.js +56 -0
  25. package/src/migrations/20210503162213-create-intentions-values.js +51 -0
  26. package/src/migrations/20210503162618-create-entities-values.js +67 -0
  27. package/src/migrations/20210503162752-create-synonyms.js +71 -0
  28. package/src/migrations/20210503163331-create-responses.js +58 -0
  29. package/src/migrations/20210503163437-create-responses-boxes.js +66 -0
  30. package/src/migrations/20210503163702-create-languages.js +42 -0
  31. package/src/migrations/20210503184109-create-groups.js +53 -0
  32. package/src/migrations/20210503185846-create-contacts.js +55 -0
  33. package/src/migrations/20210503190220-create-groups-contacts.js +47 -0
  34. package/src/migrations/20210503190338-create-fields.js +40 -0
  35. package/src/migrations/20210503190515-create-apis.js +65 -0
  36. package/src/migrations/20210503191041-create-apis-resources-body.js +46 -0
  37. package/src/migrations/20210503191107-create-apis-resources.js +74 -0
  38. package/src/migrations/20210503191253-create-apis-resources-headers.js +53 -0
  39. package/src/migrations/20210503193228-create-apis-resources-query-string-params.js +61 -0
  40. package/src/migrations/20210503193425-create-apis-resources-path-params.js +52 -0
  41. package/src/migrations/20210503193511-create-dialog-nodes.js +121 -0
  42. package/src/migrations/20210503193629-create-response-dialog-nodes.js +46 -0
  43. package/src/migrations/20210503193905-create-system-users-lines.js +45 -0
  44. package/src/migrations/20210503194004-create-attendances.js +80 -0
  45. package/src/migrations/20210503194036-create-tranship-conversations.js +65 -0
  46. package/src/migrations/20210503194204-create-line-configurations.js +75 -0
  47. package/src/migrations/20210504133611-create-templates.js +68 -0
  48. package/src/migrations/20210504133647-create-socket-clients.js +73 -0
  49. package/src/migrations/20210504143703-create-dialog-nodes-multiple-responses.js +47 -0
  50. package/src/migrations/20210504144332-create-messages-hsm.js +72 -0
  51. package/src/migrations/20210504144657-create-dialog-nodes-api-resources.js +54 -0
  52. package/src/migrations/20210504144730-create-send-hsm.js +62 -0
  53. package/src/migrations/20210504144859-create-messages-hsm-channels.js +48 -0
  54. package/src/migrations/20210504144931-create-open-faqs.js +55 -0
  55. package/src/migrations/20210504145032-create-return-hsm.js +50 -0
  56. package/src/migrations/20210504160623-create-group-send-hsm.js +52 -0
  57. package/src/migrations/20210504164445-create-extension-unaccent.js +11 -0
  58. package/src/migrations/20210504164516-create-extension-fuzzy.js +11 -0
  59. package/src/migrations/20210504164553-create-attendance-scale.js +48 -0
  60. package/src/migrations/20210504164613-create-attendance-scale-off.js +58 -0
  61. package/src/migrations/20210504165351-create-comments.js +42 -0
  62. package/src/migrations/20210504165421-create-quick-messages.js +49 -0
  63. package/src/migrations/20210504165514-create-bot-iterables.js +60 -0
  64. package/src/migrations/20210504165900-create-tranship-triggers.js +114 -0
  65. package/src/migrations/20210505025504-create-send-hsm-return-hsm.js +34 -0
  66. package/src/migrations/20210507012938-create-faq-triggers.js +68 -0
  67. package/src/migrations/20210518122431-alter-responses.js +17 -0
  68. package/src/migrations/20210524150418-create-faq-questions.js +51 -0
  69. package/src/migrations/20210524173157-alter-table-open-faq.js +17 -0
  70. package/src/migrations/20210526115430-alter-attendances.js +14 -0
  71. package/src/migrations/20210528101030-alter-attendances.js +82 -0
  72. package/src/migrations/20210609103918-create-table-postbakGupshup.js +46 -0
  73. package/src/migrations/20210613125036-unnamed-migration.js +21 -0
  74. package/src/migrations/20210614194609-alter-channels.js +14 -0
  75. package/src/migrations/20210618101840-alter-table-MessagesHsms.js +14 -0
  76. package/src/migrations/20210622132643-alter-table-postbackGupshup.js +11 -0
  77. package/src/migrations/20210623110159-alter-table-botinterable.js +176 -0
  78. package/src/migrations/20210623180356-alter-dialog-nodes-api-resources.js +15 -0
  79. package/src/migrations/20210625165930-alter-dialog-nodes-api-resources.js +15 -0
  80. package/src/migrations/20210708142712-alter-table-entity-values.js +17 -0
  81. package/src/migrations/20210708145259-alter-table-synonyms.js +25 -0
  82. package/src/migrations/20210719161230-alter-attendances.js +14 -0
  83. package/src/migrations/20210727095921-alter-name-size.js +39 -0
  84. package/src/migrations/20210727110430-create-endSessionTriggers.js +71 -0
  85. package/src/migrations/20210728140327-create-table-online-editing.js +42 -0
  86. package/src/migrations/20210810152747-alter-botIterables.js +26 -0
  87. package/src/migrations/20210812110330-create-indexes.js +101 -0
  88. package/src/migrations/20210816124430-create-inactivityTriggers.js +60 -0
  89. package/src/migrations/20210819155330-create-function.js +123 -0
  90. package/src/migrations/20210823145424-remove-names-botiterables.js +74 -0
  91. package/src/migrations/20210902145430-create-apiKeys.js +40 -0
  92. package/src/migrations/20210906092430-create-customPostback.js +44 -0
  93. package/src/migrations/20210906144034-alter-api-body-migration.js +74 -0
  94. package/src/migrations/20210910081430-create-transhipInactivityTriggers.js +48 -0
  95. package/src/migrations/20210923131530-alter-attendances.js +14 -0
  96. package/src/migrations/20210923140130-create-function.js +85 -0
  97. package/src/migrations/20210927141630-alter-attendances.js +32 -0
  98. package/src/migrations/20211020130541-alter-table-session-hasTranship.js +14 -0
  99. package/src/migrations/20211025155825-create-stopwords.js +52 -0
  100. package/src/models/index.js +45 -0
  101. package/src/seeders/20210414180447-change-ChannelTypes.js +47 -0
  102. package/src/seeders/20210505130137-insert-channel-types.js +65 -0
  103. package/src/seeders/20210505132612-insert-intelligence.js +27 -0
  104. package/src/seeders/20210505134121-insert-enterprise.js +15 -0
  105. package/src/seeders/20210505134345-insert-permissions.js +125 -0
  106. package/src/seeders/20210505134549-insert-profiles.js +39 -0
  107. package/src/seeders/20210505134700-insert-profiles-permissions.js +80 -0
  108. package/src/seeders/20210505135931-insert-system-users.js +52 -0
  109. package/src/seeders/20210505140025-insert-system-users-profiles.js +26 -0
  110. package/src/seeders/20210505140049-insert-language.js +21 -0
  111. package/src/seeders/20210505140259-insert-itlean-provider.js +34 -0
  112. package/src/seeders/20210505140343-insert-templates.js +229 -0
  113. package/src/seeders/20210505140658-insert-channel-configurations.js +146 -0
  114. package/src/seeders/20210618132740-add-new-channel-configutations.js +45 -0
  115. package/src/seeders/20210817081230-insert-profiles-permissions.js +105 -0
  116. package/src/seeders/20210830131930-insert-profiles-permissions.js +71 -0
  117. package/src/seeders/20210902160430-insert-apiKey.js +30 -0
  118. package/src/seeders/20211005135921-edit-gupshup-reponseTypes.js +47 -0
  119. package/index.js +0 -125
  120. /package/src/{apiKeys.js → models/apiKeys.js} +0 -0
  121. /package/src/{apiResourceBodies.js → models/apiResourceBodies.js} +0 -0
  122. /package/src/{apiResourceHeaders.js → models/apiResourceHeaders.js} +0 -0
  123. /package/src/{apiResourcePathParams.js → models/apiResourcePathParams.js} +0 -0
  124. /package/src/{apiResourceQueryStringParams.js → models/apiResourceQueryStringParams.js} +0 -0
  125. /package/src/{apiResources.js → models/apiResources.js} +0 -0
  126. /package/src/{apis.js → models/apis.js} +0 -0
  127. /package/src/{attendanceScale.js → models/attendanceScale.js} +0 -0
  128. /package/src/{attendanceScaleOff.js → models/attendanceScaleOff.js} +0 -0
  129. /package/src/{attendances.js → models/attendances.js} +0 -0
  130. /package/src/{botIterable.js → models/botIterable.js} +0 -0
  131. /package/src/{branches.js → models/branches.js} +0 -0
  132. /package/src/{channelConfigurations.js → models/channelConfigurations.js} +0 -0
  133. /package/src/{channelTypes.js → models/channelTypes.js} +0 -0
  134. /package/src/{channels.js → models/channels.js} +0 -0
  135. /package/src/{client.js → models/client.js} +0 -0
  136. /package/src/{comments.js → models/comments.js} +0 -0
  137. /package/src/{customPostbacks.js → models/customPostbacks.js} +0 -0
  138. /package/src/{departments.js → models/departments.js} +0 -0
  139. /package/src/{dialogNodes.js → models/dialogNodes.js} +0 -0
  140. /package/src/{dialogNodes_MultipleResponses.js → models/dialogNodes_MultipleResponses.js} +0 -0
  141. /package/src/{dialogNodes_apiResources.js → models/dialogNodes_apiResources.js} +0 -0
  142. /package/src/{endSessionTriggers.js → models/endSessionTriggers.js} +0 -0
  143. /package/src/{enterprises.js → models/enterprises.js} +0 -0
  144. /package/src/{entity.js → models/entity.js} +0 -0
  145. /package/src/{entityValues.js → models/entityValues.js} +0 -0
  146. /package/src/{faqQuestions.js → models/faqQuestions.js} +0 -0
  147. /package/src/{faqTriggers.js → models/faqTriggers.js} +0 -0
  148. /package/src/{files.js → models/files.js} +0 -0
  149. /package/src/{ibmProvider.js → models/ibmProvider.js} +0 -0
  150. /package/src/{inactivityTriggers.js → models/inactivityTriggers.js} +0 -0
  151. /package/src/{intelligence.js → models/intelligence.js} +0 -0
  152. /package/src/{intention.js → models/intention.js} +0 -0
  153. /package/src/{intentionValue.js → models/intentionValue.js} +0 -0
  154. /package/src/{itleanProvider.js → models/itleanProvider.js} +0 -0
  155. /package/src/{lineConfigurations.js → models/lineConfigurations.js} +0 -0
  156. /package/src/{lines.js → models/lines.js} +0 -0
  157. /package/src/{messagesHsm.js → models/messagesHsm.js} +0 -0
  158. /package/src/{openFaqs.js → models/openFaqs.js} +0 -0
  159. /package/src/{permissions.js → models/permissions.js} +0 -0
  160. /package/src/{postbackGupshup.js → models/postbackGupshup.js} +0 -0
  161. /package/src/{profile.js → models/profile.js} +0 -0
  162. /package/src/{profiles_permission.js → models/profiles_permission.js} +0 -0
  163. /package/src/{quickMessages.js → models/quickMessages.js} +0 -0
  164. /package/src/{response_DialogNodes.js → models/response_DialogNodes.js} +0 -0
  165. /package/src/{responses.js → models/responses.js} +0 -0
  166. /package/src/{responsesBoxes.js → models/responsesBoxes.js} +0 -0
  167. /package/src/{returnHsm.js → models/returnHsm.js} +0 -0
  168. /package/src/{sessions.js → models/sessions.js} +0 -0
  169. /package/src/{skill.js → models/skill.js} +0 -0
  170. /package/src/{socketClients.js → models/socketClients.js} +0 -0
  171. /package/src/{stopwords.js → models/stopwords.js} +0 -0
  172. /package/src/{subDepartments.js → models/subDepartments.js} +0 -0
  173. /package/src/{synonyms.js → models/synonyms.js} +0 -0
  174. /package/src/{systemUsers.js → models/systemUsers.js} +0 -0
  175. /package/src/{systemUsers_Lines.js → models/systemUsers_Lines.js} +0 -0
  176. /package/src/{systemUsers_profiles.js → models/systemUsers_profiles.js} +0 -0
  177. /package/src/{templates.js → models/templates.js} +0 -0
  178. /package/src/{transhipConversations.js → models/transhipConversations.js} +0 -0
  179. /package/src/{transhipInactivityTriggers.js → models/transhipInactivityTriggers.js} +0 -0
  180. /package/src/{transhipTriggers.js → models/transhipTriggers.js} +0 -0
@@ -0,0 +1,176 @@
1
+ 'use strict'
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, Sequelize) => {
5
+ await queryInterface.bulkDelete('BotIterables', null, {})
6
+ await queryInterface.removeColumn('BotIterables', 'identify', {})
7
+ await queryInterface.removeColumn('BotIterables', 'client', {})
8
+ await queryInterface.removeColumn('BotIterables', 'bot', {})
9
+ await queryInterface.removeColumn('BotIterables', 'ChannelId', {})
10
+
11
+ // Response
12
+ await queryInterface.addColumn('BotIterables', 'ResponseId', {
13
+ type: Sequelize.UUID,
14
+ references: {
15
+ model: 'Responses',
16
+ key: 'id',
17
+ },
18
+ allowNull: true,
19
+ onDelete: 'CASCADE',
20
+ onUpdate: 'CASCADE',
21
+ })
22
+ await queryInterface.addColumn('BotIterables', 'responseName', {
23
+ type: Sequelize.STRING(255),
24
+ allowNull: true,
25
+ })
26
+
27
+ // Open Faq
28
+ await queryInterface.addColumn('BotIterables', 'OpenFAQId', {
29
+ type: Sequelize.UUID,
30
+ references: {
31
+ model: 'OpenFAQs',
32
+ key: 'id',
33
+ },
34
+ allowNull: true,
35
+ onDelete: 'CASCADE',
36
+ onUpdate: 'CASCADE',
37
+ })
38
+ await queryInterface.addColumn('BotIterables', 'openFaqName', {
39
+ type: Sequelize.STRING(255),
40
+ allowNull: true,
41
+ })
42
+
43
+ // Dialog Node
44
+ await queryInterface.addColumn('BotIterables', 'DialogNodeId', {
45
+ type: Sequelize.UUID,
46
+ references: {
47
+ model: 'DialogNodes',
48
+ key: 'id',
49
+ },
50
+ allowNull: true,
51
+ onDelete: 'CASCADE',
52
+ onUpdate: 'CASCADE',
53
+ })
54
+ await queryInterface.addColumn('BotIterables', 'dialogNodeName', {
55
+ type: Sequelize.STRING(255),
56
+ allowNull: true,
57
+ })
58
+
59
+ await queryInterface.addColumn('BotIterables', 'EntityId', {
60
+ type: Sequelize.UUID,
61
+ references: {
62
+ model: 'Entities',
63
+ key: 'id',
64
+ },
65
+ allowNull: true,
66
+ onDelete: 'CASCADE',
67
+ onUpdate: 'CASCADE',
68
+ })
69
+
70
+ await queryInterface.addColumn('BotIterables', 'IntentionId', {
71
+ type: Sequelize.UUID,
72
+ references: {
73
+ model: 'Intentions',
74
+ key: 'id',
75
+ },
76
+ allowNull: true,
77
+ onDelete: 'CASCADE',
78
+ onUpdate: 'CASCADE',
79
+ })
80
+
81
+ await queryInterface.addColumn('BotIterables', 'context', {
82
+ type: Sequelize.JSON,
83
+ defaultValue: [],
84
+ })
85
+
86
+ await queryInterface.addColumn('BotIterables', 'action', {
87
+ type: Sequelize.ENUM({
88
+ values: ['bot', 'client'],
89
+ }),
90
+ allowNull: false,
91
+ })
92
+
93
+ await queryInterface.addColumn('BotIterables', 'type', {
94
+ type: Sequelize.STRING(100),
95
+ allowNull: true,
96
+ })
97
+
98
+ await queryInterface.addColumn('BotIterables', 'message', {
99
+ type: Sequelize.TEXT,
100
+ allowNull: false,
101
+ validate: {
102
+ notEmpty: true,
103
+ },
104
+ })
105
+
106
+ await queryInterface.changeColumn('BotIterables', 'SessionId', {
107
+ type: Sequelize.UUID,
108
+ references: {
109
+ model: 'Sessions',
110
+ key: 'id',
111
+ },
112
+ allowNull: true,
113
+ onDelete: 'CASCADE',
114
+ onUpdate: 'CASCADE',
115
+ })
116
+
117
+ await queryInterface.addIndex('BotIterables', ['type'], {
118
+ indexName: 'botIterablesType',
119
+ })
120
+ await queryInterface.addIndex('BotIterables', ['action'], {
121
+ indexName: 'botIterablesAction',
122
+ })
123
+
124
+ await queryInterface.addIndex('BotIterables', ['responseName'], {
125
+ indexName: 'botIterablesResponseName',
126
+ })
127
+ await queryInterface.addIndex('BotIterables', ['dialogNodeName'], {
128
+ indexName: 'botIterablesDialogNodeName',
129
+ })
130
+ },
131
+
132
+ down: async (queryInterface, Sequelize) => {
133
+ await queryInterface.removeColumn('BotIterables', 'action', {})
134
+ await queryInterface.sequelize.query(
135
+ 'drop type "enum_BotIterables_action"',
136
+ {}
137
+ )
138
+ await queryInterface.removeColumn('BotIterables', 'ResponseId', {})
139
+ await queryInterface.removeColumn('BotIterables', 'responseName', {})
140
+ await queryInterface.removeColumn('BotIterables', 'OpenFaqId', {})
141
+ await queryInterface.removeColumn('BotIterables', 'openFaqName', {})
142
+ await queryInterface.removeColumn('BotIterables', 'DialogNodeId', {})
143
+ await queryInterface.removeColumn('BotIterables', 'dialogNodeName', {})
144
+ await queryInterface.removeColumn('BotIterables', 'EntityId', {})
145
+ await queryInterface.removeColumn('BotIterables', 'IntentionId', {})
146
+ await queryInterface.removeColumn('BotIterables', 'context', {})
147
+ await queryInterface.removeColumn('BotIterables', 'type', {})
148
+ await queryInterface.removeColumn('BotIterables', 'message', {})
149
+
150
+ await queryInterface.addColumn('BotIterables', 'identify', {
151
+ type: Sequelize.STRING,
152
+ allowNull: true,
153
+ validate: {
154
+ notEmpty: false,
155
+ },
156
+ })
157
+ await queryInterface.addColumn('BotIterables', 'client', {
158
+ type: Sequelize.JSON,
159
+ defaultValue: [],
160
+ })
161
+ await queryInterface.addColumn('BotIterables', 'bot', {
162
+ type: Sequelize.JSON,
163
+ defaultValue: [],
164
+ })
165
+ await queryInterface.addColumn('BotIterables', 'ChannelId', {
166
+ type: Sequelize.UUID,
167
+ references: {
168
+ model: 'Channels',
169
+ key: 'id',
170
+ },
171
+ allowNull: true,
172
+ onDelete: 'CASCADE',
173
+ onUpdate: 'CASCADE',
174
+ })
175
+ },
176
+ }
@@ -0,0 +1,15 @@
1
+ 'use strict'
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, Sequelize) => {
5
+ return queryInterface.addColumn('DialogNodes_ApiResources', 'order', {
6
+ allowNull: true,
7
+ defaultValue: 0,
8
+ type: Sequelize.INTEGER,
9
+ })
10
+ },
11
+
12
+ down: async (queryInterface, Sequelize) => {
13
+ return queryInterface.removeColumn('DialogNodes_ApiResources', 'order')
14
+ },
15
+ }
@@ -0,0 +1,15 @@
1
+ 'use strict'
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, Sequelize) => {
5
+ return queryInterface.addColumn('Response_DialogNodes', 'order', {
6
+ allowNull: true,
7
+ defaultValue: 0,
8
+ type: Sequelize.INTEGER,
9
+ })
10
+ },
11
+
12
+ down: async (queryInterface, Sequelize) => {
13
+ return queryInterface.removeColumn('Response_DialogNodes', 'order')
14
+ },
15
+ }
@@ -0,0 +1,17 @@
1
+ 'use strict'
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, Sequelize) => {
5
+ return queryInterface.changeColumn('EntityValues', 'synonyms', {
6
+ type: Sequelize.TEXT,
7
+ allowNull: true,
8
+ })
9
+ },
10
+
11
+ down: async (queryInterface, Sequelize) => {
12
+ return queryInterface.changeColumn('EntityValues', 'synonyms', {
13
+ type: Sequelize.STRING,
14
+ allowNull: true,
15
+ })
16
+ },
17
+ }
@@ -0,0 +1,25 @@
1
+ 'use strict'
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, Sequelize) => {
5
+ return queryInterface.changeColumn('Synonyms', 'name', {
6
+ type: Sequelize.TEXT,
7
+ index: true,
8
+ allowNull: false,
9
+ validate: {
10
+ notEmpty: true,
11
+ },
12
+ })
13
+ },
14
+
15
+ down: async (queryInterface, Sequelize) => {
16
+ return queryInterface.changeColumn('Synonyms', 'name', {
17
+ type: Sequelize.STRING(50),
18
+ index: true,
19
+ allowNull: false,
20
+ validate: {
21
+ notEmpty: true,
22
+ },
23
+ })
24
+ },
25
+ }
@@ -0,0 +1,14 @@
1
+ 'use strict'
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, Sequelize) => {
5
+ return queryInterface.addColumn('Attendances', 'protocol', {
6
+ allowNull: true,
7
+ type: Sequelize.STRING(255),
8
+ })
9
+ },
10
+
11
+ down: async (queryInterface, Sequelize) => {
12
+ return queryInterface.removeColumn('Attendances', 'protocol')
13
+ },
14
+ }
@@ -0,0 +1,39 @@
1
+ 'use strict'
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, Sequelize) => {
5
+ await queryInterface.changeColumn('Intentions', 'name', {
6
+ type: Sequelize.STRING(255),
7
+ })
8
+ await queryInterface.changeColumn('IntentionValues', 'name', {
9
+ type: Sequelize.STRING(255),
10
+ })
11
+ await queryInterface.changeColumn('Entities', 'name', {
12
+ type: Sequelize.STRING(255),
13
+ })
14
+ await queryInterface.changeColumn('Entities', 'values', {
15
+ type: Sequelize.TEXT,
16
+ })
17
+ await queryInterface.changeColumn('EntityValues', 'name', {
18
+ type: Sequelize.STRING(255),
19
+ })
20
+ },
21
+
22
+ down: async (queryInterface, Sequelize) => {
23
+ await queryInterface.changeColumn('Intentions', 'name', {
24
+ type: Sequelize.STRING(50),
25
+ })
26
+ await queryInterface.changeColumn('IntentionValues', 'name', {
27
+ type: Sequelize.STRING(50),
28
+ })
29
+ await queryInterface.changeColumn('Entities', 'name', {
30
+ type: Sequelize.STRING(50),
31
+ })
32
+ await queryInterface.changeColumn('Entities', 'values', {
33
+ type: Sequelize.STRING(255),
34
+ })
35
+ await queryInterface.changeColumn('EntityValues', 'name', {
36
+ type: Sequelize.STRING(50),
37
+ })
38
+ },
39
+ }
@@ -0,0 +1,71 @@
1
+ 'use strict'
2
+
3
+ const { replaceEnum } = require('../../presenters/database/migrationHelpers')
4
+
5
+ module.exports = {
6
+ up: async (queryInterface, Sequelize) => {
7
+ await queryInterface.sequelize.query(
8
+ 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp";'
9
+ )
10
+
11
+ await queryInterface.createTable('EndSessionTriggers', {
12
+ id: {
13
+ allowNull: false,
14
+ defaultValue: Sequelize.literal('uuid_generate_v4()'),
15
+ primaryKey: true,
16
+ type: Sequelize.UUID,
17
+ },
18
+ DialogNodeId: {
19
+ type: Sequelize.UUID,
20
+ allowNull: false,
21
+ references: {
22
+ model: 'DialogNodes',
23
+ key: 'id',
24
+ },
25
+ onDelete: 'RESTRICT',
26
+ onUpdate: 'CASCADE',
27
+ },
28
+ JumpToDialogNodeId: {
29
+ allowNull: true,
30
+ type: Sequelize.UUID,
31
+ references: {
32
+ model: 'DialogNodes',
33
+ key: 'id',
34
+ },
35
+ onDelete: 'SET NULL',
36
+ onUpdate: 'CASCADE',
37
+ },
38
+ createdAt: {
39
+ allowNull: false,
40
+ type: Sequelize.DATE,
41
+ },
42
+ updatedAt: {
43
+ allowNull: false,
44
+ type: Sequelize.DATE,
45
+ },
46
+ })
47
+
48
+ await replaceEnum(
49
+ queryInterface,
50
+ 'DialogNodes',
51
+ 'type',
52
+ 'node',
53
+ 'folder',
54
+ 'tranship',
55
+ 'faq',
56
+ 'end_session'
57
+ )
58
+ },
59
+ down: async (queryInterface, Sequelize) => {
60
+ await queryInterface.dropTable('EndSessionTriggers')
61
+ await replaceEnum(
62
+ queryInterface,
63
+ 'DialogNodes',
64
+ 'type',
65
+ 'node',
66
+ 'folder',
67
+ 'tranship',
68
+ 'faq'
69
+ )
70
+ },
71
+ }
@@ -0,0 +1,42 @@
1
+ 'use strict'
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, Sequelize) => {
5
+ await queryInterface.createTable('OnlineEditions', {
6
+ id: {
7
+ allowNull: false,
8
+ defaultValue: Sequelize.literal('uuid_generate_v4()'),
9
+ primaryKey: true,
10
+ type: Sequelize.UUID,
11
+ },
12
+ SystemUserId: {
13
+ type: Sequelize.UUID,
14
+ allowNull: false,
15
+ },
16
+ socketId: {
17
+ type: Sequelize.STRING,
18
+ allowNull: false,
19
+ },
20
+ payload: {
21
+ type: Sequelize.JSON,
22
+ allowNull: false,
23
+ },
24
+ moduleName: {
25
+ type: Sequelize.STRING(50),
26
+ allowNull: false,
27
+ },
28
+ createdAt: {
29
+ allowNull: false,
30
+ type: Sequelize.DATE,
31
+ },
32
+ updatedAt: {
33
+ allowNull: false,
34
+ type: Sequelize.DATE,
35
+ },
36
+ })
37
+ },
38
+
39
+ down: async (queryInterface) => {
40
+ await queryInterface.dropTable('OnlineEditions')
41
+ },
42
+ }
@@ -0,0 +1,26 @@
1
+ 'use strict'
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, Sequelize) => {
5
+ await queryInterface.addColumn('BotIterables', 'BotIterableId', {
6
+ type: Sequelize.UUID,
7
+ allowNull: true,
8
+ references: {
9
+ model: 'BotIterables',
10
+ key: 'id',
11
+ },
12
+ onDelete: 'SET NULL',
13
+ onUpdate: 'CASCADE',
14
+ })
15
+
16
+ await queryInterface.addColumn('BotIterables', 'payload', {
17
+ type: Sequelize.JSON,
18
+ allowNull: true,
19
+ })
20
+ },
21
+
22
+ down: async (queryInterface, Sequelize) => {
23
+ await queryInterface.removeColumn('BotIterables', 'BotIterableId')
24
+ await queryInterface.removeColumn('BotIterables', 'payload')
25
+ },
26
+ }
@@ -0,0 +1,101 @@
1
+ 'use strict'
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, Sequelize) => {
5
+ await queryInterface.addIndex('DialogNodes', [
6
+ 'isMultipleResponse',
7
+ 'SkillId',
8
+ 'DialogNodeFolderId',
9
+ 'step',
10
+ ])
11
+
12
+ await queryInterface.addIndex('DialogNodes_ApiResources', [
13
+ 'DialogNodeId',
14
+ 'ApiResourceId',
15
+ ])
16
+ await queryInterface.addIndex('DialogNodes_ApiResources', [
17
+ 'ApiResourceId',
18
+ 'DialogNodeId',
19
+ ])
20
+
21
+ await queryInterface.addIndex('DialogNodes_MultipleResponses', [
22
+ 'DialogNodeId',
23
+ 'ResponseId',
24
+ ])
25
+ await queryInterface.addIndex('DialogNodes_MultipleResponses', [
26
+ 'ResponseId',
27
+ 'DialogNodeId',
28
+ ])
29
+
30
+ await queryInterface.addIndex('Response_DialogNodes', [
31
+ 'DialogNodeId',
32
+ 'ResponseId',
33
+ ])
34
+ await queryInterface.addIndex('Response_DialogNodes', [
35
+ 'ResponseId',
36
+ 'DialogNodeId',
37
+ ])
38
+
39
+ await queryInterface.addIndex('EndSessionTriggers', [
40
+ 'DialogNodeId',
41
+ 'JumpToDialogNodeId',
42
+ ])
43
+ await queryInterface.addIndex('EndSessionTriggers', [
44
+ 'JumpToDialogNodeId',
45
+ 'DialogNodeId',
46
+ ])
47
+
48
+ await queryInterface.addIndex('FaqTriggers', ['DialogNodeId'])
49
+
50
+ await queryInterface.addIndex('TranshipTriggers', ['DialogNodeId'])
51
+ },
52
+
53
+ down: async (queryInterface, Sequelize) => {
54
+ await queryInterface.removeIndex('DialogNodes', [
55
+ 'isMultipleResponse',
56
+ 'SkillId',
57
+ 'DialogNodeFolderId',
58
+ 'step',
59
+ ])
60
+
61
+ await queryInterface.removeIndex('DialogNodes_ApiResources', [
62
+ 'DialogNodeId',
63
+ 'ApiResourcesId',
64
+ ])
65
+ await queryInterface.removeIndex('DialogNodes_ApiResources', [
66
+ 'ApiResourcesId',
67
+ 'DialogNodeId',
68
+ ])
69
+
70
+ await queryInterface.removeIndex('DialogNodes_MultipleResponses', [
71
+ 'DialogNodeId',
72
+ 'ResponseId',
73
+ ])
74
+ await queryInterface.removeIndex('DialogNodes_MultipleResponses', [
75
+ 'ResponseId',
76
+ 'DialogNodeId',
77
+ ])
78
+
79
+ await queryInterface.removeIndex('Response_DialogNodes', [
80
+ 'DialogNodeId',
81
+ 'ResponseId',
82
+ ])
83
+ await queryInterface.removeIndex('Response_DialogNodes', [
84
+ 'ResponseId',
85
+ 'DialogNodeId',
86
+ ])
87
+
88
+ await queryInterface.removeIndex('EndSessionTriggers', [
89
+ 'DialogNodeId',
90
+ 'JumpToDialogNodeId',
91
+ ])
92
+ await queryInterface.removeIndex('EndSessionTriggers', [
93
+ 'JumpToDialogNodeId',
94
+ 'DialogNodeId',
95
+ ])
96
+
97
+ await queryInterface.removeIndex('FaqTriggers', ['DialogNodeId'])
98
+
99
+ await queryInterface.removeIndex('TranshipTriggers', ['DialogNodeId'])
100
+ },
101
+ }
@@ -0,0 +1,60 @@
1
+ 'use strict'
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, Sequelize) => {
5
+ await queryInterface.createTable('InactivityTriggers', {
6
+ id: {
7
+ allowNull: false,
8
+ defaultValue: Sequelize.literal('uuid_generate_v4()'),
9
+ primaryKey: true,
10
+ type: Sequelize.UUID,
11
+ },
12
+ SkillId: {
13
+ allowNull: false,
14
+ type: Sequelize.UUID,
15
+ references: {
16
+ model: 'Skills',
17
+ key: 'id',
18
+ },
19
+ onDelete: 'RESTRICT',
20
+ onUpdate: 'CASCADE',
21
+ },
22
+ DialogNodeId: {
23
+ allowNull: true,
24
+ type: Sequelize.UUID,
25
+ references: {
26
+ model: 'DialogNodes',
27
+ key: 'id',
28
+ },
29
+ onDelete: 'SET NULL',
30
+ onUpdate: 'CASCADE',
31
+ },
32
+ min: {
33
+ allowNull: false,
34
+ type: Sequelize.INTEGER,
35
+ },
36
+ order: {
37
+ allowNull: false,
38
+ type: Sequelize.INTEGER,
39
+ },
40
+ createdAt: {
41
+ allowNull: false,
42
+ type: Sequelize.DATE,
43
+ },
44
+ updatedAt: {
45
+ allowNull: false,
46
+ type: Sequelize.DATE,
47
+ },
48
+ })
49
+
50
+ await queryInterface.addColumn('Sessions', 'inactivityCounter', {
51
+ type: Sequelize.INTEGER,
52
+ allowNull: true,
53
+ })
54
+ },
55
+
56
+ down: async (queryInterface, Sequelize) => {
57
+ await queryInterface.dropTable('InactivityTriggers')
58
+ await queryInterface.removeColumn('Sessions', 'inactivityCounter')
59
+ },
60
+ }