wip
This commit is contained in:
27
hub/api/migrations/2024-11-30-init.sql
Normal file
27
hub/api/migrations/2024-11-30-init.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
CREATE TABLE config (
|
||||
ConfigID INTEGER NOT NULL PRIMARY KEY, -- Always 1.
|
||||
HubAddress TEXT NOT NULL, -- https://for.example.com
|
||||
VPNNetwork BLOB NOT NULL, -- Network (/24), example 10.51.50.0
|
||||
Password BLOB NOT NULL -- bcrypt password for web interface
|
||||
) WITHOUT ROWID;
|
||||
|
||||
CREATE TABLE sessions (
|
||||
SessionID TEXT NOT NULL PRIMARY KEY,
|
||||
CSRF TEXT NOT NULL,
|
||||
SignedIn INTEGER NOT NULL,
|
||||
CreatedAt INTEGER NOT NULL,
|
||||
LastSeenAt INTEGER NOT NULL
|
||||
) WITHOUT ROWID;
|
||||
|
||||
CREATE INDEX sessions_last_seen_index ON sessions(LastSeenAt);
|
||||
|
||||
CREATE TABLE peers (
|
||||
PeerIP INTEGER NOT NULL PRIMARY KEY, -- Final byte.
|
||||
APIKey TEXT NOT NULL UNIQUE,
|
||||
Name TEXT NOT NULL UNIQUE, -- For humans.
|
||||
IP BLOB NOT NULL,
|
||||
Port INTEGER NOT NULL,
|
||||
Mediator INTEGER NOT NULL DEFAULT 0, -- Boolean if peer will forward packets. Must also have public address.
|
||||
EncPubKey BLOB NOT NULL,
|
||||
SignPubKey BLOB NOT NULL
|
||||
) WITHOUT ROWID;
|
||||
Reference in New Issue
Block a user