-- CreateTable
CREATE TABLE "ref_siba_pasar" (
    "id" SERIAL NOT NULL,
    "namapasar" TEXT NOT NULL,
    "kecamatan" TEXT NOT NULL,
    "longitude" TEXT NOT NULL,
    "latitude" TEXT NOT NULL,
    "tipe" TEXT,
    "provinsi" TEXT,
    "kabupaten" TEXT,
    "desa" TEXT,
    "rw" TEXT,
    "rt" TEXT,
    "alamat" TEXT,

    CONSTRAINT "ref_siba_pasar_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "ref_users" (
    "id" SERIAL NOT NULL,
    "username" TEXT NOT NULL,
    "password" TEXT NOT NULL,
    "role_id" INTEGER NOT NULL,
    "pasar_id" INTEGER NOT NULL,

    CONSTRAINT "ref_users_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "ref_siba_satuan" (
    "id" SERIAL NOT NULL,
    "nama" TEXT NOT NULL,
    "satuan" TEXT NOT NULL,

    CONSTRAINT "ref_siba_satuan_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "ref_siba_komoditas" (
    "id" SERIAL NOT NULL,
    "namakomoditas" TEXT NOT NULL,
    "satuan" INTEGER NOT NULL,
    "gambar" TEXT NOT NULL,
    "het" INTEGER NOT NULL,

    CONSTRAINT "ref_siba_komoditas_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "t_siba_komoditas" (
    "id" SERIAL NOT NULL,
    "created_at" TIMESTAMP(3),
    "created_id" INTEGER,
    "komoditas_id" INTEGER NOT NULL,
    "pasar_id" INTEGER NOT NULL,
    "users_id" INTEGER NOT NULL,
    "tanggal" TEXT,
    "harga_publish" DECIMAL(65,30) NOT NULL,
    "harga_admin" DECIMAL(65,30),
    "harga_dinamik" DECIMAL(65,30),
    "kondisi" TEXT,
    "status" TEXT,
    "tanggal_update" TIMESTAMP(3),
    "harga_pasar" DECIMAL(65,30) NOT NULL,
    "detail_tgl" DATE NOT NULL,
    "nama_komoditas" TEXT,
    "nama_pasar" TEXT,

    CONSTRAINT "t_siba_komoditas_pkey" PRIMARY KEY ("id")
);
