-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
21 lines (20 loc) · 750 Bytes
/
Copy pathschema.sql
File metadata and controls
21 lines (20 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
-- Users Table
CREATE TABLE IF NOT EXISTS users (
telegram_id INTEGER PRIMARY KEY,
username TEXT,
balance_usdc REAL DEFAULT 0.0,
referred_by INTEGER,
has_joined_channel BOOLEAN DEFAULT 0,
trx_deposited REAL DEFAULT 0.0,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- Referrals Tracking Table
CREATE TABLE IF NOT EXISTS referrals (
id INTEGER PRIMARY KEY AUTOINCREMENT,
referrer_id INTEGER,
referee_id INTEGER UNIQUE,
status TEXT DEFAULT 'pending', -- 'pending' or 'completed' (completed after force join)
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (referrer_id) REFERENCES users(telegram_id),
FOREIGN KEY (referee_id) REFERENCES users(telegram_id)
);