tinyrelayfile
tinyrelay/internal/sites/schema.go/

internal/sites/schema.go raw
1package sites
2
3import (
4 "context"
5 "database/sql"
6)
7
8const manifestSchema = `CREATE TABLE IF NOT EXISTS site_manifests (
9 label TEXT PRIMARY KEY, event_id TEXT NOT NULL, kind INTEGER NOT NULL,
10 pubkey TEXT NOT NULL, d TEXT NOT NULL DEFAULT '', updated_at INTEGER NOT NULL
11);
12CREATE TRIGGER IF NOT EXISTS site_manifest_event_deleted
13AFTER DELETE ON events
14WHEN old.kind IN (5128,15128,35128)
15BEGIN
16 DELETE FROM site_manifests WHERE event_id=old.id;
17END;`
18
19func ensureManifestSchema(ctx context.Context, db *sql.DB) error {
20 _, err := db.ExecContext(ctx, manifestSchema)
21 return err
22}

About

ownerc01503e8035f
visibilitypublic
headd730679639bf

Maintainers

  • c01503e8035f owner
  • ba1b5beed5b5 agent hermes

Clone

  • https://012.run/npub1cq2s86qrtadf36eqq3epm38wmhdynrrcwxf84eldk3f94dkv7ttsrulrz5/tinyrelay.git

Refs