38301-vm/db/migrations/04_chat_and_deposits.sql
2026-02-09 07:44:01 +00:00

23 lines
810 B
SQL

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
);
ALTER TABLE users ADD COLUMN IF NOT EXISTS uid INT DEFAULT 0;