simple list of pds servers with open registration
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite?v=13";
2import { METADATA_TABLE, SERVERS_TABLE } from "../../shared/constants.ts";
3
4export async function runMigrations(): Promise<void> {
5 await sqlite.execute(`
6 CREATE TABLE IF NOT EXISTS ${SERVERS_TABLE} (
7 url TEXT PRIMARY KEY,
8 first_seen TEXT NOT NULL,
9 last_seen TEXT NOT NULL,
10 last_enriched TEXT,
11 version TEXT,
12 did TEXT,
13 invite_code_required INTEGER NOT NULL DEFAULT 0,
14 phone_verification INTEGER NOT NULL DEFAULT 0,
15 user_domains TEXT,
16 contact_email TEXT,
17 privacy_policy TEXT,
18 terms_of_service TEXT,
19 user_count INTEGER,
20 country_code TEXT,
21 country_name TEXT,
22 ip_address TEXT,
23 is_open INTEGER NOT NULL DEFAULT 0,
24 error_at INTEGER
25 )
26 `);
27
28 await sqlite.execute(`
29 CREATE INDEX IF NOT EXISTS idx_${SERVERS_TABLE}_is_open
30 ON ${SERVERS_TABLE} (is_open)
31 `);
32
33 await sqlite.execute(`
34 CREATE INDEX IF NOT EXISTS idx_${SERVERS_TABLE}_last_enriched
35 ON ${SERVERS_TABLE} (last_enriched)
36 `);
37
38 await sqlite.execute(`
39 CREATE TABLE IF NOT EXISTS ${METADATA_TABLE} (
40 key TEXT PRIMARY KEY,
41 value TEXT NOT NULL
42 )
43 `);
44
45 // Add pds_software column (idempotent — ignore if it already exists)
46 try {
47 await sqlite.execute(
48 `ALTER TABLE ${SERVERS_TABLE} ADD COLUMN pds_software TEXT`,
49 );
50 } catch {
51 // Column already exists
52 }
53}