@itleanchatbot/shared-models-js-postgres 3.1.10 → 3.1.11
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.
package/package.json
CHANGED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface) => {
|
|
5
|
+
await queryInterface.sequelize.transaction(async (transaction) => {
|
|
6
|
+
await queryInterface.sequelize.query(
|
|
7
|
+
`
|
|
8
|
+
CREATE TABLE IF NOT EXISTS public."DialogNodeVisualLayouts" (
|
|
9
|
+
"id" uuid NOT NULL,
|
|
10
|
+
"EnterpriseId" uuid NOT NULL,
|
|
11
|
+
"SkillId" uuid NOT NULL,
|
|
12
|
+
"DialogNodeId" uuid NULL,
|
|
13
|
+
"visualNodeId" varchar(255) NOT NULL,
|
|
14
|
+
"view" varchar(32) NOT NULL DEFAULT 'macro',
|
|
15
|
+
"x" numeric(12, 2) NOT NULL DEFAULT 0,
|
|
16
|
+
"y" numeric(12, 2) NOT NULL DEFAULT 0,
|
|
17
|
+
"width" numeric(12, 2) NOT NULL DEFAULT 260,
|
|
18
|
+
"height" numeric(12, 2) NOT NULL DEFAULT 96,
|
|
19
|
+
"collapsed" boolean NOT NULL DEFAULT false,
|
|
20
|
+
"metadata" jsonb NOT NULL DEFAULT '{}'::jsonb,
|
|
21
|
+
"createdAt" timestamp with time zone NOT NULL DEFAULT NOW(),
|
|
22
|
+
"updatedAt" timestamp with time zone NOT NULL DEFAULT NOW(),
|
|
23
|
+
CONSTRAINT "DialogNodeVisualLayouts_pkey" PRIMARY KEY ("id")
|
|
24
|
+
);
|
|
25
|
+
`,
|
|
26
|
+
{ transaction }
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
await queryInterface.sequelize.query(
|
|
30
|
+
`
|
|
31
|
+
DO $$
|
|
32
|
+
BEGIN
|
|
33
|
+
IF NOT EXISTS (
|
|
34
|
+
SELECT 1
|
|
35
|
+
FROM pg_constraint
|
|
36
|
+
WHERE conname = 'DialogNodeVisualLayouts_unique_node_view'
|
|
37
|
+
) THEN
|
|
38
|
+
ALTER TABLE public."DialogNodeVisualLayouts"
|
|
39
|
+
ADD CONSTRAINT "DialogNodeVisualLayouts_unique_node_view"
|
|
40
|
+
UNIQUE ("EnterpriseId", "SkillId", "visualNodeId", "view");
|
|
41
|
+
END IF;
|
|
42
|
+
END $$;
|
|
43
|
+
`,
|
|
44
|
+
{ transaction }
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
await queryInterface.sequelize.query(
|
|
48
|
+
`
|
|
49
|
+
CREATE INDEX IF NOT EXISTS "DialogNodeVisualLayouts_skill_view_idx"
|
|
50
|
+
ON public."DialogNodeVisualLayouts" ("EnterpriseId", "SkillId", "view");
|
|
51
|
+
`,
|
|
52
|
+
{ transaction }
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
await queryInterface.sequelize.query(
|
|
56
|
+
`
|
|
57
|
+
CREATE INDEX IF NOT EXISTS "DialogNodeVisualLayouts_dialog_node_idx"
|
|
58
|
+
ON public."DialogNodeVisualLayouts" ("DialogNodeId");
|
|
59
|
+
`,
|
|
60
|
+
{ transaction }
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
down: async (queryInterface) => {
|
|
66
|
+
await queryInterface.sequelize.transaction(async (transaction) => {
|
|
67
|
+
await queryInterface.sequelize.query(
|
|
68
|
+
'DROP TABLE IF EXISTS public."DialogNodeVisualLayouts";',
|
|
69
|
+
{ transaction }
|
|
70
|
+
);
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
};
|