feat(database): add database table prefixing

This commit is contained in:
David Bailey 2025-02-13 10:39:04 +01:00
parent 3e1e61bf4a
commit 85fe57ea0c
3 changed files with 48 additions and 46 deletions

View file

@ -8,11 +8,9 @@ USE dragon_fire;
-- DROP TABLE path_errcodes;
-- DROP TABLE feed_cache;
CREATE TABLE posts (
CREATE TABLE dev_posts (
post_id INTEGER AUTO_INCREMENT,
host VARCHAR(64) NOT NULL,
post_path VARCHAR(255) NOT NULL,
post_path_depth INTEGER NOT NULL DEFAULT 0,
@ -29,13 +27,13 @@ CREATE TABLE posts (
post_settings_cache JSON DEFAULT NULL,
PRIMARY KEY(post_id),
CONSTRAINT unique_post UNIQUE (host, post_path),
CONSTRAINT unique_post UNIQUE (post_path),
INDEX(host, post_path),
INDEX(host, post_path_depth, post_path),
INDEX(post_path),
INDEX(post_path_depth, post_path),
INDEX(host, post_created_at),
INDEX(host, post_updated_at),
INDEX(post_created_at),
INDEX(post_updated_at),
FULLTEXT(post_path),
FULLTEXT(post_tags),
@ -43,13 +41,13 @@ CREATE TABLE posts (
FULLTEXT(post_brief)
);
CREATE TABLE post_markdown (
CREATE TABLE dev_post_markdown (
post_id INTEGER,
post_markdown TEXT,
PRIMARY KEY(post_id),
FOREIGN KEY(post_id) REFERENCES posts(post_id)
FOREIGN KEY(post_id) REFERENCES dev_posts(post_id)
ON DELETE CASCADE,
FULLTEXT(post_markdown)