CREATE DATABASE IF NOT EXISTS db_golkar
    CHARACTER SET utf8mb4
    COLLATE utf8mb4_unicode_ci;

USE db_golkar;

CREATE TABLE IF NOT EXISTS anggota (
    id INT AUTO_INCREMENT PRIMARY KEY,
    nama VARCHAR(150) NOT NULL,
    nik VARCHAR(30) NOT NULL,
    kecamatan VARCHAR(100) NOT NULL,
    desa VARCHAR(100) NOT NULL,
    rt VARCHAR(10) NOT NULL,
    rw VARCHAR(10) NOT NULL,
    hp VARCHAR(30) NOT NULL,
    bidang VARCHAR(150) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS wilayah (
    id INT AUTO_INCREMENT PRIMARY KEY,
    kecamatan VARCHAR(100) NOT NULL,
    desa VARCHAR(100) NOT NULL,
    UNIQUE KEY uniq_wilayah (kecamatan, desa)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
