25 lines
870 B
SQL
25 lines
870 B
SQL
-- Migration: Chat and Deposits
|
|
-- Adds chat support and deposit tracking
|
|
|
|
CREATE TABLE IF NOT EXISTS chat_messages (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
user_id INT NOT NULL,
|
|
admin_id INT DEFAULT NULL, -- NULL means sent by user
|
|
message TEXT,
|
|
attachment_url VARCHAR(255) DEFAULT NULL,
|
|
is_read TINYINT(1) DEFAULT 0,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS deposits (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
user_id INT NOT NULL,
|
|
currency VARCHAR(20) DEFAULT 'USDT',
|
|
amount DECIMAL(30, 10) NOT NULL,
|
|
status ENUM('pending', 'approved', 'rejected') DEFAULT 'pending',
|
|
receipt_url VARCHAR(255) DEFAULT NULL,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
|
);
|
|
|
|
-- Note: uid was already added in migration 03. |