@saltcorn/builder 0.9.4-beta.2 → 0.9.4-beta.20
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/dist/builder_bundle.js +23 -11
- package/package.json +3 -1
- package/src/components/Builder.js +92 -66
- package/src/components/Library.js +46 -22
- package/src/components/RenderNode.js +5 -0
- package/src/components/Toolbox.js +173 -165
- package/src/components/elements/Action.js +12 -0
- package/src/components/elements/Aggregation.js +193 -104
- package/src/components/elements/BoxModelEditor.js +8 -8
- package/src/components/elements/Column.js +16 -2
- package/src/components/elements/Columns.js +4 -4
- package/src/components/elements/Container.js +26 -2
- package/src/components/elements/DropMenu.js +31 -2
- package/src/components/elements/Field.js +22 -20
- package/src/components/elements/HTMLCode.js +1 -1
- package/src/components/elements/JoinField.js +25 -1
- package/src/components/elements/Link.js +1 -0
- package/src/components/elements/ListColumn.js +177 -0
- package/src/components/elements/ListColumns.js +62 -0
- package/src/components/elements/RelationBadges.js +53 -44
- package/src/components/elements/Tabs.js +118 -40
- package/src/components/elements/Text.js +4 -2
- package/src/components/elements/View.js +125 -68
- package/src/components/elements/ViewLink.js +100 -48
- package/src/components/elements/utils.js +198 -98
- package/src/components/storage.js +67 -5
- package/tests/relations_finder.test.js +58 -92
- package/tests/test_data.js +0 -163
|
@@ -9,7 +9,16 @@ import {
|
|
|
9
9
|
withKeyFromLayerTwo,
|
|
10
10
|
withKeyFromLayerThree,
|
|
11
11
|
withSimplePostTopicrelation,
|
|
12
|
-
} from "
|
|
12
|
+
} from "@saltcorn/common-code/tests/test_data";
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
expectedOne,
|
|
16
|
+
expectedTwo,
|
|
17
|
+
expectedThree,
|
|
18
|
+
expectedFour,
|
|
19
|
+
expectedFive,
|
|
20
|
+
expectedSix,
|
|
21
|
+
} from "@saltcorn/common-code/tests/expected_relations";
|
|
13
22
|
import { ViewSettings } from "../src/components/elements/View";
|
|
14
23
|
import { ViewLinkSettings } from "../src/components/elements/ViewLink";
|
|
15
24
|
|
|
@@ -50,6 +59,7 @@ const doTest = (
|
|
|
50
59
|
views: views,
|
|
51
60
|
tableName: tableName,
|
|
52
61
|
roles: [],
|
|
62
|
+
inJestTestingMode: true,
|
|
53
63
|
excluded_subview_templates: excludedTemplates,
|
|
54
64
|
// relationsCtx part
|
|
55
65
|
relationsCache: relationsCache,
|
|
@@ -60,43 +70,47 @@ const doTest = (
|
|
|
60
70
|
renderer.create(<ViewSettings></ViewSettings>);
|
|
61
71
|
expect(spy).toBeCalled();
|
|
62
72
|
const vCallArgs = spy.mock.calls[0];
|
|
63
|
-
expect(vCallArgs[0].
|
|
64
|
-
expect(vCallArgs[0].
|
|
65
|
-
expect(vCallArgs[0].
|
|
73
|
+
expect(vCallArgs[0].relations).toBeDefined();
|
|
74
|
+
expect(vCallArgs[0].relations).toHaveLength(expected.length);
|
|
75
|
+
expect(vCallArgs[0].relations.map((rel) => rel.relationString)).toEqual(
|
|
76
|
+
expect.arrayContaining(expected)
|
|
77
|
+
);
|
|
66
78
|
|
|
67
79
|
renderer.create(<ViewLinkSettings></ViewLinkSettings>);
|
|
68
80
|
expect(spy.mock.calls).toHaveLength(4);
|
|
69
81
|
const vLinkcallArgs = spy.mock.calls[2];
|
|
70
|
-
expect(vLinkcallArgs[0].
|
|
71
|
-
expect(vLinkcallArgs[0].
|
|
72
|
-
expect(vLinkcallArgs[0].
|
|
82
|
+
expect(vLinkcallArgs[0].relations).toBeDefined();
|
|
83
|
+
expect(vLinkcallArgs[0].relations).toHaveLength(expected.length);
|
|
84
|
+
expect(vLinkcallArgs[0].relations.map((rel) => rel.relationString)).toEqual(
|
|
85
|
+
expect.arrayContaining(expected)
|
|
86
|
+
);
|
|
73
87
|
};
|
|
74
88
|
|
|
75
89
|
describe("relations tests", () => {
|
|
76
|
-
beforeAll(() => {
|
|
77
|
-
// inject relationHelpers (normally it's a script tag)
|
|
78
|
-
global.relationHelpers = {
|
|
79
|
-
...require("../../server/public/relation_helpers.js"),
|
|
80
|
-
};
|
|
81
|
-
});
|
|
82
90
|
beforeEach(() => {
|
|
83
91
|
jest.restoreAllMocks();
|
|
84
92
|
});
|
|
85
93
|
describe("single relations", () => {
|
|
86
|
-
it("parent relations",
|
|
87
|
-
const { tables, views } = fixturesData();
|
|
94
|
+
it("parent relations", () => {
|
|
95
|
+
const { tables, views } = fixturesData(__dirname);
|
|
88
96
|
const expected = [".fan_club.artist"];
|
|
89
97
|
doTest(tables, views, "fan_club", "show_artist", expected);
|
|
90
98
|
});
|
|
91
99
|
|
|
92
|
-
it("
|
|
93
|
-
const { tables, views } = fixturesData();
|
|
100
|
+
it("parent relations with layers", () => {
|
|
101
|
+
const { tables, views } = fixturesData(__dirname);
|
|
102
|
+
const expected = [".patients.favbook.publisher"];
|
|
103
|
+
doTest(tables, views, "patients", "show_publisher", expected);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("one to one relations", () => {
|
|
107
|
+
const { tables, views } = fixturesData(__dirname);
|
|
94
108
|
const expected = [".covers.albums$cover"];
|
|
95
109
|
doTest(tables, views, "covers", "show_album", expected);
|
|
96
110
|
});
|
|
97
111
|
|
|
98
|
-
it("employee department relation",
|
|
99
|
-
const { tables, views } = fixturesData();
|
|
112
|
+
it("employee department relation", () => {
|
|
113
|
+
const { tables, views } = fixturesData(__dirname);
|
|
100
114
|
const expected = [".employee", ".employee.department.manager"];
|
|
101
115
|
doTest(tables, views, "employee", "show_manager", expected);
|
|
102
116
|
});
|
|
@@ -104,85 +118,37 @@ describe("relations tests", () => {
|
|
|
104
118
|
|
|
105
119
|
describe("multi relations", () => {
|
|
106
120
|
describe("inbound relations", () => {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
".users.user_interested_in_topic$user.topic.blog_in_topic$topic",
|
|
110
|
-
".users.user_interested_in_topic$user.topic.inbound_inbound$topic.bp_inbound.post.blog_in_topic$post",
|
|
111
|
-
".users.messages$user.room.participants$room.user.user_interested_in_topic$user.topic.blog_in_topic$topic",
|
|
112
|
-
];
|
|
113
|
-
it("single keys to source and rel table", async () => {
|
|
114
|
-
const { tables, views } = fixturesData();
|
|
121
|
+
it("single keys to source and rel table", () => {
|
|
122
|
+
const { tables, views } = fixturesData(__dirname);
|
|
115
123
|
doTest(tables, views, "users", "blog_in_topic_feed", expectedOne);
|
|
116
124
|
});
|
|
117
125
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
".users.user_interested_in_topic$another_user.topic.blog_in_topic$topic",
|
|
121
|
-
".users.user_interested_in_topic$another_user.topic.inbound_inbound$topic.bp_inbound.post.blog_in_topic$post",
|
|
122
|
-
".users.messages$user.room.participants$room.user.user_interested_in_topic$another_user.topic.blog_in_topic$topic",
|
|
123
|
-
];
|
|
124
|
-
it("multiple keys to source and single key to rel table", async () => {
|
|
125
|
-
const { tables, views } = withAnotherUserField();
|
|
126
|
+
it("multiple keys to source and single key to rel table", () => {
|
|
127
|
+
const { tables, views } = withAnotherUserField(__dirname);
|
|
126
128
|
doTest(tables, views, "users", "blog_in_topic_feed", expectedTwo);
|
|
127
129
|
});
|
|
128
130
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
".users.user_interested_in_topic$user.topic.blog_in_topic$second_topic",
|
|
132
|
-
".users.user_interested_in_topic$another_user.topic.blog_in_topic$second_topic",
|
|
133
|
-
".users.messages$user.room.participants$room.user.user_interested_in_topic$user.topic.blog_in_topic$second_topic",
|
|
134
|
-
".users.messages$user.room.participants$room.user.user_interested_in_topic$another_user.topic.blog_in_topic$second_topic",
|
|
135
|
-
];
|
|
136
|
-
it("multiple keys to source and rel table", async () => {
|
|
137
|
-
const { tables, views } = withSecondTopicField();
|
|
131
|
+
it("multiple keys to source and rel table", () => {
|
|
132
|
+
const { tables, views } = withSecondTopicField(__dirname);
|
|
138
133
|
doTest(tables, views, "users", "blog_in_topic_feed", expectedThree);
|
|
139
134
|
});
|
|
140
135
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
".users.user_interested_in_topic$user.another_user.second_inbound$user.topic.blog_in_topic$topic",
|
|
144
|
-
".users.user_interested_in_topic$user.another_user.second_inbound$user.topic.blog_in_topic$second_topic",
|
|
145
|
-
".users.second_inbound$user.topic.blog_in_topic$topic",
|
|
146
|
-
".users.second_inbound$user.topic.blog_in_topic$second_topic",
|
|
147
|
-
".users.second_inbound$user.topic.inbound_inbound$topic.bp_inbound.post.blog_in_topic$post",
|
|
148
|
-
".users.messages$user.room.participants$room.user.second_inbound$user.topic.blog_in_topic$topic",
|
|
149
|
-
".users.messages$user.room.participants$room.user.second_inbound$user.topic.blog_in_topic$second_topic",
|
|
150
|
-
];
|
|
151
|
-
it("multiple inbound tables", async () => {
|
|
152
|
-
const { tables, views } = withMultipleInbounds();
|
|
136
|
+
it("multiple inbound tables", () => {
|
|
137
|
+
const { tables, views } = withMultipleInbounds(__dirname);
|
|
153
138
|
doTest(tables, views, "users", "blog_in_topic_feed", expectedFour);
|
|
154
139
|
});
|
|
155
140
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
".users.user_interested_in_topic$user.topic.inbound_inbound$topic.post_from_layer_two.blog_in_topic$post",
|
|
159
|
-
".users.user_interested_in_topic$another_user.topic.inbound_inbound$topic.post_from_layer_two.blog_in_topic$post",
|
|
160
|
-
".users.second_inbound$user.topic.inbound_inbound$topic.post_from_layer_two.blog_in_topic$post",
|
|
161
|
-
".users.user_interested_in_topic$user.topic.blog_in_topic$topic.post.inbound_inbound$post_from_layer_two.topic.blog_in_topic$second_topic",
|
|
162
|
-
".users.user_interested_in_topic$user.another_user.second_inbound$user.topic.inbound_inbound$topic.post_from_layer_two.blog_in_topic$post",
|
|
163
|
-
".users.user_interested_in_topic$another_user.topic.blog_in_topic$topic.post.inbound_inbound$post_from_layer_two.topic.blog_in_topic$second_topic",
|
|
164
|
-
".users.second_inbound$user.topic.blog_in_topic$topic.post.inbound_inbound$post_from_layer_two.topic.blog_in_topic$second_topic",
|
|
165
|
-
];
|
|
166
|
-
it("key to source from layer two", async () => {
|
|
167
|
-
const { tables, views } = withKeyFromLayerTwo();
|
|
141
|
+
it("key to source from layer two", () => {
|
|
142
|
+
const { tables, views } = withKeyFromLayerTwo(__dirname);
|
|
168
143
|
doTest(tables, views, "users", "blog_in_topic_feed", expectedFive);
|
|
169
144
|
});
|
|
170
145
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
".users.user_interested_in_topic$user.topic.inbound_level_three$topic.inbound_level_two.bp_inbound.post.blog_in_topic$post",
|
|
174
|
-
".users.user_interested_in_topic$user.topic.inbound_level_three$topic.inbound_level_two.post_from_layer_two.blog_in_topic$post",
|
|
175
|
-
".users.user_interested_in_topic$another_user.topic.inbound_level_three$topic.inbound_level_two.bp_inbound.post.blog_in_topic$post",
|
|
176
|
-
".users.user_interested_in_topic$another_user.topic.inbound_level_three$topic.inbound_level_two.post_from_layer_two.blog_in_topic$post",
|
|
177
|
-
".users.second_inbound$user.topic.inbound_level_three$topic.inbound_level_two.bp_inbound.post.blog_in_topic$post",
|
|
178
|
-
".users.second_inbound$user.topic.inbound_level_three$topic.inbound_level_two.post_from_layer_two.blog_in_topic$post",
|
|
179
|
-
];
|
|
180
|
-
it("three levels inbound", async () => {
|
|
181
|
-
const { tables, views } = withKeyFromLayerThree();
|
|
146
|
+
it("three levels inbound", () => {
|
|
147
|
+
const { tables, views } = withKeyFromLayerThree(__dirname);
|
|
182
148
|
doTest(tables, views, "users", "blog_in_topic_feed", expectedSix);
|
|
183
149
|
});
|
|
184
150
|
|
|
185
|
-
it("simple post topic relation",
|
|
151
|
+
it("simple post topic relation", () => {
|
|
186
152
|
const expected = [
|
|
187
153
|
".",
|
|
188
154
|
".users.favsimpletopic.simple_posts$topic",
|
|
@@ -190,20 +156,20 @@ describe("relations tests", () => {
|
|
|
190
156
|
".users.messages$user.room.participants$room.user.favsimpletopic.simple_posts$topic",
|
|
191
157
|
".users.messages$user.room.participants$room.user.favsimpletopic.simple_post_inbound$topic.post",
|
|
192
158
|
];
|
|
193
|
-
const { tables, views } = withSimplePostTopicrelation();
|
|
159
|
+
const { tables, views } = withSimplePostTopicrelation(__dirname);
|
|
194
160
|
doTest(tables, views, "users", "simple_posts_list", expected);
|
|
195
161
|
});
|
|
196
162
|
});
|
|
197
163
|
|
|
198
164
|
describe("many to many relations", () => {
|
|
199
|
-
it("artist_plays_on_album",
|
|
200
|
-
const { tables, views } = fixturesData();
|
|
165
|
+
it("artist_plays_on_album", () => {
|
|
166
|
+
const { tables, views } = fixturesData(__dirname);
|
|
201
167
|
const expected = [".", ".artists.artist_plays_on_album$artist.album"];
|
|
202
168
|
doTest(tables, views, "artists", "albums_feed", expected);
|
|
203
169
|
});
|
|
204
170
|
|
|
205
|
-
it("tracks on album",
|
|
206
|
-
const { tables, views } = fixturesData();
|
|
171
|
+
it("tracks on album", () => {
|
|
172
|
+
const { tables, views } = fixturesData(__dirname);
|
|
207
173
|
const expected = [
|
|
208
174
|
".",
|
|
209
175
|
".artists.artist_plays_on_album$artist.album.tracks_on_album$album",
|
|
@@ -211,8 +177,8 @@ describe("relations tests", () => {
|
|
|
211
177
|
doTest(tables, views, "artists", "tracks_on_album_feed", expected);
|
|
212
178
|
});
|
|
213
179
|
|
|
214
|
-
it("show pressing_job with embedded fan club feed",
|
|
215
|
-
const { tables, views } = fixturesData();
|
|
180
|
+
it("show pressing_job with embedded fan club feed", () => {
|
|
181
|
+
const { tables, views } = fixturesData(__dirname);
|
|
216
182
|
const expected = [
|
|
217
183
|
".",
|
|
218
184
|
".pressing_job.album.artist_plays_on_album$album.artist.fan_club$artist",
|
|
@@ -222,8 +188,8 @@ describe("relations tests", () => {
|
|
|
222
188
|
});
|
|
223
189
|
|
|
224
190
|
describe("excluded viewtemplates", () => {
|
|
225
|
-
it("excluded viewtemplates",
|
|
226
|
-
const { tables, views } = fixturesData();
|
|
191
|
+
it("excluded viewtemplates", () => {
|
|
192
|
+
const { tables, views } = fixturesData(__dirname);
|
|
227
193
|
const expected = [];
|
|
228
194
|
const excluded = ["Room"];
|
|
229
195
|
doTest(tables, views, "participants", "rooms_view", expected, excluded);
|
|
@@ -232,7 +198,7 @@ describe("relations tests", () => {
|
|
|
232
198
|
|
|
233
199
|
describe("open legacy relations", () => {
|
|
234
200
|
it("ChildList", async () => {
|
|
235
|
-
const { tables, views } = fixturesData();
|
|
201
|
+
const { tables, views } = fixturesData(__dirname);
|
|
236
202
|
const expected = [".", ".books.discusses_books$book"];
|
|
237
203
|
doTest(
|
|
238
204
|
tables,
|
|
@@ -247,7 +213,7 @@ describe("relations tests", () => {
|
|
|
247
213
|
});
|
|
248
214
|
|
|
249
215
|
it("Independent", async () => {
|
|
250
|
-
const { tables, views } = fixturesData();
|
|
216
|
+
const { tables, views } = fixturesData(__dirname);
|
|
251
217
|
const expected = [
|
|
252
218
|
".",
|
|
253
219
|
".blog_posts",
|
|
@@ -266,7 +232,7 @@ describe("relations tests", () => {
|
|
|
266
232
|
});
|
|
267
233
|
|
|
268
234
|
it("Own", async () => {
|
|
269
|
-
const { tables, views } = fixturesData();
|
|
235
|
+
const { tables, views } = fixturesData(__dirname);
|
|
270
236
|
const expected = [".books"];
|
|
271
237
|
doTest(
|
|
272
238
|
tables,
|
package/tests/test_data.js
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "fs";
|
|
2
|
-
import { join } from "path";
|
|
3
|
-
|
|
4
|
-
export const fixturesData = () => {
|
|
5
|
-
const { tables, views } = JSON.parse(
|
|
6
|
-
readFileSync(join(__dirname, "schema_data.json"))
|
|
7
|
-
);
|
|
8
|
-
return { tables, views };
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
let nextFieldId = 3000;
|
|
12
|
-
|
|
13
|
-
export const withAnotherUserField = () => {
|
|
14
|
-
const { tables, views } = JSON.parse(JSON.stringify(fixturesData()));
|
|
15
|
-
const uiit = tables.find(({ name }) => name === "user_interested_in_topic");
|
|
16
|
-
uiit.foreign_keys.push({
|
|
17
|
-
name: "another_user",
|
|
18
|
-
id: nextFieldId++,
|
|
19
|
-
table_id: uiit.id,
|
|
20
|
-
reftable_name: "users",
|
|
21
|
-
is_unique: false,
|
|
22
|
-
});
|
|
23
|
-
return { tables, views };
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const withSecondTopicField = () => {
|
|
27
|
-
const { tables, views } = JSON.parse(JSON.stringify(withAnotherUserField()));
|
|
28
|
-
const bit = tables.find(({ name }) => name === "blog_in_topic");
|
|
29
|
-
bit.foreign_keys.push({
|
|
30
|
-
name: "second_topic",
|
|
31
|
-
id: nextFieldId++,
|
|
32
|
-
table_id: bit.id,
|
|
33
|
-
reftable_name: "topics",
|
|
34
|
-
is_unique: false,
|
|
35
|
-
});
|
|
36
|
-
return { tables, views };
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const withMultipleInbounds = () => {
|
|
40
|
-
const { tables, views } = JSON.parse(JSON.stringify(withSecondTopicField()));
|
|
41
|
-
const nextTableId = tables.length + 1;
|
|
42
|
-
tables.push({
|
|
43
|
-
name: "second_inbound",
|
|
44
|
-
id: nextTableId,
|
|
45
|
-
foreign_keys: [
|
|
46
|
-
{
|
|
47
|
-
name: "topic",
|
|
48
|
-
id: nextFieldId++,
|
|
49
|
-
table_id: nextTableId,
|
|
50
|
-
reftable_name: "topics",
|
|
51
|
-
is_unique: false,
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
name: "user",
|
|
55
|
-
id: nextFieldId++,
|
|
56
|
-
table_id: nextTableId,
|
|
57
|
-
reftable_name: "users",
|
|
58
|
-
is_unique: false,
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
});
|
|
62
|
-
return { tables, views };
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export const withKeyFromLayerTwo = () => {
|
|
66
|
-
const { tables, views } = JSON.parse(JSON.stringify(withMultipleInbounds()));
|
|
67
|
-
const inboundInbound = tables.find(({ name }) => name === "inbound_inbound");
|
|
68
|
-
inboundInbound.foreign_keys.push({
|
|
69
|
-
name: "post_from_layer_two",
|
|
70
|
-
id: nextFieldId++,
|
|
71
|
-
table_id: inboundInbound.id,
|
|
72
|
-
reftable_name: "blog_posts",
|
|
73
|
-
is_unique: false,
|
|
74
|
-
});
|
|
75
|
-
return { tables, views };
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export const withKeyFromLayerThree = () => {
|
|
79
|
-
const { tables, views } = JSON.parse(JSON.stringify(withKeyFromLayerTwo()));
|
|
80
|
-
const nextTableId = tables.length + 1;
|
|
81
|
-
tables.push({
|
|
82
|
-
name: "inbound_level_three",
|
|
83
|
-
id: nextTableId,
|
|
84
|
-
foreign_keys: [
|
|
85
|
-
{
|
|
86
|
-
name: "inbound_level_two",
|
|
87
|
-
id: nextFieldId++,
|
|
88
|
-
table_id: nextTableId,
|
|
89
|
-
reftable_name: "inbound_inbound",
|
|
90
|
-
is_unique: false,
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: "topic",
|
|
94
|
-
id: nextFieldId++,
|
|
95
|
-
table_id: nextTableId,
|
|
96
|
-
reftable_name: "topics",
|
|
97
|
-
is_unique: false,
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
});
|
|
101
|
-
return { tables, views };
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
export const withSimplePostTopicrelation = () => {
|
|
105
|
-
const { tables, views } = JSON.parse(JSON.stringify(fixturesData()));
|
|
106
|
-
const simpleTopicsId = tables.length + 1;
|
|
107
|
-
const simplePostsId = simpleTopicsId + 1;
|
|
108
|
-
const simplePostInboundId = simplePostsId + 1;
|
|
109
|
-
tables.push({
|
|
110
|
-
name: "simple_posts",
|
|
111
|
-
id: simplePostsId,
|
|
112
|
-
foreign_keys: [
|
|
113
|
-
{
|
|
114
|
-
name: "topic",
|
|
115
|
-
table_id: simplePostsId,
|
|
116
|
-
id: nextFieldId++,
|
|
117
|
-
reftable_name: "simple_topics",
|
|
118
|
-
is_unique: false,
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
});
|
|
122
|
-
tables.push({
|
|
123
|
-
name: "simple_topics",
|
|
124
|
-
id: simpleTopicsId,
|
|
125
|
-
foreign_keys: [],
|
|
126
|
-
});
|
|
127
|
-
tables.push({
|
|
128
|
-
name: "simple_post_inbound",
|
|
129
|
-
id: simplePostInboundId,
|
|
130
|
-
foreign_keys: [
|
|
131
|
-
{
|
|
132
|
-
name: "post",
|
|
133
|
-
table_id: simplePostInboundId,
|
|
134
|
-
id: nextFieldId++,
|
|
135
|
-
reftable_name: "simple_posts",
|
|
136
|
-
is_unique: false,
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
name: "topic",
|
|
140
|
-
table_id: simplePostInboundId,
|
|
141
|
-
id: nextFieldId++,
|
|
142
|
-
reftable_name: "simple_topics",
|
|
143
|
-
is_unique: false,
|
|
144
|
-
},
|
|
145
|
-
],
|
|
146
|
-
});
|
|
147
|
-
const users = tables.find(({ name }) => name === "users");
|
|
148
|
-
users.foreign_keys.push({
|
|
149
|
-
name: "favsimpletopic",
|
|
150
|
-
table_id: users.id,
|
|
151
|
-
id: nextFieldId++,
|
|
152
|
-
reftable_name: "simple_topics",
|
|
153
|
-
is_unique: false,
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
views.push({
|
|
157
|
-
name: "simple_posts_list",
|
|
158
|
-
table_id: simplePostsId,
|
|
159
|
-
display_type: "NO_ROW_LIMIT",
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
return { tables, views };
|
|
163
|
-
};
|