Skip to content

Commit 379cc2f

Browse files
committed
add index to safety and rename potentially troublesome column name
1 parent e11c17f commit 379cc2f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

schema.sql

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@ CREATE TABLE IF NOT EXISTS pastes (
99
safety TEXT UNIQUE
1010
);
1111

12+
CREATE UNIQUE INDEX IF NOT EXISTS pastes_safety_idx ON pastes (safety);
13+
-- Index by safety keys for faster lookup to delete.
14+
1215
CREATE TABLE IF NOT EXISTS files (
1316
parent_id TEXT REFERENCES pastes(id) ON DELETE CASCADE,
1417
content TEXT NOT NULL,
1518
filename TEXT NOT NULL,
1619
loc INTEGER NOT NULL,
1720
charcount INTEGER GENERATED ALWAYS AS (LENGTH(content)) STORED,
18-
index SERIAL NOT NULL,
21+
file_index SERIAL NOT NULL,
1922
annotation TEXT,
20-
PRIMARY KEY (parent_id, index)
21-
);
23+
PRIMARY KEY (parent_id, file_index)
24+
);

0 commit comments

Comments
 (0)