update pos consumer module
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `complex_id` on the `customers` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `complex_id` on the `sales_invoices` table. All the data in the column will be lost.
|
||||
- Added the required column `pos_id` to the `sales_invoices` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE `customers` DROP COLUMN `complex_id`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `sales_invoices` DROP COLUMN `complex_id`,
|
||||
ADD COLUMN `pos_id` VARCHAR(191) NOT NULL;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `customer_individuals` ADD CONSTRAINT `customer_individuals_complex_id_fkey` FOREIGN KEY (`complex_id`) REFERENCES `complexes`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `customer_legal` ADD CONSTRAINT `customer_legal_complex_id_fkey` FOREIGN KEY (`complex_id`) REFERENCES `complexes`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `sales_invoices` ADD CONSTRAINT `sales_invoices_pos_id_fkey` FOREIGN KEY (`pos_id`) REFERENCES `poses`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `sales_invoices` ADD CONSTRAINT `sales_invoices_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `consumer_accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
@@ -27,7 +27,8 @@ model ConsumerAccount {
|
||||
account_id String @unique
|
||||
account Account @relation(fields: [account_id], references: [id])
|
||||
|
||||
permissions PermissionConsumer[]
|
||||
permissions PermissionConsumer[]
|
||||
salesInvoices SalesInvoice[]
|
||||
|
||||
@@map("consumer_accounts")
|
||||
}
|
||||
@@ -67,6 +68,8 @@ model Complex {
|
||||
goods Good[]
|
||||
good_categories GoodCategory[]
|
||||
permissionComplexes PermissionComplex[]
|
||||
customerIndividuals CustomerIndividual[]
|
||||
customerLegals CustomerLegal[]
|
||||
|
||||
@@map("complexes")
|
||||
}
|
||||
@@ -92,6 +95,7 @@ model Pos {
|
||||
|
||||
licenses License[]
|
||||
permissionPos PermissionPos[]
|
||||
salesInvoices SalesInvoice[]
|
||||
|
||||
@@map("poses")
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
model Customer {
|
||||
id String @id @default(uuid())
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt @db.Timestamp(0)
|
||||
deleted_at DateTime? @db.Timestamp(0)
|
||||
type CustomerType
|
||||
complex_id String
|
||||
is_favorite Boolean? @default(false)
|
||||
|
||||
sales_invoices SalesInvoice[]
|
||||
customerIndividuals CustomerIndividual?
|
||||
customerLegals CustomerLegal?
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt @db.Timestamp(0)
|
||||
deleted_at DateTime? @db.Timestamp(0)
|
||||
|
||||
sales_invoices SalesInvoice[]
|
||||
customer_individuals CustomerIndividual?
|
||||
customer_legals CustomerLegal?
|
||||
|
||||
@@map("customers")
|
||||
}
|
||||
@@ -24,6 +24,7 @@ model CustomerIndividual {
|
||||
complex_id String
|
||||
|
||||
customer Customer @relation(fields: [customer_id], references: [id])
|
||||
complex Complex @relation(fields: [complex_id], references: [id])
|
||||
|
||||
@@unique([complex_id, national_id])
|
||||
@@map("customer_individuals")
|
||||
@@ -38,6 +39,7 @@ model CustomerLegal {
|
||||
complex_id String
|
||||
|
||||
customer Customer @relation(fields: [customer_id], references: [id])
|
||||
complex Complex @relation(fields: [complex_id], references: [id])
|
||||
|
||||
@@unique([complex_id, registration_number])
|
||||
@@map("customer_legal")
|
||||
|
||||
@@ -10,9 +10,11 @@ model SalesInvoice {
|
||||
|
||||
customer_id String?
|
||||
account_id String
|
||||
complex_id String
|
||||
pos_id String
|
||||
|
||||
customer Customer? @relation(fields: [customer_id], references: [id])
|
||||
pos Pos @relation(fields: [pos_id], references: [id])
|
||||
account ConsumerAccount @relation(fields: [account_id], references: [id])
|
||||
items SalesInvoiceItem[]
|
||||
payments SalesInvoicePayment[]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user