-- Database: manajemen_keuangan
CREATE DATABASE IF NOT EXISTS manajemen_keuangan;
USE manajemen_keuangan;

-- Table structure for table `keuangan`
CREATE TABLE IF NOT EXISTS `keuangan` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nama` varchar(255) NOT NULL,
  `nominal` decimal(15,2) NOT NULL,
  `sisa_hutang` decimal(15,2) NOT NULL,
  `status` enum('Belum','Hapus') NOT NULL DEFAULT 'Belum',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Table structure for table `users`
CREATE TABLE IF NOT EXISTS `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(50) NOT NULL,
  `password` varchar(255) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Sample data
INSERT INTO `keuangan` (`nama`, `nominal`, `sisa_hutang`, `status`) VALUES
('Pinjaman Bank', 10000000.00, 5000000.00, 'Belum'),
('Hutang Supplier', 5000000.00, 2000000.00, 'Belum');

-- Sample user data (password: admin123)
INSERT INTO `users` (`username`, `password`) VALUES
('admin', '0192023a7bbd73250516f069df18b500');
