Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(page): page and section backend #3666

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
2 changes: 2 additions & 0 deletions ee/tabby-db/migrations/0042_page-section.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DROP TABLE page_sections;
DROP TABLE pages;
42 changes: 42 additions & 0 deletions ee/tabby-db/migrations/0042_page-section.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
CREATE TABLE pages(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,

-- Whether the page is draft
is_draft BOOLEAN NOT NULL,
zwpaper marked this conversation as resolved.
Show resolved Hide resolved

-- The user who created the page
user_id INTEGER NOT NULL,
zwpaper marked this conversation as resolved.
Show resolved Hide resolved

-- Array of relevant questions, in format of `String`
relevant_questions BLOB,
zwpaper marked this conversation as resolved.
Show resolved Hide resolved

created_at TIMESTAMP NOT NULL DEFAULT (DATETIME('now')),
updated_at TIMESTAMP NOT NULL DEFAULT (DATETIME('now')),

FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
);

CREATE TABLE page_sections(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
page_id INTEGER NOT NULL,

order_index INTEGER NOT NULL,
zwpaper marked this conversation as resolved.
Show resolved Hide resolved

title TEXT NOT NULL,
content TEXT NOT NULL,

-- TODO: link or updated image
media BLOB,

-- TODO: user input source
client_sources BLOB,

-- TODO: json format
sources BLOB,
zwpaper marked this conversation as resolved.
Show resolved Hide resolved

created_at TIMESTAMP NOT NULL DEFAULT (DATETIME('now')),
updated_at TIMESTAMP NOT NULL DEFAULT (DATETIME('now')),

FOREIGN KEY(thread_id) REFERENCES threads(id) ON DELETE CASCADE,
zwpaper marked this conversation as resolved.
Show resolved Hide resolved
CONSTRAINT `page_id_order_index` UNIQUE(page_id, order_index)
);
Loading