Compare commits

...

2 Commits

Author SHA1 Message Date
Martti Malmi 248b35d3ca fix: ensure __migration table exists
continuous-integration/drone/push Build is failing Details
2024-02-07 11:06:54 +02:00
Martti Malmi 2f0b4f8d96 handle invalid tags 2024-02-07 11:06:54 +02:00
2 changed files with 8 additions and 2 deletions

View File

@ -150,10 +150,10 @@ function useGoToEvent(props, options) {
function Reaction({ ev }: { ev: TaggedNostrEvent }) {
const reactedToTag = ev.tags.find((tag: string[]) => tag[0] === "e");
const link = NostrLink.fromTag(reactedToTag);
if (!reactedToTag) {
if (!reactedToTag?.length) {
return null;
}
const link = NostrLink.fromTag(reactedToTag);
return (
<div className="note card">
<div className="text-gray-medium font-bold">

View File

@ -15,6 +15,12 @@ const migrations = [
async function migrate(relay: SqliteRelay) {
if (!relay.db) throw new Error("DB must be open");
relay.db.exec(
"CREATE TABLE IF NOT EXISTS __migration (\
version INTEGER PRIMARY KEY, \
migrated_at INTEGER \
)",
);
const res = relay.db.exec("SELECT MAX(version) FROM __migration", { returnValue: "resultRows" });
let currentVersion = (res[0][0] as number | undefined) ?? 0;