Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions modules/sqlite_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,18 @@ def maybe_create_table(sqlite_file: str) -> bool:
used INTEGER DEFAULT 1,
expires_at DATETIME DEFAULT NULL);
"""

create_pastes_table_query = """
CREATE TABLE IF NOT EXISTS pastes (
paste_id TEXT PRIMARY KEY,
title TEXT,
created_at DATETIME DEFAULT NOT NULL,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we default it to today's date

expires_at DATETIME DEFAULT NULL);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets also add a deleted_at datetime field

"""
create_index_query = """
CREATE UNIQUE INDEX IF NOT EXISTS idx_urls_alias
ON urls (alias);
"""

cursor.execute(create_pastes_table_query)
cursor.execute(create_table_query)
cursor.execute(create_index_query)
db.commit()
Expand Down