mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Fixed incorrect display of compound primary keys with foreign key references
Closes #319
This commit is contained in:
parent
3683a6b626
commit
3b53eea382
5 changed files with 122 additions and 10 deletions
|
|
@ -303,6 +303,10 @@ INSERT INTO units VALUES (1, 1, 100);
|
|||
INSERT INTO units VALUES (2, 5000, 2500);
|
||||
INSERT INTO units VALUES (3, 100000, 75000);
|
||||
|
||||
CREATE TABLE tags (
|
||||
tag TEXT PRIMARY KEY
|
||||
);
|
||||
|
||||
CREATE TABLE searchable (
|
||||
pk integer primary key,
|
||||
text1 text,
|
||||
|
|
@ -310,9 +314,25 @@ CREATE TABLE searchable (
|
|||
[name with . and spaces] text
|
||||
);
|
||||
|
||||
CREATE TABLE searchable_tags (
|
||||
searchable_id integer,
|
||||
tag text,
|
||||
PRIMARY KEY (searchable_id, tag),
|
||||
FOREIGN KEY (searchable_id) REFERENCES searchable(pk),
|
||||
FOREIGN KEY (tag) REFERENCES tags(tag)
|
||||
);
|
||||
|
||||
INSERT INTO searchable VALUES (1, 'barry cat', 'terry dog', 'panther');
|
||||
INSERT INTO searchable VALUES (2, 'terry dog', 'sara weasel', 'puma');
|
||||
|
||||
INSERT INTO tags VALUES ("canine");
|
||||
INSERT INTO tags VALUES ("feline");
|
||||
|
||||
INSERT INTO searchable_tags (searchable_id, tag) VALUES
|
||||
(1, "feline"),
|
||||
(2, "canine")
|
||||
;
|
||||
|
||||
CREATE VIRTUAL TABLE "searchable_fts"
|
||||
USING FTS3 (text1, text2, [name with . and spaces], content="searchable");
|
||||
INSERT INTO "searchable_fts" (rowid, text1, text2, [name with . and spaces])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue