social media crossposting tool. 3rd time's the charm
mastodon misskey crossposting bluesky

drop migrations, i'm not rewriting that

zenfyr.dev b7230ce7 a32d63d2

verified
+1 -1
database/migrations.py
···
LOGGER.info("Applied migration: %s", path.name)
except sqlite3.Error as e:
self.conn.rollback()
-
raise Exception(f"Error applying migration {version}: {e}")
def migrate(self):
current_version = self.get_version()
···
LOGGER.info("Applied migration: %s", path.name)
except sqlite3.Error as e:
self.conn.rollback()
+
raise Exception(f"Error applying migration {path.name}: {e}")
def migrate(self):
current_version = self.get_version()
+1
main.py
···
migrator.migrate()
except Exception:
LOGGER.exception("Failed to migrate database!")
finally:
migrator.close()
···
migrator.migrate()
except Exception:
LOGGER.exception("Failed to migrate database!")
+
return
finally:
migrator.close()
+8 -6
migrations/001_initdb.sql
···
CREATE TABLE IF NOT EXISTS posts (
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
-
user_id TEXT NOT NULL,
-
service TEXT NOT NULL,
-
identifier TEXT NOT NULL,
-
parent_id INTEGER NULL REFERENCES posts(id),
-
root_id INTEGER NULL REFERENCES posts(id)
);
CREATE TABLE IF NOT EXISTS mappings (
···
CREATE TABLE IF NOT EXISTS posts (
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
+
user_id TEXT NOT NULL,
+
service TEXT NOT NULL,
+
identifier TEXT NOT NULL,
+
parent_id INTEGER NULL REFERENCES posts(id),
+
root_id INTEGER NULL REFERENCES posts(id),
+
reposted_id INTEGER NULL REFERENCES posts(id),
+
extra_data TEXT NULL
);
CREATE TABLE IF NOT EXISTS mappings (
-2
migrations/002_add_reposted_column.sql
···
-
ALTER TABLE posts
-
ADD COLUMN reposted_id INTEGER NULL REFERENCES posts(id) ON DELETE SET NULL;
···
-2
migrations/003_add_extra_data.sql
···
-
ALTER TABLE posts
-
ADD COLUMN extra_data TEXT NULL;
···