Skip to content

Commit e190684

Browse files
committed
tests for #636
1 parent 2d6024f commit e190684

9 files changed

+62
-27
lines changed

tests/fixtures/blog_mysql.sql

+6-4
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,16 @@ CREATE TABLE `kunsthåndværk` (
167167
`Umlauts ä_ö_ü-COUNT` int(11) NOT NULL,
168168
`user_id` int(11) NOT NULL,
169169
`invisible` varchar(36),
170+
`invisible_id` varchar(36),
170171
PRIMARY KEY (`id`),
171172
CONSTRAINT `kunsthåndværk_Umlauts ä_ö_ü-COUNT_fkey` UNIQUE (`Umlauts ä_ö_ü-COUNT`),
172-
CONSTRAINT `kunsthåndværk_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
173+
CONSTRAINT `kunsthåndværk_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
174+
CONSTRAINT `kunsthåndværk_invisible_id_fkey` FOREIGN KEY (`invisible_id`) REFERENCES `invisibles` (`id`)
173175
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
174176

175-
INSERT INTO `kunsthåndværk` (`id`, `Umlauts ä_ö_ü-COUNT`, `user_id`, `invisible`) VALUES
176-
('e42c77c6-06a4-4502-816c-d112c7142e6d', 1, 1, NULL),
177-
('e31ecfe6-591f-4660-9fbd-1a232083037f', 2, 2, NULL);
177+
INSERT INTO `kunsthåndværk` (`id`, `Umlauts ä_ö_ü-COUNT`, `user_id`, `invisible`, `invisible_id`) VALUES
178+
('e42c77c6-06a4-4502-816c-d112c7142e6d', 1, 1, NULL, 'e42c77c6-06a4-4502-816c-d112c7142e6d'),
179+
('e31ecfe6-591f-4660-9fbd-1a232083037f', 2, 2, NULL, 'e42c77c6-06a4-4502-816c-d112c7142e6d');
178180

179181
DROP TABLE IF EXISTS `invisibles`;
180182
CREATE TABLE `invisibles` (

tests/fixtures/blog_pgsql.sql

+20-4
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ CREATE TABLE "kunsthåndværk" (
162162
id character varying(36) NOT NULL,
163163
"Umlauts ä_ö_ü-COUNT" integer NOT NULL,
164164
user_id integer NOT NULL,
165-
invisible character varying(36)
165+
invisible character varying(36),
166+
invisible_id character varying(36)
166167
);
167168

168169
--
@@ -276,9 +277,9 @@ INSERT INTO "barcodes" ("product_id", "hex", "bin", "ip_address") VALUES
276277
-- Data for Name: kunsthåndværk; Type: TABLE DATA; Schema: public; Owner: postgres
277278
--
278279

279-
INSERT INTO "kunsthåndværk" ("id", "Umlauts ä_ö_ü-COUNT", "user_id", "invisible") VALUES
280-
('e42c77c6-06a4-4502-816c-d112c7142e6d', 1, 1, NULL),
281-
('e31ecfe6-591f-4660-9fbd-1a232083037f', 2, 2, NULL);
280+
INSERT INTO "kunsthåndværk" ("id", "Umlauts ä_ö_ü-COUNT", "user_id", "invisible", "invisible_id") VALUES
281+
('e42c77c6-06a4-4502-816c-d112c7142e6d', 1, 1, NULL, 'e42c77c6-06a4-4502-816c-d112c7142e6d'),
282+
('e31ecfe6-591f-4660-9fbd-1a232083037f', 2, 2, NULL, 'e42c77c6-06a4-4502-816c-d112c7142e6d');
282283

283284
--
284285
-- Data for Name: invisibles; Type: TABLE DATA; Schema: public; Owner: postgres
@@ -456,6 +457,13 @@ CREATE INDEX "kunsthåndværk_Umlauts ä_ö_ü-COUNT_idx" ON "kunsthåndværk" U
456457
CREATE INDEX "kunsthåndværk_user_id_idx" ON "kunsthåndværk" USING btree (user_id);
457458

458459

460+
--
461+
-- Name: kunsthåndværk_invisible_id_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
462+
--
463+
464+
CREATE INDEX "kunsthåndværk_invisible_id_idx" ON "kunsthåndværk" USING btree (invisible_id);
465+
466+
459467
--
460468
-- Name: comments_post_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
461469
--
@@ -519,6 +527,7 @@ ALTER TABLE ONLY barcodes
519527
ALTER TABLE ONLY "kunsthåndværk"
520528
ADD CONSTRAINT "kunsthåndværk_Umlauts ä_ö_ü-COUNT_uc" UNIQUE ("Umlauts ä_ö_ü-COUNT");
521529

530+
522531
--
523532
-- Name: kunsthåndværk_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
524533
--
@@ -527,6 +536,13 @@ ALTER TABLE ONLY "kunsthåndværk"
527536
ADD CONSTRAINT "kunsthåndværk_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id);
528537

529538

539+
--
540+
-- Name: kunsthåndværk_invisible_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
541+
--
542+
543+
ALTER TABLE ONLY "kunsthåndværk"
544+
ADD CONSTRAINT "kunsthåndværk_invisible_id_fkey" FOREIGN KEY (invisible_id) REFERENCES invisibles(id);
545+
530546
--
531547
-- PostgreSQL database dump complete
532548
--

tests/fixtures/blog_sqlite.sql

+5-3
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,13 @@ CREATE TABLE "kunsthåndværk" (
148148
"Umlauts ä_ö_ü-COUNT" integer NOT NULL UNIQUE,
149149
"user_id" integer NOT NULL,
150150
"invisible" varchar(36),
151-
FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT
151+
"invisible_id" varchar(36),
152+
FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT,
153+
FOREIGN KEY ("invisible_id") REFERENCES "invisibles" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT
152154
);
153155

154-
INSERT INTO "kunsthåndværk" ("id", "Umlauts ä_ö_ü-COUNT", "user_id", "invisible") VALUES ('e42c77c6-06a4-4502-816c-d112c7142e6d', 1, 1, NULL);
155-
INSERT INTO "kunsthåndværk" ("id", "Umlauts ä_ö_ü-COUNT", "user_id", "invisible") VALUES ('e31ecfe6-591f-4660-9fbd-1a232083037f', 2, 2, NULL);
156+
INSERT INTO "kunsthåndværk" ("id", "Umlauts ä_ö_ü-COUNT", "user_id", "invisible", "invisible_id") VALUES ('e42c77c6-06a4-4502-816c-d112c7142e6d', 1, 1, NULL, 'e42c77c6-06a4-4502-816c-d112c7142e6d');
157+
INSERT INTO "kunsthåndværk" ("id", "Umlauts ä_ö_ü-COUNT", "user_id", "invisible", "invisible_id") VALUES ('e31ecfe6-591f-4660-9fbd-1a232083037f', 2, 2, NULL, 'e42c77c6-06a4-4502-816c-d112c7142e6d');
156158

157159
DROP TABLE IF EXISTS "invisibles";
158160
CREATE TABLE "invisibles" (

tests/fixtures/blog_sqlsrv.sql

+9-2
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ CREATE TABLE [kunsthåndværk](
285285
[Umlauts ä_ö_ü-COUNT] [int] NOT NULL,
286286
[user_id] [int] NOT NULL,
287287
[invisible] [nvarchar](36),
288+
[invisible_id] [nvarchar](36),
288289
CONSTRAINT [kunsthåndværk_pkey] PRIMARY KEY CLUSTERED([id] ASC)
289290
)
290291
GO
@@ -372,9 +373,9 @@ GO
372373
INSERT [barcodes] ([product_id], [hex], [bin], [ip_address]) VALUES (1, N'00ff01', 0x00ff01, N'127.0.0.1')
373374
GO
374375

375-
INSERT [kunsthåndværk] ([id], [Umlauts ä_ö_ü-COUNT], [user_id], [invisible]) VALUES ('e42c77c6-06a4-4502-816c-d112c7142e6d', 1, 1, NULL)
376+
INSERT [kunsthåndværk] ([id], [Umlauts ä_ö_ü-COUNT], [user_id], [invisible], [invisible_id]) VALUES ('e42c77c6-06a4-4502-816c-d112c7142e6d', 1, 1, NULL, 'e42c77c6-06a4-4502-816c-d112c7142e6d')
376377
GO
377-
INSERT [kunsthåndværk] ([id], [Umlauts ä_ö_ü-COUNT], [user_id], [invisible]) VALUES ('e31ecfe6-591f-4660-9fbd-1a232083037f', 2, 2, NULL)
378+
INSERT [kunsthåndværk] ([id], [Umlauts ä_ö_ü-COUNT], [user_id], [invisible], [invisible_id]) VALUES ('e31ecfe6-591f-4660-9fbd-1a232083037f', 2, 2, NULL, 'e42c77c6-06a4-4502-816c-d112c7142e6d')
378379
GO
379380

380381
INSERT [invisibles] ([id]) VALUES ('e42c77c6-06a4-4502-816c-d112c7142e6d')
@@ -433,3 +434,9 @@ REFERENCES [users] ([id])
433434
GO
434435
ALTER TABLE [kunsthåndværk] CHECK CONSTRAINT [kunsthåndværk_user_id_fkey]
435436
GO
437+
438+
ALTER TABLE [kunsthåndværk] WITH CHECK ADD CONSTRAINT [kunsthåndværk_invisible_id_fkey] FOREIGN KEY([invisible_id])
439+
REFERENCES [invisibles] ([id])
440+
GO
441+
ALTER TABLE [kunsthåndværk] CHECK CONSTRAINT [kunsthåndværk_invisible_id_fkey]
442+
GO

tests/functional/001_records/062_read_kunsthandvaerk.log

+10-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ GET /records/kunsthåndværk/e42c77c6-06a4-4502-816c-d112c7142e6d
22
===
33
200
44
Content-Type: application/json
5-
Content-Length: 84
5+
Content-Length: 138
66

7-
{"id":"e42c77c6-06a4-4502-816c-d112c7142e6d","Umlauts ä_ö_ü-COUNT":1,"user_id":1}
7+
{"id":"e42c77c6-06a4-4502-816c-d112c7142e6d","Umlauts ä_ö_ü-COUNT":1,"user_id":1,"invisible_id":"e42c77c6-06a4-4502-816c-d112c7142e6d"}
8+
===
9+
GET /records/kunsthåndværk/e42c77c6-06a4-4502-816c-d112c7142e6d?join=invisibles
10+
===
11+
200
12+
Content-Type: application/json
13+
Content-Length: 138
14+
15+
{"id":"e42c77c6-06a4-4502-816c-d112c7142e6d","Umlauts ä_ö_ü-COUNT":1,"user_id":1,"invisible_id":"e42c77c6-06a4-4502-816c-d112c7142e6d"}

tests/functional/001_records/063_list_kunsthandvaerk.log

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ GET /records/kunsthåndværk
22
===
33
200
44
Content-Type: application/json
5-
Content-Length: 98
5+
Content-Length: 152
66

7-
{"records":[{"id":"e42c77c6-06a4-4502-816c-d112c7142e6d","Umlauts ä_ö_ü-COUNT":1,"user_id":1}]}
7+
{"records":[{"id":"e42c77c6-06a4-4502-816c-d112c7142e6d","Umlauts ä_ö_ü-COUNT":1,"user_id":1,"invisible_id":"e42c77c6-06a4-4502-816c-d112c7142e6d"}]}

tests/functional/001_records/073_multi_tenancy_kunsthandvaerk.log

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ GET /records/kunsthåndværk/b55decba-8eb5-436b-af3e-148f7b4eacda
1212
===
1313
200
1414
Content-Type: application/json
15-
Content-Length: 84
15+
Content-Length: 104
1616

17-
{"id":"b55decba-8eb5-436b-af3e-148f7b4eacda","Umlauts ä_ö_ü-COUNT":4,"user_id":1}
17+
{"id":"b55decba-8eb5-436b-af3e-148f7b4eacda","Umlauts ä_ö_ü-COUNT":4,"user_id":1,"invisible_id":null}
1818
===
1919
PUT /records/kunsthåndværk/b55decba-8eb5-436b-af3e-148f7b4eacda
2020

@@ -30,9 +30,9 @@ GET /records/kunsthåndværk/b55decba-8eb5-436b-af3e-148f7b4eacda
3030
===
3131
200
3232
Content-Type: application/json
33-
Content-Length: 84
33+
Content-Length: 104
3434

35-
{"id":"b55decba-8eb5-436b-af3e-148f7b4eacda","Umlauts ä_ö_ü-COUNT":4,"user_id":1}
35+
{"id":"b55decba-8eb5-436b-af3e-148f7b4eacda","Umlauts ä_ö_ü-COUNT":4,"user_id":1,"invisible_id":null}
3636
===
3737
DELETE /records/kunsthåndværk/e31ecfe6-591f-4660-9fbd-1a232083037f
3838
===

tests/functional/001_records/085_update_invisble_column_kunsthandvaerk copy.log

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ GET /records/kunsthåndværk/b55decba-8eb5-436b-af3e-148f7b4eacda
1212
===
1313
200
1414
Content-Type: application/json
15-
Content-Length: 84
15+
Content-Length: 104
1616

17-
{"id":"b55decba-8eb5-436b-af3e-148f7b4eacda","Umlauts ä_ö_ü-COUNT":4,"user_id":1}
17+
{"id":"b55decba-8eb5-436b-af3e-148f7b4eacda","Umlauts ä_ö_ü-COUNT":4,"user_id":1,"invisible_id":null}
1818
===
1919
PUT /records/kunsthåndværk/b55decba-8eb5-436b-af3e-148f7b4eacda
2020

@@ -30,9 +30,9 @@ GET /records/kunsthåndværk/b55decba-8eb5-436b-af3e-148f7b4eacda
3030
===
3131
200
3232
Content-Type: application/json
33-
Content-Length: 84
33+
Content-Length: 104
3434

35-
{"id":"b55decba-8eb5-436b-af3e-148f7b4eacda","Umlauts ä_ö_ü-COUNT":3,"user_id":1}
35+
{"id":"b55decba-8eb5-436b-af3e-148f7b4eacda","Umlauts ä_ö_ü-COUNT":3,"user_id":1,"invisible_id":null}
3636
===
3737
DELETE /records/kunsthåndværk/b55decba-8eb5-436b-af3e-148f7b4eacda
3838
===

tests/functional/003_columns/001_get_database_with_geometry_fields.log

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ GET /columns
22
===
33
200
44
Content-Type: application/json
5-
Content-Length: 2712
5+
Content-Length: 2799
66

7-
{"tables":[{"name":"barcodes","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"product_id","type":"integer","fk":"products"},{"name":"hex","type":"varchar","length":255},{"name":"bin","type":"blob"},{"name":"ip_address","type":"varchar","length":15,"nullable":true}]},{"name":"categories","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"name","type":"varchar","length":255},{"name":"icon","type":"blob","nullable":true}]},{"name":"comments","type":"table","columns":[{"name":"id","type":"bigint","pk":true},{"name":"post_id","type":"integer","fk":"posts"},{"name":"message","type":"varchar","length":255},{"name":"category_id","type":"integer","fk":"categories"}]},{"name":"countries","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"name","type":"varchar","length":255},{"name":"shape","type":"geometry"}]},{"name":"events","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"name","type":"varchar","length":255},{"name":"datetime","type":"timestamp","nullable":true},{"name":"visitors","type":"bigint","nullable":true}]},{"name":"kunsthåndværk","type":"table","columns":[{"name":"id","type":"varchar","length":36,"pk":true},{"name":"Umlauts ä_ö_ü-COUNT","type":"integer"},{"name":"user_id","type":"integer","fk":"users"}]},{"name":"nopk","type":"table","columns":[{"name":"id","type":"varchar","length":36}]},{"name":"post_tags","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"post_id","type":"integer","fk":"posts"},{"name":"tag_id","type":"integer","fk":"tags"}]},{"name":"posts","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"user_id","type":"integer","fk":"users"},{"name":"category_id","type":"integer","fk":"categories"},{"name":"content","type":"varchar","length":255}]},{"name":"products","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"name","type":"varchar","length":255},{"name":"price","type":"decimal","precision":10,"scale":2},{"name":"properties","type":"clob"},{"name":"created_at","type":"timestamp"},{"name":"deleted_at","type":"timestamp","nullable":true}]},{"name":"tag_usage","type":"view","columns":[{"name":"name","type":"varchar","length":255},{"name":"count","type":"bigint"}]},{"name":"tags","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"name","type":"varchar","length":255},{"name":"is_important","type":"boolean"}]},{"name":"users","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"username","type":"varchar","length":255},{"name":"password","type":"varchar","length":255},{"name":"location","type":"geometry","nullable":true}]}]}
7+
{"tables":[{"name":"barcodes","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"product_id","type":"integer","fk":"products"},{"name":"hex","type":"varchar","length":255},{"name":"bin","type":"blob"},{"name":"ip_address","type":"varchar","length":15,"nullable":true}]},{"name":"categories","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"name","type":"varchar","length":255},{"name":"icon","type":"blob","nullable":true}]},{"name":"comments","type":"table","columns":[{"name":"id","type":"bigint","pk":true},{"name":"post_id","type":"integer","fk":"posts"},{"name":"message","type":"varchar","length":255},{"name":"category_id","type":"integer","fk":"categories"}]},{"name":"countries","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"name","type":"varchar","length":255},{"name":"shape","type":"geometry"}]},{"name":"events","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"name","type":"varchar","length":255},{"name":"datetime","type":"timestamp","nullable":true},{"name":"visitors","type":"bigint","nullable":true}]},{"name":"kunsthåndværk","type":"table","columns":[{"name":"id","type":"varchar","length":36,"pk":true},{"name":"Umlauts ä_ö_ü-COUNT","type":"integer"},{"name":"user_id","type":"integer","fk":"users"},{"name":"invisible_id","type":"varchar","length":36,"nullable":true,"fk":"invisibles"}]},{"name":"nopk","type":"table","columns":[{"name":"id","type":"varchar","length":36}]},{"name":"post_tags","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"post_id","type":"integer","fk":"posts"},{"name":"tag_id","type":"integer","fk":"tags"}]},{"name":"posts","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"user_id","type":"integer","fk":"users"},{"name":"category_id","type":"integer","fk":"categories"},{"name":"content","type":"varchar","length":255}]},{"name":"products","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"name","type":"varchar","length":255},{"name":"price","type":"decimal","precision":10,"scale":2},{"name":"properties","type":"clob"},{"name":"created_at","type":"timestamp"},{"name":"deleted_at","type":"timestamp","nullable":true}]},{"name":"tag_usage","type":"view","columns":[{"name":"name","type":"varchar","length":255},{"name":"count","type":"bigint"}]},{"name":"tags","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"name","type":"varchar","length":255},{"name":"is_important","type":"boolean"}]},{"name":"users","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"username","type":"varchar","length":255},{"name":"password","type":"varchar","length":255},{"name":"location","type":"geometry","nullable":true}]}]}

0 commit comments

Comments
 (0)