Files
psp_api/prisma/migrations/20260102214244_init/migration.sql
T

28 lines
1004 B
SQL

/*
Warnings:
- You are about to drop the `SalesInvoicePayment` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropForeignKey
ALTER TABLE `SalesInvoicePayment` DROP FOREIGN KEY `SalesInvoicePayment_invoiceId_fkey`;
-- DropTable
DROP TABLE `SalesInvoicePayment`;
-- CreateTable
CREATE TABLE `Sales_Invoice_Payments` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`invoiceId` INTEGER NOT NULL,
`amount` DECIMAL(15, 2) NOT NULL,
`paymentMethod` ENUM('CASH', 'CARD', 'BANK', 'CHECK', 'OTHER') NOT NULL,
`paidAt` DATETIME(3) NOT NULL,
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
INDEX `Sales_Invoice_Payments_invoiceId_idx`(`invoiceId`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- AddForeignKey
ALTER TABLE `Sales_Invoice_Payments` ADD CONSTRAINT `Sales_Invoice_Payments_invoiceId_fkey` FOREIGN KEY (`invoiceId`) REFERENCES `Sales_Invoices`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;