lume/src-tauri/migrations/20230226004139_create_tables.sql

91 lines
2.3 KiB
MySQL
Raw Normal View History

2023-02-26 02:01:19 +00:00
-- Add migration script here
-- create relays
CREATE TABLE
relays (
id INTEGER PRIMARY KEY,
relay_url TEXT NOT NULL,
relay_status INTEGER NOT NULL DEFAULT 1,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);
2023-03-15 08:27:07 +00:00
-- add default relays
-- relay status:
-- 0: off
-- 1: on
INSERT INTO
relays (relay_url, relay_status)
VALUES
("wss://relay.damus.io", "1"),
2023-03-15 08:03:12 +00:00
("wss://eden.nostr.land", "1"),
("wss://nostr-pub.wellorder.net", "1"),
("wss://nostr.bongbong.com", "1"),
("wss://nostr.zebedee.cloud", "1"),
("wss://nostr.fmt.wiz.biz", "1"),
("wss://nostr.walletofsatoshi.com", "1"),
("wss://relay.snort.social", "1"),
("wss://offchain.pub", "1"),
2023-03-15 08:03:12 +00:00
("wss://brb.io", "1"),
("wss://relay.current.fyi", "1"),
("wss://nostr.relayer.se", "1"),
("wss://nostr.bitcoiner.social", "1"),
("wss://relay.nostr.info", "1"),
("wss://relay.zeh.app", "1"),
("wss://nostr-01.dorafactory.org", "1"),
("wss://nostr.zhongwen.world", "1"),
("wss://nostro.cc", "1"),
("wss://relay.nostr.net.in", "1"),
("wss://nos.lol", "1");
2023-02-26 02:01:19 +00:00
-- create accounts
2023-03-15 08:27:07 +00:00
-- is_active (part of multi-account feature):
-- 0: false
-- 1: true
2023-02-26 02:01:19 +00:00
CREATE TABLE
accounts (
id TEXT PRIMARY KEY,
privkey TEXT NOT NULL,
npub TEXT NOT NULL,
nsec TEXT NOT NULL,
is_active INTEGER NOT NULL DEFAULT 0,
2023-03-22 02:22:34 +00:00
metadata TEXT
2023-02-26 02:01:19 +00:00
);
-- create follows
2023-03-15 08:27:07 +00:00
-- kind (part of multi-newsfeed feature):
-- 0: direct
-- 1: follow of follow
2023-02-26 02:01:19 +00:00
CREATE TABLE
follows (
id INTEGER PRIMARY KEY,
pubkey TEXT NOT NULL,
account TEXT NOT NULL,
2023-02-26 13:51:25 +00:00
kind INTEGER NOT NULL DEFAULT 0,
2023-03-22 02:22:34 +00:00
metadata TEXT
2023-02-26 02:01:19 +00:00
);
-- create index for pubkey in follows
2023-03-15 08:27:07 +00:00
CREATE UNIQUE INDEX index_pubkey_on_follows ON follows (pubkey);
2023-02-26 02:01:19 +00:00
-- create cache profiles
CREATE TABLE
cache_profiles (
id TEXT PRIMARY KEY,
2023-03-22 02:22:34 +00:00
metadata TEXT,
2023-02-26 13:51:25 +00:00
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
2023-02-26 02:01:19 +00:00
);
-- create cache notes
CREATE TABLE
cache_notes (
id TEXT PRIMARY KEY,
2023-02-28 06:20:47 +00:00
pubkey TEXT NOT NULL,
created_at TEXT,
2023-02-26 13:51:25 +00:00
kind INTEGER NOT NULL DEFAULT 1,
2023-02-28 06:20:47 +00:00
tags TEXT NOT NULL,
2023-03-22 02:22:34 +00:00
content TEXT NOT NULL,
is_circle INTEGER NOT NULL DEFAULT 0,
is_root INTEGER NOT NULL DEFAULT 0,
is_reply INTEGER NOT NULL DEFAULT 0
2023-02-26 02:01:19 +00:00
);