---
# System prepended metadata

title: Database Schema

---

# Database Schema
```plantuml

package db_hotel {
    entity pelanggan {
        id_pelanggan : char(36) {UUID} <<PK>>
        nama_pelanggan : varchar(55)
        jenis_kelamin: enum('laki-laki', 'perempuan')
        alamat_pelanggan: text
        email_pelanggan : varchar(100)
        no_telp : bigint
        created_at: timestamp (nullable)
        created_by: varchar (nullable)
        updated_at: timestamp (nullable)
        updated_by: varchar (nullable)
        deleted_at:  timestamp (nullable)
        deleted_by: varchar (nullable)
        ---
        indexes:
            PRIMARY id_pelanggan
            nama_pelanggan
            email
            no_telp
            
    }    
     entity kamar {
        id_kamar : char(36) {UUID} <<PK>>
        id_jenis_kamar : char(36) {UUID} <<FK>>
        jenis_kamar : varchar(55)
        created_at: timestamp (nullable)
        created_by: varchar (nullable)
        updated_at: timestamp (nullable)
        updated_by: varchar (nullable)
        deleted_at:  timestamp (nullable)
        deleted_by: varchar (nullable)
        ---
                    indexes:
            PRIMARY id_kamar
            status_kamar
    }   
     entity jenis_kamar {
        id_jenis_kamar : char(36) {UUID} <<PK>>
        jenis_kamar : varchar(55)
        fasilitas: text
        tarif_sewa_kamar: decimal
        created_at: timestamp (nullable)
        created_by: varchar (nullable)
        updated_at: timestamp (nullable)
        updated_by: varchar (nullable)
        deleted_at:  timestamp (nullable)
        deleted_by: varchar (nullable)
        ---
             indexes:
            PRIMARY id_jenis_kamar
    }
     entity status_kamar {
        id_status_kamar: char(36){UUID} <<PK>>
        id_kamar: char(36) <<FK>>
        id_status: char(36) <<FK>>
        created_at: timestamp (nullable)
        created_by: varchar (nullable)
        updated_at: timestamp (nullable)
        updated_by: varchar (nullable)
        deleted_at:  timestamp (nullable)
        deleted_by: varchar (nullable)
        ---
        indexes:
        PRIMARY id_status_kamar
             
    }
    entity status {
        id_status: char(36){UUID} <<PK>>
        status:enum('open','closed','booked', 'paid_off')
        created_at: timestamp (nullable)
        created_by: varchar (nullable)
        updated_at: timestamp (nullable)
        updated_by: varchar (nullable)
        deleted_at:  timestamp (nullable)
        deleted_by: varchar (nullable)
        ---
        indexes:
        PRIMARY id_status
        status
     }
        
    entity pemesanan {
        id_pemesanan : char(36) {UUID} <<PK>>
        kode_pemesanan : varchar(12)
        id_pelanggan : char(36) <<FK>>
        id_kamar: char(36) <<FK>>
        tanggal_pemesanan: timestamp
        tanggal_checkin: timestamp (nullable)
        tanggal_checkout: timestamp (nullable)
        created_at: timestamp (nullable)
        created_by: varchar (nullable)
        updated_at: timestamp (nullable)
        updated_by: varchar (nullable)
        deleted_at:  timestamp (nullable)
        deleted_by: varchar (nullable)
        ---
        indexes:
        PRIMARY id_pemesanan
                kode_pemesanan
    }
        
    entity pembayaran {
        id_pembayaran : char(36) {UUID} <<PK>>
        id_pemesanan : char(36) <<FK>>
        tgl_pembayaran : timestamp
        id_status : char(36) <<FK>>
        created_at: timestamp (nullable)
        created_by: varchar (nullable)
        updated_at: timestamp (nullable)
        updated_by: varchar (nullable)
        deleted_at:  timestamp (nullable)
        deleted_by: varchar (nullable)
        ---
        indexes:
        PRIMARY id_pembayaran
    }
    
    entity detail_pembayaran {
        id_detail_pembayaran : char(36) {UUID} <<PK>>
        id_pembayaran : char(36) <<FK>>
        tanggal_lunas : timestamp
        jumlah_bayar : decimal(12,2)
        kurang_bayar : decimal(12,2)
        created_at: timestamp (nullable)
        created_by: varchar (nullable)
        updated_at: timestamp (nullable)
        updated_by: varchar (nullable)
        deleted_at:  timestamp (nullable)
        deleted_by: varchar (nullable)
        ---
        indexes:
        PRIMARY id_detail_pembayaran
    }
    
    
    jenis_kamar::id_jenis_kamar ||--|| kamar::id_jenis_kamar
    kamar::id_kamar ||--|| status_kamar::id_kamar
    status_kamar::id_status ||--|| status::id_status
    pelanggan::id_pelanggan ||--|| pemesanan::id_pelanggan
    pemesanan::id_pemesanan ||--|| pembayaran::id_pemesanan
    pembayaran::id_pembayaran ||--|| detail_pembayaran::id_pembayaran
    pemesanan::id_kamar ||--|| kamar::id_kamar
    pembayaran::id_status ||--|| status::id_status
         
}


```