-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from GesangPJ/test
v1.4.5 Merge
- Loading branch information
Showing
33 changed files
with
1,569 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
prisma/migrations/20240815144926_tambahmodel_pembelianbermasalah/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-- CreateTable | ||
CREATE TABLE "PembelianBermasalah" ( | ||
"id" SERIAL NOT NULL, | ||
"pembeliandetailId" INTEGER NOT NULL, | ||
"kodepembelian" TEXT, | ||
"produkId" INTEGER NOT NULL, | ||
"jumlahpesanan" INTEGER NOT NULL, | ||
"jumlahkedatangan" INTEGER NOT NULL, | ||
"selisih" INTEGER NOT NULL, | ||
"status" TEXT, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "PembelianBermasalah_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "PembelianBermasalah" ADD CONSTRAINT "PembelianBermasalah_produkId_fkey" FOREIGN KEY ("produkId") REFERENCES "Produk"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "PembelianBermasalah" ADD CONSTRAINT "PembelianBermasalah_pembeliandetailId_fkey" FOREIGN KEY ("pembeliandetailId") REFERENCES "PembelianDetail"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
21 changes: 21 additions & 0 deletions
21
prisma/migrations/20240815145928_buat_model_kedatangandetail/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `jumlahproduk` on the `Kedatangan` table. All the data in the column will be lost. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "Kedatangan" DROP COLUMN "jumlahproduk"; | ||
|
||
-- CreateTable | ||
CREATE TABLE "KedatanganDetail" ( | ||
"id" SERIAL NOT NULL, | ||
"kedatanganId" INTEGER NOT NULL, | ||
"produkId" INTEGER NOT NULL, | ||
"jumlahkedatangan" INTEGER NOT NULL, | ||
|
||
CONSTRAINT "KedatanganDetail_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "KedatanganDetail" ADD CONSTRAINT "KedatanganDetail_produkId_fkey" FOREIGN KEY ("produkId") REFERENCES "Produk"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
38 changes: 38 additions & 0 deletions
38
prisma/migrations/20240816035900_edit_kedatangan/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `notes` on the `Kedatangan` table. All the data in the column will be lost. | ||
- You are about to drop the column `receivedBy` on the `Kedatangan` table. All the data in the column will be lost. | ||
- You are about to drop the column `tanggalkedatangan` on the `Kedatangan` table. All the data in the column will be lost. | ||
- You are about to drop the `KedatanganDetail` table. If the table is not empty, all the data it contains will be lost. | ||
- Added the required column `jumlahkedatangan` to the `Kedatangan` table without a default value. This is not possible if the table is not empty. | ||
- Added the required column `jumlahpesanan` to the `Kedatangan` table without a default value. This is not possible if the table is not empty. | ||
- Added the required column `kodepembelian` to the `Kedatangan` table without a default value. This is not possible if the table is not empty. | ||
- Added the required column `produkId` to the `Kedatangan` table without a default value. This is not possible if the table is not empty. | ||
- Added the required column `updatedAt` to the `Kedatangan` table without a default value. This is not possible if the table is not empty. | ||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE "Kedatangan" DROP CONSTRAINT "Kedatangan_receivedBy_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "KedatanganDetail" DROP CONSTRAINT "KedatanganDetail_produkId_fkey"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "Kedatangan" DROP COLUMN "notes", | ||
DROP COLUMN "receivedBy", | ||
DROP COLUMN "tanggalkedatangan", | ||
ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
ADD COLUMN "jumlahkedatangan" INTEGER NOT NULL, | ||
ADD COLUMN "jumlahpesanan" INTEGER NOT NULL, | ||
ADD COLUMN "kodepembelian" TEXT NOT NULL, | ||
ADD COLUMN "produkId" INTEGER NOT NULL, | ||
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL, | ||
ALTER COLUMN "status" DROP NOT NULL, | ||
ALTER COLUMN "status" DROP DEFAULT; | ||
|
||
-- DropTable | ||
DROP TABLE "KedatanganDetail"; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Kedatangan" ADD CONSTRAINT "Kedatangan_produkId_fkey" FOREIGN KEY ("produkId") REFERENCES "Produk"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
11 changes: 11 additions & 0 deletions
11
prisma/migrations/20240816063019_hapus_pembeliandetail_kedatangan/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `pembeliandetailId` on the `Kedatangan` table. All the data in the column will be lost. | ||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE "Kedatangan" DROP CONSTRAINT "Kedatangan_pembeliandetailId_fkey"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "Kedatangan" DROP COLUMN "pembeliandetailId"; |
8 changes: 8 additions & 0 deletions
8
prisma/migrations/20240816092127_updatemodel_pembelianbermasalah/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `selisih` on the `PembelianBermasalah` table. All the data in the column will be lost. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "PembelianBermasalah" DROP COLUMN "selisih"; |
11 changes: 11 additions & 0 deletions
11
prisma/migrations/20240816092600_update_pembelianbermasalah/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `pembeliandetailId` on the `PembelianBermasalah` table. All the data in the column will be lost. | ||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE "PembelianBermasalah" DROP CONSTRAINT "PembelianBermasalah_pembeliandetailId_fkey"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "PembelianBermasalah" DROP COLUMN "pembeliandetailId"; |
58 changes: 58 additions & 0 deletions
58
prisma/migrations/20240816093057_updatekedatangan_pembelian_bermasalah/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `jumlahkedatangan` on the `Kedatangan` table. All the data in the column will be lost. | ||
- You are about to drop the column `jumlahpesanan` on the `Kedatangan` table. All the data in the column will be lost. | ||
- You are about to drop the column `produkId` on the `Kedatangan` table. All the data in the column will be lost. | ||
- You are about to drop the column `jumlahkedatangan` on the `PembelianBermasalah` table. All the data in the column will be lost. | ||
- You are about to drop the column `jumlahpesanan` on the `PembelianBermasalah` table. All the data in the column will be lost. | ||
- You are about to drop the column `produkId` on the `PembelianBermasalah` table. All the data in the column will be lost. | ||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE "Kedatangan" DROP CONSTRAINT "Kedatangan_produkId_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "PembelianBermasalah" DROP CONSTRAINT "PembelianBermasalah_produkId_fkey"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "Kedatangan" DROP COLUMN "jumlahkedatangan", | ||
DROP COLUMN "jumlahpesanan", | ||
DROP COLUMN "produkId"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "PembelianBermasalah" DROP COLUMN "jumlahkedatangan", | ||
DROP COLUMN "jumlahpesanan", | ||
DROP COLUMN "produkId"; | ||
|
||
-- CreateTable | ||
CREATE TABLE "DetailBermasalah" ( | ||
"id" SERIAL NOT NULL, | ||
"pembelianbermasalahId" INTEGER NOT NULL, | ||
"produkId" INTEGER NOT NULL, | ||
"jumlahpesanan" INTEGER NOT NULL, | ||
"jumlahkedatangan" INTEGER NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "DetailBermasalah_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "KedatanganDetail" ( | ||
"id" SERIAL NOT NULL, | ||
"kedatanganId" INTEGER NOT NULL, | ||
"produkId" INTEGER NOT NULL, | ||
"jumlahpesanan" INTEGER NOT NULL, | ||
"jumlahkedatangan" INTEGER NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "KedatanganDetail_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "DetailBermasalah" ADD CONSTRAINT "DetailBermasalah_produkId_fkey" FOREIGN KEY ("produkId") REFERENCES "Produk"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "KedatanganDetail" ADD CONSTRAINT "KedatanganDetail_produkId_fkey" FOREIGN KEY ("produkId") REFERENCES "Produk"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
5 changes: 5 additions & 0 deletions
5
prisma/migrations/20240816093238_updaterelation_kedatangan_bermasalah/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- AddForeignKey | ||
ALTER TABLE "DetailBermasalah" ADD CONSTRAINT "DetailBermasalah_pembelianbermasalahId_fkey" FOREIGN KEY ("pembelianbermasalahId") REFERENCES "PembelianBermasalah"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "KedatanganDetail" ADD CONSTRAINT "KedatanganDetail_kedatanganId_fkey" FOREIGN KEY ("kedatanganId") REFERENCES "Kedatangan"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
11 changes: 11 additions & 0 deletions
11
prisma/migrations/20240816142430_update_pembelianbermasalah/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
Warnings: | ||
- Added the required column `pembelianId` to the `PembelianBermasalah` table without a default value. This is not possible if the table is not empty. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "PembelianBermasalah" ADD COLUMN "pembelianId" INTEGER NOT NULL; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "PembelianBermasalah" ADD CONSTRAINT "PembelianBermasalah_pembelianId_fkey" FOREIGN KEY ("pembelianId") REFERENCES "Pembelian"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
11 changes: 11 additions & 0 deletions
11
prisma/migrations/20240817044438_edit_kedatangan/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
Warnings: | ||
- Added the required column `pembelianId` to the `Kedatangan` table without a default value. This is not possible if the table is not empty. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "Kedatangan" ADD COLUMN "pembelianId" INTEGER NOT NULL; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Kedatangan" ADD CONSTRAINT "Kedatangan_pembelianId_fkey" FOREIGN KEY ("pembelianId") REFERENCES "Pembelian"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Reset Kedatangan | ||
|
||
const { PrismaClient } = require('@prisma/client') | ||
|
||
const prisma = new PrismaClient() | ||
|
||
async function main() { | ||
try { | ||
// Hapus semua data dari tabel Kedatangan detail dan Kedatangan | ||
await prisma.kedatanganDetail.deleteMany({}) | ||
await prisma.kedatangan.deleteMany({}) | ||
console.log('Berhasil menghapus semua data di tabel Kedatangan Detail & Kedatangan.') | ||
|
||
// Reset ID KedatanganDetail dan Kedatangan dari 1 | ||
await prisma.$executeRaw`ALTER SEQUENCE "KedatanganDetail_id_seq" RESTART WITH 1` | ||
await prisma.$executeRaw`ALTER SEQUENCE "Kedatangan_id_seq" RESTART WITH 1` | ||
console.log('Berhasil mereset ID di tabel Kedatangan Detail & Kedatangan.') | ||
|
||
} catch (error) { | ||
console.error('Error menghapus data dan reset ID Kedatangan Detail & Kedatangan :', error) | ||
} finally { | ||
await prisma.$disconnect() | ||
} | ||
} | ||
|
||
main() | ||
.catch((e) => { | ||
console.error(e) | ||
process.exit(1) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Reset Pembelian | ||
|
||
const { PrismaClient } = require('@prisma/client') | ||
|
||
const prisma = new PrismaClient() | ||
|
||
async function main() { | ||
try { | ||
// Hapus semua data dari tabel Pembelian detail dan Pembelian | ||
await prisma.pembelianDetail.deleteMany({}) | ||
await prisma.pembelian.deleteMany({}) | ||
console.log('Berhasil menghapus semua data di tabel Pembelian Detail & Pembelian.') | ||
|
||
// Reset ID PembelianDetail dan Pembelian dari 1 | ||
await prisma.$executeRaw`ALTER SEQUENCE "PembelianDetail_id_seq" RESTART WITH 1` | ||
await prisma.$executeRaw`ALTER SEQUENCE "Pembelian_id_seq" RESTART WITH 1` | ||
console.log('Berhasil mereset ID di tabel Pembelian Detail & Pembelian.') | ||
|
||
} catch (error) { | ||
console.error('Error menghapus data dan reset ID Pembelian Detail & Pembelian :', error) | ||
} finally { | ||
await prisma.$disconnect() | ||
} | ||
} | ||
|
||
main() | ||
.catch((e) => { | ||
console.error(e) | ||
process.exit(1) | ||
}) |
Oops, something went wrong.