social media crossposting tool. 3rd time's the charm
mastodon
misskey
crossposting
bluesky
1import sqlite3
2
3
4def migrate(conn: sqlite3.Connection):
5 _ = conn.execute("""
6 CREATE TABLE IF NOT EXISTS posts (
7 id INTEGER PRIMARY KEY AUTOINCREMENT,
8 user_id TEXT NOT NULL,
9 service TEXT NOT NULL,
10 identifier TEXT NOT NULL,
11 parent_id INTEGER NULL REFERENCES posts(id) ON DELETE SET NULL,
12 root_id INTEGER NULL REFERENCES posts(id) ON DELETE SET NULL
13 );
14 """)
15 _ = conn.execute("""
16 CREATE TABLE IF NOT EXISTS mappings (
17 original_post_id INTEGER NOT NULL REFERENCES posts(id) ON DELETE CASCADE,
18 mapped_post_id INTEGER NOT NULL
19 );
20 """)
21 pass