

-- Tabel untuk history login/register
CREATE TABLE history (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50),
action VARCHAR(50), -- register / login
date_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE ranking (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50),
foto VARCHAR(200),
pendapatan INT
);

CREATE TABLE transaksi (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50),
jenis VARCHAR(20),
jumlah DECIMAL(12,2),
status VARCHAR(20),
date_time DATETIME
);

CREATE TABLE agent_balance (
id INT AUTO_INCREMENT PRIMARY KEY,
balance DECIMAL(12,2) NOT NULL
);

INSERT INTO agent_balance (balance) VALUES (10000000);

CREATE TABLE IF NOT EXISTS setting (
id INT(11) PRIMARY KEY AUTO_INCREMENT,
tema VARCHAR(20) NOT NULL
);

INSERT INTO setting (id,tema) VALUES (1,'pink')
ON DUPLICATE KEY UPDATE tema='pink';


CREATE TABLE deposit (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50),
jumlah DECIMAL(12,2),
rekening_admin VARCHAR(100),
metode VARCHAR(50),
status ENUM('pending','paid','cancel') DEFAULT 'pending',
tanggal TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);