From ff902243a658067fae858a615c0629aa2e0a4837 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Wed, 11 Jun 2025 12:18:38 +0000 Subject: (대표님) 20250611 21시 15분 OCR 등 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 5 +- .env.production | 4 +- app/[lng]/evcp/(evcp)/b-rfq/[id]/final/page.tsx | 0 app/[lng]/evcp/(evcp)/b-rfq/[id]/initial/page.tsx | 0 app/[lng]/evcp/(evcp)/b-rfq/[id]/layout.tsx | 88 + app/[lng]/evcp/(evcp)/b-rfq/[id]/page.tsx | 54 + app/[lng]/evcp/(evcp)/b-rfq/page.tsx | 78 + .../(partners)/document-list/[contractId]/page.tsx | 2 +- app/[lng]/partners/ocr/layout.tsx | 17 + app/[lng]/partners/ocr/page.tsx | 6 +- app/api/ocr/enhanced/route.ts | 1112 +- app/api/ocr/utils/imageRotation.ts | 583 +- app/api/ocr/utils/tableExtraction.ts | 611 +- app/service.ts | 224 + components/layout/HeaderSimple.tsx | 192 + components/login/login-form-shi.tsx | 12 +- components/login/login-form.tsx | 10 +- config/menuConfig.ts | 4 +- db/migrations/0113_gifted_adam_destine.sql | 92 + db/migrations/0114_even_callisto.sql | 1 + db/migrations/0115_clear_magik.sql | 215 + db/migrations/0116_medical_frightful_four.sql | 5 + db/migrations/0117_sloppy_famine.sql | 1 + db/migrations/0118_condemned_junta.sql | 1 + db/migrations/0119_flowery_kabuki.sql | 2 + db/migrations/0120_broad_lenny_balinger.sql | 2 + db/migrations/0121_gigantic_shinko_yamashiro.sql | 223 + db/migrations/0122_eager_celestials.sql | 223 + db/migrations/0123_magenta_nightcrawler.sql | 351 + db/migrations/0124_sparkling_shinko_yamashiro.sql | 48 + db/migrations/0125_handy_shaman.sql | 62 + db/migrations/0126_vengeful_kid_colt.sql | 151 + db/migrations/0127_sweet_spiral.sql | 119 + db/migrations/meta/0113_snapshot.json | 11998 ++++++++++++++++ db/migrations/meta/0114_snapshot.json | 12004 ++++++++++++++++ db/migrations/meta/0115_snapshot.json | 12010 ++++++++++++++++ db/migrations/meta/0116_snapshot.json | 12040 ++++++++++++++++ db/migrations/meta/0117_snapshot.json | 12046 ++++++++++++++++ db/migrations/meta/0118_snapshot.json | 12040 ++++++++++++++++ db/migrations/meta/0119_snapshot.json | 12034 ++++++++++++++++ db/migrations/meta/0120_snapshot.json | 12052 ++++++++++++++++ db/migrations/meta/0121_snapshot.json | 12088 ++++++++++++++++ db/migrations/meta/0122_snapshot.json | 12088 ++++++++++++++++ db/migrations/meta/0123_snapshot.json | 13916 ++++++++++++++++++ db/migrations/meta/0124_snapshot.json | 14011 ++++++++++++++++++ db/migrations/meta/0125_snapshot.json | 14023 ++++++++++++++++++ db/migrations/meta/0126_snapshot.json | 14065 +++++++++++++++++++ db/migrations/meta/0127_snapshot.json | 14065 +++++++++++++++++++ db/migrations/meta/_journal.json | 105 + db/schema/bRfq.ts | 680 + db/schema/index.ts | 3 +- db/schema/ocr.ts | 10 +- db/schema/vendorDocu.ts | 31 + lib/admin-users/table/add-ausers-dialog.tsx | 2 +- lib/b-rfq/repository.ts | 0 lib/b-rfq/service.ts | 291 + lib/b-rfq/summary-table/add-new-rfq-dialog.tsx | 523 + lib/b-rfq/summary-table/summary-rfq-columns.tsx | 499 + .../summary-table/summary-rfq-filter-sheet.tsx | 617 + .../summary-rfq-table-toolbar-actions.tsx | 68 + lib/b-rfq/summary-table/summary-rfq-table.tsx | 285 + lib/b-rfq/validations.ts | 100 + lib/users/send-otp.ts | 68 +- lib/vendor-document-list/dolce-upload-service.ts | 112 +- lib/vendor-document-list/import-service.ts | 288 +- .../table/enhanced-doc-table-columns.tsx | 222 +- .../table/enhanced-documents-table.tsx | 327 +- .../table/revision-upload-dialog.tsx | 132 +- .../table/stage-revision-expanded-content.tsx | 16 + lib/welding/repository.ts | 59 +- lib/welding/service.ts | 225 +- lib/welding/table/ocr-table-columns.tsx | 115 +- lib/welding/table/ocr-table-toolbar-actions.tsx | 96 +- lib/welding/table/ocr-table.tsx | 16 +- lib/welding/table/update-ocr-row-sheet.tsx | 187 + lib/welding/validation.ts | 10 + package-lock.json | 54 - package.json | 1 - 78 files changed, 198512 insertions(+), 1608 deletions(-) create mode 100644 app/[lng]/evcp/(evcp)/b-rfq/[id]/final/page.tsx create mode 100644 app/[lng]/evcp/(evcp)/b-rfq/[id]/initial/page.tsx create mode 100644 app/[lng]/evcp/(evcp)/b-rfq/[id]/layout.tsx create mode 100644 app/[lng]/evcp/(evcp)/b-rfq/[id]/page.tsx create mode 100644 app/[lng]/evcp/(evcp)/b-rfq/page.tsx create mode 100644 app/[lng]/partners/ocr/layout.tsx create mode 100644 app/service.ts create mode 100644 components/layout/HeaderSimple.tsx create mode 100644 db/migrations/0113_gifted_adam_destine.sql create mode 100644 db/migrations/0114_even_callisto.sql create mode 100644 db/migrations/0115_clear_magik.sql create mode 100644 db/migrations/0116_medical_frightful_four.sql create mode 100644 db/migrations/0117_sloppy_famine.sql create mode 100644 db/migrations/0118_condemned_junta.sql create mode 100644 db/migrations/0119_flowery_kabuki.sql create mode 100644 db/migrations/0120_broad_lenny_balinger.sql create mode 100644 db/migrations/0121_gigantic_shinko_yamashiro.sql create mode 100644 db/migrations/0122_eager_celestials.sql create mode 100644 db/migrations/0123_magenta_nightcrawler.sql create mode 100644 db/migrations/0124_sparkling_shinko_yamashiro.sql create mode 100644 db/migrations/0125_handy_shaman.sql create mode 100644 db/migrations/0126_vengeful_kid_colt.sql create mode 100644 db/migrations/0127_sweet_spiral.sql create mode 100644 db/migrations/meta/0113_snapshot.json create mode 100644 db/migrations/meta/0114_snapshot.json create mode 100644 db/migrations/meta/0115_snapshot.json create mode 100644 db/migrations/meta/0116_snapshot.json create mode 100644 db/migrations/meta/0117_snapshot.json create mode 100644 db/migrations/meta/0118_snapshot.json create mode 100644 db/migrations/meta/0119_snapshot.json create mode 100644 db/migrations/meta/0120_snapshot.json create mode 100644 db/migrations/meta/0121_snapshot.json create mode 100644 db/migrations/meta/0122_snapshot.json create mode 100644 db/migrations/meta/0123_snapshot.json create mode 100644 db/migrations/meta/0124_snapshot.json create mode 100644 db/migrations/meta/0125_snapshot.json create mode 100644 db/migrations/meta/0126_snapshot.json create mode 100644 db/migrations/meta/0127_snapshot.json create mode 100644 db/schema/bRfq.ts create mode 100644 lib/b-rfq/repository.ts create mode 100644 lib/b-rfq/service.ts create mode 100644 lib/b-rfq/summary-table/add-new-rfq-dialog.tsx create mode 100644 lib/b-rfq/summary-table/summary-rfq-columns.tsx create mode 100644 lib/b-rfq/summary-table/summary-rfq-filter-sheet.tsx create mode 100644 lib/b-rfq/summary-table/summary-rfq-table-toolbar-actions.tsx create mode 100644 lib/b-rfq/summary-table/summary-rfq-table.tsx create mode 100644 lib/b-rfq/validations.ts create mode 100644 lib/welding/table/update-ocr-row-sheet.tsx diff --git a/.env.development b/.env.development index 1a6356ec..d65646f4 100644 --- a/.env.development +++ b/.env.development @@ -55,4 +55,7 @@ SYNC_SWP_TOKEN= IMPORT_DOLCE_ENABLED=true DOLCE_DOC_LIST_API_URL=http://60.100.99.217:1111/Services/VDCSWebService.svc/DwgReceiptMgmt DOLCE_API_URL=http://60.100.99.217:1111 -DOLCE_UPLOAD_URL=http://60.100.99.217:1111/PWPUploadService.ashx \ No newline at end of file +DOLCE_UPLOAD_URL=http://60.100.99.217:1111/PWPUploadService.ashx + + +OCR_SECRET_KEY=QVZzbkFtVFV1UWl2THNCY01lYVVGUUxpWmdyUkxHYVA= \ No newline at end of file diff --git a/.env.production b/.env.production index fd7991af..43310d5a 100644 --- a/.env.production +++ b/.env.production @@ -54,4 +54,6 @@ SYNC_SWP_TOKEN= IMPORT_DOLCE_ENABLED=true DOLCE_DOC_LIST_API_URL=http://60.100.99.217:1111/Services/VDCSWebService.svc/DwgReceiptMgmt DOLCE_API_URL=http://60.100.99.217:1111 -DOLCE_UPLOAD_URL=http://60.100.99.217:1111/PWPUploadService.ashx \ No newline at end of file +DOLCE_UPLOAD_URL=http://60.100.99.217:1111/PWPUploadService.ashx + +OCR_SECRET_KEY=QVZzbkFtVFV1UWl2THNCY01lYVVGUUxpWmdyUkxHYVA= \ No newline at end of file diff --git a/app/[lng]/evcp/(evcp)/b-rfq/[id]/final/page.tsx b/app/[lng]/evcp/(evcp)/b-rfq/[id]/final/page.tsx new file mode 100644 index 00000000..e69de29b diff --git a/app/[lng]/evcp/(evcp)/b-rfq/[id]/initial/page.tsx b/app/[lng]/evcp/(evcp)/b-rfq/[id]/initial/page.tsx new file mode 100644 index 00000000..e69de29b diff --git a/app/[lng]/evcp/(evcp)/b-rfq/[id]/layout.tsx b/app/[lng]/evcp/(evcp)/b-rfq/[id]/layout.tsx new file mode 100644 index 00000000..75ce5ee5 --- /dev/null +++ b/app/[lng]/evcp/(evcp)/b-rfq/[id]/layout.tsx @@ -0,0 +1,88 @@ +import { Metadata } from "next" +import Link from "next/link" +import { Separator } from "@/components/ui/separator" +import { SidebarNav } from "@/components/layout/sidebar-nav" +import { RfqViewWithItems } from "@/db/schema/rfq" +import { formatDate } from "@/lib/utils" +import { Button } from "@/components/ui/button" +import { ArrowLeft } from "lucide-react" +import { RfqDashboardView } from "@/db/schema" +import { findBRfqById } from "@/lib/b-rfq/service" + +export const metadata: Metadata = { + title: "견적 RFQ 상세", +} + +export default async function RfqLayout({ + children, + params, +}: { + children: React.ReactNode + params: { lng: string, id: string } +}) { + + // 1) URL 파라미터에서 id 추출, Number로 변환 + const resolvedParams = await params + const lng = resolvedParams.lng + const id = resolvedParams.id + + const idAsNumber = Number(id) + // 2) DB에서 해당 협력업체 정보 조회 + const rfq: RfqDashboardView | null = await findBRfqById(idAsNumber) + + // 3) 사이드바 메뉴 + const sidebarNavItems = [ + { + title: "견적/입찰 문서관리", + href: `/${lng}/evcp/b-rfq/${id}`, + }, + { + title: "Initial RFQ 발송", + href: `/${lng}/evcp/b-rfq/${id}/initial`, + }, + { + title: "Final RFQ 발송", + href: `/${lng}/evcp/b-rfq/${id}/final`, + }, + + ] + + return ( + <> +
+
+
+
+ + + +
+
+ {/* 4) 협력업체 정보가 있으면 코드 + 이름 + "상세 정보" 표기 */} +

+ {rfq + ? `${rfq.rfqCode ?? ""} | ${rfq.packageNo ?? ""} | ${rfq.packageName ?? ""}` + : "Loading RFQ..."} +

+ +

+ PR발행 전 RFQ를 생성하여 관리하는 화면입니다. +

+

Due Date:{rfq && rfq?.dueDate && {formatDate(rfq?.dueDate)}}

+
+ +
+ +
{children}
+
+
+
+
+ + ) +} \ No newline at end of file diff --git a/app/[lng]/evcp/(evcp)/b-rfq/[id]/page.tsx b/app/[lng]/evcp/(evcp)/b-rfq/[id]/page.tsx new file mode 100644 index 00000000..e8820af5 --- /dev/null +++ b/app/[lng]/evcp/(evcp)/b-rfq/[id]/page.tsx @@ -0,0 +1,54 @@ +import { Separator } from "@/components/ui/separator" +import { type SearchParams } from "@/types/table" +import { getValidFilters } from "@/lib/data-table" + +interface IndexPageProps { + // Next.js 13 App Router에서 기본으로 주어지는 객체들 + params: { + lng: string + id: string + } + searchParams: Promise +} + +export default async function RfqPage(props: IndexPageProps) { + const resolvedParams = await props.params + const lng = resolvedParams.lng + const id = resolvedParams.id + + const idAsNumber = Number(id) + + console.log(idAsNumber) + + // 2) SearchParams 파싱 (Zod) + // - "filters", "page", "perPage", "sort" 등 contact 전용 컬럼 + const searchParams = await props.searchParams + // const search = searchParamsMatchedVCache.parse(searchParams) + // const validFilters = getValidFilters(search.filters) + + // const promises = Promise.all([ + // getMatchedVendors({ + // ...search, + // filters: validFilters, + // }, + // idAsNumber) + // ]) + + // 4) 렌더링 + return ( +
+
+

+ 견적 RFQ 문서관리 +

+

+ 설계로부터 받은 RFQ 문서와 구매 RFQ 문서를 관리하고 Vendor 회신을 점검/관리하는 화면입니다. +

+
+ +
+ {/* */} +
+
+ ) +} \ No newline at end of file diff --git a/app/[lng]/evcp/(evcp)/b-rfq/page.tsx b/app/[lng]/evcp/(evcp)/b-rfq/page.tsx new file mode 100644 index 00000000..213e9127 --- /dev/null +++ b/app/[lng]/evcp/(evcp)/b-rfq/page.tsx @@ -0,0 +1,78 @@ +import * as React from "react" +import { Metadata } from "next" +import { type SearchParams } from "@/types/table" +import { getValidFilters } from "@/lib/data-table" +import { Shell } from "@/components/shell" +import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton" +import { searchParamsRFQDashboardCache } from "@/lib/b-rfq/validations" +import { getRFQDashboard } from "@/lib/b-rfq/service" +import { RFQDashboardTable } from "@/lib/b-rfq/summary-table/summary-rfq-table" + +export const metadata: Metadata = { + title: "견적 RFQ", + description: "", +} + +interface PQReviewPageProps { + searchParams: Promise +} + +export default async function PQReviewPage(props: PQReviewPageProps) { + const searchParams = await props.searchParams + const search = searchParamsRFQDashboardCache.parse(searchParams) + const validFilters = getValidFilters(search.filters) + + // 기본 필터 처리 (통일된 이름 사용) + let basicFilters = [] + if (search.basicFilters && search.basicFilters.length > 0) { + basicFilters = search.basicFilters + console.log("Using search.basicFilters:", basicFilters); + } else { + console.log("No basic filters found"); + } + + // 모든 필터를 합쳐서 처리 + const allFilters = [...validFilters, ...basicFilters] + + // 조인 연산자도 통일된 이름 사용 + const joinOperator = search.basicJoinOperator || search.joinOperator || 'and'; + + // Promise.all로 감싸서 전달 + const promises = Promise.all([ + getRFQDashboard({ + ...search, + filters: allFilters, + joinOperator, + }) + ]) + + return ( + +
+
+
+

+ 견적 RFQ +

+
+
+
+ + {/* Items처럼 직접 테이블 렌더링 */} + + } + > + + +
+ ) +} \ No newline at end of file diff --git a/app/[lng]/partners/(partners)/document-list/[contractId]/page.tsx b/app/[lng]/partners/(partners)/document-list/[contractId]/page.tsx index 80621682..ef0778aa 100644 --- a/app/[lng]/partners/(partners)/document-list/[contractId]/page.tsx +++ b/app/[lng]/partners/(partners)/document-list/[contractId]/page.tsx @@ -39,7 +39,7 @@ export default async function DocumentListPage(props: IndexPageProps) { return (
- +
) diff --git a/app/[lng]/partners/ocr/layout.tsx b/app/[lng]/partners/ocr/layout.tsx new file mode 100644 index 00000000..f1654bf2 --- /dev/null +++ b/app/[lng]/partners/ocr/layout.tsx @@ -0,0 +1,17 @@ +import { ReactNode } from 'react'; +import { SiteFooter } from '@/components/layout/Footer'; +import { HeaderSimple } from '@/components/layout/HeaderSimple'; + +export default function EvcpLayout({ children }: { children: ReactNode }) { + return ( +
+ +
+
+ {children} +
+
+ +
+ ); +} \ No newline at end of file diff --git a/app/[lng]/partners/ocr/page.tsx b/app/[lng]/partners/ocr/page.tsx index b75df420..7a12b75d 100644 --- a/app/[lng]/partners/ocr/page.tsx +++ b/app/[lng]/partners/ocr/page.tsx @@ -72,7 +72,7 @@ export default async function IndexPage(props: IndexPageProps) {

- RFQ + Welding OCR

@@ -102,10 +102,10 @@ export default async function IndexPage(props: IndexPageProps) {

- RFQ + Welding OCR

- RFQ를 응답하고 커뮤니케이션을 할 수 있습니다. + PDF 파일을 업로드하면 테이블에 값이 삽입됩니다.

diff --git a/app/api/ocr/enhanced/route.ts b/app/api/ocr/enhanced/route.ts index 14a81399..06cea358 100644 --- a/app/api/ocr/enhanced/route.ts +++ b/app/api/ocr/enhanced/route.ts @@ -1,13 +1,15 @@ +// ============================================================================ // app/api/ocr/rotation-enhanced/route.ts -// DB 저장 기능이 추가된 회전 감지 및 테이블 추출 API +// 최적화된 OCR API - 통합 처리로 API 호출 최소화 +// ============================================================================ import { NextRequest, NextResponse } from 'next/server'; import { v4 as uuidv4 } from 'uuid'; -import db from '@/db/db'; // DB 인스턴스 import -import { - ocrSessions, - ocrTables, - ocrRows, +import db from '@/db/db'; +import { + ocrSessions, + ocrTables, + ocrRows, ocrRotationAttempts, type NewOcrSession, type NewOcrTable, @@ -17,20 +19,36 @@ import { type ExtractedRow } from '@/db/schema/ocr'; import { extractTablesFromOCR, analyzeOCRQuality } from '../utils/tableExtraction'; -import { - rotateImageBase64, - enhanceImageQuality, - convertPDFToImage, - needsRotation +import { + rotateImageBase64, + enhanceImageQuality, + convertPDFToImage, + needsRotation, + normalizeImageFormat, + validateBase64Image, + getPDFPageCount, + detectTextOrientation } from '../utils/imageRotation'; - -interface RotationTestResult { - rotation: number; +import { getServerSession } from "next-auth/next" +import { authOptions } from "@/app/api/auth/[...nextauth]/route" +import { sql } from 'drizzle-orm'; +import sharp from 'sharp'; + +interface PageRotationInfo { + pageIndex: number; + optimalRotation: number; confidence: number; - tablesFound: number; - textQuality: number; - keywordCount: number; - extractedTables?: ExtractedRow[][]; + needsRotationCheck: boolean; +} + +interface OptimizedProcessingResult { + success: boolean; + sessionId: string; + extractedTables: ExtractedRow[][]; + totalApiCalls: number; + processingTime: number; + pageRotations: PageRotationInfo[]; + warnings: string[]; } interface ProcessingResult { @@ -45,6 +63,16 @@ interface ProcessingResult { bestRotation: number; imageEnhanced: boolean; pdfConverted: boolean; + pagesProcessed?: number; + totalApiCalls: number; + pageDetails?: Array<{ + pageIndex: number; + rotation: number; + tablesFound: number; + rowsFound: number; + confidence: number; + processingTime: number; + }>; }; error?: string; warnings?: string[]; @@ -54,17 +82,29 @@ export async function POST(request: NextRequest) { const startTime = Date.now(); const warnings: string[] = []; let sessionId: string | null = null; + let file: File | null = null; try { - console.log('🔄 Starting rotation-enhanced OCR processing...'); - + console.log('🚀 === STARTING OPTIMIZED OCR PROCESSING ==='); + + const session = await getServerSession(authOptions); + if (!session?.user) { + return NextResponse.json( + { success: false, message: "인증이 필요합니다" }, + { status: 401 } + ) + } + + const userId = parseInt(session.user.id) + + // formData 한 번만 읽기 const formData = await request.formData(); - const file = formData.get('file') as File; - + file = formData.get('file') as File; + if (!file) { - return NextResponse.json({ - success: false, - error: 'No file provided' + return NextResponse.json({ + success: false, + error: 'No file provided' }, { status: 400 }); } @@ -72,16 +112,16 @@ export async function POST(request: NextRequest) { // 파일 검증 if (!file.type.includes('pdf') && !file.type.includes('image')) { - return NextResponse.json({ - success: false, - error: 'Invalid file type. Only PDF and image files are supported.' + return NextResponse.json({ + success: false, + error: 'Invalid file type. Only PDF and image files are supported.' }, { status: 400 }); } if (file.size > 10 * 1024 * 1024) { // 10MB 제한 - return NextResponse.json({ - success: false, - error: 'File size too large. Maximum size is 10MB.' + return NextResponse.json({ + success: false, + error: 'File size too large. Maximum size is 10MB.' }, { status: 400 }); } @@ -90,54 +130,35 @@ export async function POST(request: NextRequest) { const fileBuffer = Buffer.from(buffer); const fileformat = file.type.includes('pdf') ? 'pdf' : 'image'; - let base64: string; - let imageEnhanced = false; - let pdfConverted = false; + let processingResult: OptimizedProcessingResult; - // PDF vs 이미지 처리 if (fileformat === 'pdf') { - console.log('📄 Converting PDF to high-quality image...'); - base64 = await convertPDFToImage(fileBuffer, 0); - pdfConverted = true; + console.log('📄 Processing PDF with optimized approach...'); + processingResult = await processPDFOptimized(fileBuffer, file.name); } else { - base64 = fileBuffer.toString('base64'); - - // 이미지 품질 개선 - console.log('🎨 Enhancing image quality...'); - base64 = await enhanceImageQuality(base64); - imageEnhanced = true; - } - - // 회전 테스트 수행 - console.log('🔍 Testing multiple rotations...'); - const rotationResults = await tryMultipleRotations(base64, file.name); - - // 최적 회전 각도 선택 - const bestResult = findBestRotation(rotationResults); - console.log(`✅ Best rotation found: ${bestResult.rotation}° (score: ${bestResult.score?.toFixed(2)})`); - - if (bestResult.rotation !== 0) { - warnings.push(`Document was auto-rotated ${bestResult.rotation}° for optimal OCR results`); + console.log('🖼️ Processing single image with optimized approach...'); + processingResult = await processImageOptimized(fileBuffer, file.name); } - // 최적 결과 사용 - const finalTables = bestResult.extractedTables || []; - const totalRows = finalTables.reduce((sum, table) => sum + table.length, 0); const processingTime = Date.now() - startTime; - // 🗃️ DB에 저장 + console.log(`\n📊 === PROCESSING SUMMARY ===`); + console.log(`Total API calls: ${processingResult.totalApiCalls} (optimized!)`); + console.log(`Total tables found: ${processingResult.extractedTables.length}`); + console.log(`Total rows extracted: ${processingResult.extractedTables.reduce((sum, table) => sum + table.length, 0)}`); + console.log(`Total processing time: ${(processingTime / 1000).toFixed(1)}s`); + + // DB에 저장 console.log('💾 Saving results to database...'); sessionId = await saveToDatabase({ + userId, file, fileformat, processingTime, - bestRotation: bestResult.rotation, - finalTables, - totalRows, - rotationResults, - imageEnhanced, - pdfConverted, - warnings + extractedTables: processingResult.extractedTables, + pageRotations: processingResult.pageRotations, + totalApiCalls: processingResult.totalApiCalls, + warnings: [...warnings, ...processingResult.warnings] }); console.log(`⏱️ Processing completed in ${(processingTime / 1000).toFixed(1)}s, saved as session ${sessionId}`); @@ -146,41 +167,48 @@ export async function POST(request: NextRequest) { success: true, sessionId, metadata: { - totalTables: finalTables.length, - totalRows, + totalTables: processingResult.extractedTables.length, + totalRows: processingResult.extractedTables.reduce((sum, table) => sum + table.length, 0), processingTime, fileName: file.name, fileSize: file.size, - bestRotation: bestResult.rotation, - imageEnhanced, - pdfConverted + bestRotation: processingResult.pageRotations[0]?.optimalRotation || 0, + imageEnhanced: fileformat === 'image', + pdfConverted: fileformat === 'pdf', + pagesProcessed: processingResult.pageRotations.length, + totalApiCalls: processingResult.totalApiCalls, + pageDetails: processingResult.pageRotations.map(p => ({ + pageIndex: p.pageIndex, + rotation: p.optimalRotation, + tablesFound: 0, // 통합 처리로 인해 페이지별 세부사항은 후처리에서 계산 + rowsFound: 0, + confidence: p.confidence, + processingTime: 0 + })) }, - warnings: warnings.length > 0 ? warnings : undefined + warnings: [...warnings, ...processingResult.warnings].length > 0 ? [...warnings, ...processingResult.warnings] : undefined }; - + return NextResponse.json(result); } catch (error) { console.error('❌ OCR processing error:', error); - + const processingTime = Date.now() - startTime; - - // 에러 발생시에도 세션 저장 (실패 기록) - if (!sessionId) { + + // 에러 발생시에도 세션 저장 + if (!sessionId && file) { try { - const errorFile = await request.formData().then(fd => fd.get('file') as File); - if (errorFile) { - sessionId = await saveErrorToDatabase({ - file: errorFile, - processingTime, - error: error instanceof Error ? error.message : 'Unknown error occurred' - }); - } + sessionId = await saveErrorToDatabase({ + file, + processingTime, + error: error instanceof Error ? error.message : 'Unknown error occurred' + }); } catch (dbError) { console.error('Failed to save error to database:', dbError); } } - + return NextResponse.json({ success: false, sessionId: sessionId || null, @@ -189,117 +217,582 @@ export async function POST(request: NextRequest) { processingTime, totalTables: 0, totalRows: 0, - fileName: '', - fileSize: 0, + fileName: file?.name || '', + fileSize: file?.size || 0, bestRotation: 0, imageEnhanced: false, - pdfConverted: false + pdfConverted: false, + totalApiCalls: 0 } }, { status: 500 }); } } -// DB 저장 함수 +// PDF 최적화 처리 - 통합 방식 +async function processPDFOptimized( + fileBuffer: Buffer, + fileName: string +): Promise { + console.log('🚀 === OPTIMIZED PDF PROCESSING ==='); + + const warnings: string[] = []; + + try { + // 1단계: 페이지 수 확인 + const pageCount = await getPDFPageCount(fileBuffer); + console.log(`📊 PDF contains ${pageCount} pages`); + + // 2단계: 각 페이지의 최적 회전각 결정 (OCR API 호출 없이) + const pageRotations = await determineOptimalRotations(fileBuffer, pageCount); + console.log('🧭 Optimal rotations determined:', pageRotations.map(p => `Page ${p.pageIndex + 1}: ${p.optimalRotation}°`)); + + // 3단계: 처리 방식 결정 + if (shouldProcessAsWhole(pageCount, fileBuffer.length)) { + console.log('📋 Processing as single combined document...'); + const result = await processAsWholePDF(fileBuffer, pageRotations, fileName); + return { + success: true, + sessionId: '', + extractedTables: result.extractedTables, + totalApiCalls: 1, // 🎉 단 1번의 API 호출! + processingTime: Date.now(), + pageRotations, + warnings: [...warnings, ...result.warnings] + }; + } else { + console.log('📄 Processing pages individually with optimal rotations...'); + const result = await processPageByPageOptimized(fileBuffer, pageRotations, fileName); + return { + success: true, + sessionId: '', + extractedTables: result.extractedTables, + totalApiCalls: pageCount, // 페이지 수만큼만 호출 + processingTime: Date.now(), + pageRotations, + warnings: [...warnings, ...result.warnings] + }; + } + + } catch (error) { + console.error('❌ PDF processing failed:', error); + throw error; + } +} + +// 이미지 최적화 처리 +async function processImageOptimized( + fileBuffer: Buffer, + fileName: string +): Promise { + console.log('🖼️ === OPTIMIZED IMAGE PROCESSING ==='); + + const warnings: string[] = []; + + try { + let base64 = fileBuffer.toString('base64'); + + // 원본 이미지 검증 + const originalValidation = validateBase64Image(base64); + if (!originalValidation.isValid) { + throw new Error(`Invalid image file: ${originalValidation.error}`); + } + + console.log(`✅ Original image valid: ${originalValidation.size} bytes`); + + // 이미지 품질 개선 + console.log('🎨 Enhancing image quality...'); + base64 = await enhanceImageQuality(base64); + + // 최적 회전각 결정 (OCR API 호출 없이) + const optimalRotation = await detectTextOrientation(base64); + console.log(`🧭 Optimal rotation detected: ${optimalRotation}°`); + + // 최적 회전 적용 + if (optimalRotation !== 0) { + console.log(`🔄 Applying optimal rotation: ${optimalRotation}°...`); + base64 = await rotateImageBase64(base64, optimalRotation); + warnings.push(`Image was auto-rotated ${optimalRotation}° for optimal OCR results`); + } + + // 단 1번의 OCR API 호출 + console.log('🌐 Single OCR API call for optimized image...'); + const ocrResult = await callOCRAPI(base64, 'jpg', fileName); + + // 결과 처리 + const reportNo = extractReportNo(ocrResult); + const analysis = analyzeOCRQuality(ocrResult); + const rawTables = await extractTablesFromOCR(ocrResult) as BaseExtractedRow[][]; + + const extractedTables: ExtractedRow[][] = rawTables.map(table => + table.map(row => ({ + ...row, + reportNo + })) + ); + + const pageRotations: PageRotationInfo[] = [{ + pageIndex: 0, + optimalRotation, + confidence: analysis.confidence, + needsRotationCheck: optimalRotation !== 0 + }]; + + return { + success: true, + sessionId: '', + extractedTables, + totalApiCalls: 1, // 단 1번의 API 호출! + processingTime: Date.now(), + pageRotations, + warnings + }; + + } catch (error) { + console.error('❌ Image processing failed:', error); + throw error; + } +} + +// 페이지별 최적 회전각 결정 (OCR API 없이) +async function determineOptimalRotations( + fileBuffer: Buffer, + pageCount: number +): Promise { + console.log('🔍 Determining optimal rotations without OCR calls...'); + + const rotations: PageRotationInfo[] = []; + + for (let pageIndex = 0; pageIndex < pageCount; pageIndex++) { + try { + console.log(` 📄 Analyzing page ${pageIndex + 1}...`); + + // 저해상도로 빠르게 변환 (150 DPI - 품질과 속도의 균형) + const lowResBase64 = await convertPDFToImage(fileBuffer, pageIndex, 150); + + // 회전 필요성 확인 + const needsRotationCheck = await needsRotation(lowResBase64); + + let optimalRotation = 0; + let confidence = 1.0; + + if (needsRotationCheck) { + console.log(` 🔄 Page ${pageIndex + 1} needs rotation analysis...`); + // 이미지 분석 기반 회전 감지 + optimalRotation = await detectTextOrientation(lowResBase64); + confidence = await calculateRotationConfidence(lowResBase64, optimalRotation); + } else { + console.log(` ✅ Page ${pageIndex + 1} appears correctly oriented`); + } + + rotations.push({ + pageIndex, + optimalRotation, + confidence, + needsRotationCheck + }); + + console.log(` 📊 Page ${pageIndex + 1}: ${optimalRotation}° rotation (confidence: ${(confidence * 100).toFixed(1)}%)`); + + } catch (error) { + console.warn(` ⚠️ Page ${pageIndex + 1}: rotation detection failed, using 0°`); + rotations.push({ + pageIndex, + optimalRotation: 0, + confidence: 0.5, + needsRotationCheck: false + }); + } + } + + return rotations; +} + +// 회전 신뢰도 계산 +async function calculateRotationConfidence( + base64: string, + rotation: number +): Promise { + try { + const rotatedBase64 = await rotateImageBase64(base64, rotation); + + // 이미지 품질 지표들을 분석하여 신뢰도 계산 + const cleanBase64 = rotatedBase64.replace(/^data:image\/[a-z]+;base64,/, ''); + const buffer = Buffer.from(cleanBase64, 'base64'); + + const stats = await sharp(buffer) + .greyscale() + .stats(); + + const contrast = stats.channels[0].max - stats.channels[0].min; + const sharpness = stats.channels[0].stdev; + + // 대비와 선명도를 기반으로 신뢰도 계산 + const confidence = Math.min((contrast + sharpness) / 400, 1.0); + + return confidence; + + } catch (error) { + console.warn('Failed to calculate rotation confidence:', error); + return 0.5; + } +} + +// 처리 방식 결정 +function shouldProcessAsWhole(pageCount: number, fileSize: number): boolean { + // 조건: + // 1. 파일 크기가 8MB 이하 + // 2. 페이지 수가 5개 이하 + // 3. 모든 페이지가 동일한 회전각을 갖는 경우 우선 고려 + + const maxSizeForWhole = 8 * 1024 * 1024; // 8MB + const maxPagesForWhole = 5; + + const sizeOk = fileSize <= maxSizeForWhole; + const pagesOk = pageCount <= maxPagesForWhole; + + console.log(`📋 Processing decision: size(${sizeOk}) + pages(${pagesOk}) = ${sizeOk && pagesOk ? 'WHOLE' : 'INDIVIDUAL'}`); + + return sizeOk && pagesOk; +} + +// 전체 PDF를 하나로 처리 +async function processAsWholePDF( + fileBuffer: Buffer, + pageRotations: PageRotationInfo[], + fileName: string +): Promise<{ + extractedTables: ExtractedRow[][]; + warnings: string[]; +}> { + console.log('🔄 Creating single combined image with corrected rotations...'); + + const warnings: string[] = []; + + try { + // 각 페이지를 올바른 회전으로 변환하여 이미지 배열 생성 + const pageImages: string[] = []; + + for (const pageInfo of pageRotations) { + console.log(` 📄 Processing page ${pageInfo.pageIndex + 1} with ${pageInfo.optimalRotation}° rotation...`); + + // 고해상도로 변환 + let pageBase64 = await convertPDFToImage(fileBuffer, pageInfo.pageIndex, 300); + + // 필요시 회전 적용 + if (pageInfo.optimalRotation !== 0) { + pageBase64 = await rotateImageBase64(pageBase64, pageInfo.optimalRotation); + warnings.push(`Page ${pageInfo.pageIndex + 1} was rotated ${pageInfo.optimalRotation}° for optimal results`); + } + + pageImages.push(pageBase64); + } + + // 모든 페이지를 하나의 긴 이미지로 합치기 + console.log('🖼️ Combining all pages into single image...'); + const combinedBase64 = await combineImagesVertically(pageImages); + + // 한 번의 OCR API 호출 + console.log('🌐 Single OCR API call for entire combined document...'); + const ocrResult = await callOCRAPI(combinedBase64, 'jpg', `combined_${fileName}`); + + // 결과 처리 + const reportNo = extractReportNo(ocrResult); + const rawTables = await extractTablesFromOCR(ocrResult) as BaseExtractedRow[][]; + + const extractedTables: ExtractedRow[][] = rawTables.map(table => + table.map(row => ({ + ...row, + reportNo + })) + ); + + console.log(`✅ Combined processing complete: ${extractedTables.length} tables found`); + + return { + extractedTables, + warnings + }; + + } catch (error) { + console.error('❌ Whole PDF processing failed:', error); + throw error; + } +} + +// 페이지별 최적화 처리 +async function processPageByPageOptimized( + fileBuffer: Buffer, + pageRotations: PageRotationInfo[], + fileName: string +): Promise<{ + extractedTables: ExtractedRow[][]; + warnings: string[]; +}> { + console.log('📄 Processing pages individually with predetermined rotations...'); + + const allTables: ExtractedRow[][] = []; + const warnings: string[] = []; + + for (const pageInfo of pageRotations) { + try { + console.log(` 📄 Processing page ${pageInfo.pageIndex + 1} (${pageInfo.optimalRotation}° rotation)...`); + + // 고해상도로 변환 + let pageBase64 = await convertPDFToImage(fileBuffer, pageInfo.pageIndex, 300); + + // 미리 결정된 회전각 적용 + if (pageInfo.optimalRotation !== 0) { + pageBase64 = await rotateImageBase64(pageBase64, pageInfo.optimalRotation); + warnings.push(`Page ${pageInfo.pageIndex + 1} was rotated ${pageInfo.optimalRotation}° for optimal results`); + } + + // 단 1번의 OCR API 호출 (회전 테스트 없이) + console.log(` 🌐 OCR API call for page ${pageInfo.pageIndex + 1}...`); + const ocrResult = await callOCRAPI(pageBase64, 'jpg', `${fileName}_page_${pageInfo.pageIndex + 1}`); + + // 결과 처리 + const reportNo = extractReportNo(ocrResult); + const rawTables = await extractTablesFromOCR(ocrResult) as BaseExtractedRow[][]; + + const pageTables: ExtractedRow[][] = rawTables.map(table => + table.map(row => ({ + ...row, + reportNo + })) + ); + + allTables.push(...pageTables); + + console.log(` ✅ Page ${pageInfo.pageIndex + 1}: ${pageTables.length} tables found`); + + } catch (error) { + console.error(` ❌ Error processing page ${pageInfo.pageIndex + 1}:`, error); + warnings.push(`Page ${pageInfo.pageIndex + 1} processing failed: ${error instanceof Error ? error.message : 'Unknown error'}`); + } + } + + return { + extractedTables: allTables, + warnings + }; +} + +// 이미지들을 세로로 합치기 +async function combineImagesVertically(base64Images: string[]): Promise { + console.log(`🖼️ Combining ${base64Images.length} images vertically...`); + + try { + if (base64Images.length === 0) { + throw new Error('No images to combine'); + } + + if (base64Images.length === 1) { + return base64Images[0]; + } + + // 각 이미지를 Sharp 객체로 변환 + const imageBuffers = base64Images.map(base64 => { + const cleanBase64 = base64.replace(/^data:image\/[a-z]+;base64,/, ''); + return Buffer.from(cleanBase64, 'base64'); + }); + + // 첫 번째 이미지의 메타데이터 확인 + const firstImage = sharp(imageBuffers[0]); + const firstMetadata = await firstImage.metadata(); + + if (!firstMetadata.width || !firstMetadata.height) { + throw new Error('Invalid first image metadata'); + } + + const targetWidth = firstMetadata.width; + let totalHeight = firstMetadata.height; + + // 나머지 이미지들의 높이 계산 (같은 너비로 리사이즈) + const resizedBuffers = [imageBuffers[0]]; + + for (let i = 1; i < imageBuffers.length; i++) { + const img = sharp(imageBuffers[i]); + const metadata = await img.metadata(); + + if (metadata.width && metadata.height) { + const aspectRatio = metadata.height / metadata.width; + const newHeight = Math.round(targetWidth * aspectRatio); + + const resizedBuffer = await img + .resize(targetWidth, newHeight) + .jpeg({ quality: 90 }) + .toBuffer(); + + resizedBuffers.push(resizedBuffer); + totalHeight += newHeight; + + console.log(` 📏 Image ${i + 1}: ${metadata.width}x${metadata.height} → ${targetWidth}x${newHeight}`); + } + } + + console.log(` 📊 Combined size will be: ${targetWidth}x${totalHeight}`); + + // 빈 캔버스 생성 + const combinedImage = sharp({ + create: { + width: targetWidth, + height: totalHeight, + channels: 3, + background: { r: 255, g: 255, b: 255 } + } + }); + + // 이미지들을 세로로 배치 + const composite = []; + let currentTop = 0; + + for (const buffer of resizedBuffers) { + composite.push({ + input: buffer, + top: currentTop, + left: 0 + }); + + const metadata = await sharp(buffer).metadata(); + currentTop += metadata.height || 0; + } + + const combinedBuffer = await combinedImage + .composite(composite) + .jpeg({ quality: 90 }) + .toBuffer(); + + const combinedBase64 = combinedBuffer.toString('base64'); + + console.log(`✅ Images combined successfully: ${combinedBuffer.length} bytes`); + + return combinedBase64; + + } catch (error) { + console.error('❌ Error combining images:', error); + throw new Error(`Failed to combine images: ${error instanceof Error ? error.message : 'Unknown error'}`); + } +} + +// DB 저장 함수 (업데이트됨) async function saveToDatabase({ + userId, file, fileformat, processingTime, - bestRotation, - finalTables, - totalRows, - rotationResults, - imageEnhanced, - pdfConverted, + extractedTables, + pageRotations, + totalApiCalls, warnings }: { + userId: number | string, file: File; fileformat: string; processingTime: number; - bestRotation: number; - finalTables: ExtractedRow[][]; - totalRows: number; - rotationResults: (RotationTestResult & { score?: number })[]; - imageEnhanced: boolean; - pdfConverted: boolean; + extractedTables: ExtractedRow[][]; + pageRotations: PageRotationInfo[]; + totalApiCalls: number; warnings: string[]; }): Promise { - + return await db.transaction(async (tx) => { - // 1. 세션 저장 + + // 1단계: 필터링된 행 수를 미리 계산 + const filteredTables = extractedTables.map(table => + table.filter(row => (!row.no || row.no.length < 10) && row.no !== "No." && row.weldingDate.length < 15 && row.jointType.length < 5) + ); + const totalTablesFiltered = filteredTables.length; + const totalRowsFiltered = filteredTables.reduce((sum, t) => sum + t.length, 0); + + // 2단계: 세션 저장 const sessionData: NewOcrSession = { fileName: file.name, fileSize: file.size, fileType: fileformat, processingTime, - bestRotation, - totalTables: finalTables.length, - totalRows, - imageEnhanced, - pdfConverted, + bestRotation: pageRotations[0]?.optimalRotation || 0, + totalTables: totalTablesFiltered, + totalRows: totalRowsFiltered, + imageEnhanced: fileformat === 'image', + pdfConverted: fileformat === 'pdf', success: true, - warnings: warnings.length > 0 ? warnings : null, + warnings: warnings.length ? warnings : null, }; - const [session] = await tx.insert(ocrSessions).values(sessionData).returning({ id: ocrSessions.id }); - const sessionId = session.id; + const [sessionTable] = await tx.insert(ocrSessions) + .values(sessionData) + .returning({ id: ocrSessions.id }); - // 2. 테이블들 저장 - const tableIds: string[] = []; - for (let tableIndex = 0; tableIndex < finalTables.length; tableIndex++) { - const table = finalTables[tableIndex]; - - const tableData: NewOcrTable = { + const sessionId = sessionTable.id; + + // 3단계: 테이블 & 행 저장 + for (let tableIndex = 0; tableIndex < filteredTables.length; tableIndex++) { + const table = filteredTables[tableIndex]; + + const [savedTable] = await tx.insert(ocrTables).values({ sessionId, tableIndex, rowCount: table.length, - }; - - const [savedTable] = await tx.insert(ocrTables).values(tableData).returning({ id: ocrTables.id }); - tableIds.push(savedTable.id); + }).returning({ id: ocrTables.id }); - // 3. 각 테이블의 행들 저장 if (table.length > 0) { const rowsData: NewOcrRow[] = table.map((row, rowIndex) => ({ tableId: savedTable.id, sessionId, rowIndex, - reportNo: row.reportNo || null, - no: row.no || null, - identificationNo: row.identificationNo || null, - tagNo: row.tagNo || null, - jointNo: row.jointNo || null, - jointType: row.jointType || null, - weldingDate: row.weldingDate || null, + reportNo: row.reportNo ?? null, + no: row.no ?? null, + identificationNo: row.identificationNo ?? null, + tagNo: row.tagNo ?? null, + jointNo: row.jointNo ?? null, + jointType: row.jointType ?? null, + weldingDate: row.weldingDate ?? null, confidence: row.confidence.toString(), sourceTable: row.sourceTable, sourceRow: row.sourceRow, + userId: userId.toString() })); - await tx.insert(ocrRows).values(rowsData); + console.log(`💾 Inserting ${rowsData.length} rows for table ${tableIndex}`); + + await tx.insert(ocrRows) + .values(rowsData) + .onConflictDoUpdate({ + target: [ocrRows.reportNo, ocrRows.no,ocrRows.no,ocrRows.tagNo,ocrRows.jointNo,ocrRows.jointType], // 🚀 변경: 두 컬럼만! + set: { + identificationNo: sql`EXCLUDED.identification_no`, + tagNo: sql`EXCLUDED.tag_no`, + jointNo: sql`EXCLUDED.joint_no`, + jointType: sql`EXCLUDED.joint_type`, + weldingDate: sql`EXCLUDED.welding_date`, + confidence: sql`EXCLUDED.confidence`, + sourceTable: sql`EXCLUDED.source_table`, + sourceRow: sql`EXCLUDED.source_row`, + userId: sql`EXCLUDED.user_id`, + }, + }); + + console.log(`✅ Successfully saved/updated ${rowsData.length} rows for table ${tableIndex}`); } } - // 4. 회전 시도 결과들 저장 - const rotationAttemptsData: NewOcrRotationAttempt[] = rotationResults.map((result) => { - const extractedRowsCount = result.extractedTables?.reduce((sum, table) => sum + table.length, 0) || 0; - - return { - sessionId, - rotation: result.rotation, - confidence: result.confidence.toString(), - tablesFound: result.tablesFound, - textQuality: result.textQuality.toString(), - keywordCount: result.keywordCount, - score: result.score?.toString() || '0', - extractedRowsCount, - }; - }); + // 4단계: 최적화된 회전 시도 결과 저장 + const rotationAttemptsData: NewOcrRotationAttempt[] = pageRotations.map((pageInfo) => ({ + sessionId, + rotation: pageInfo.optimalRotation, + confidence: pageInfo.confidence.toString(), + tablesFound: 0, // 통합 처리로 인해 개별 페이지별 테이블 수는 미상 + textQuality: pageInfo.confidence.toString(), + keywordCount: 0, + score: pageInfo.confidence.toString(), + extractedRowsCount: 0, + })); if (rotationAttemptsData.length > 0) { await tx.insert(ocrRotationAttempts).values(rotationAttemptsData); } - console.log(`✅ Successfully saved session ${sessionId} with ${finalTables.length} tables and ${totalRows} rows`); + console.log(`✅ Successfully saved optimized session ${sessionId} with ${totalTablesFiltered} tables and ${totalRowsFiltered} rows (${totalApiCalls} API calls)`); return sessionId; }); } @@ -314,7 +807,7 @@ async function saveErrorToDatabase({ processingTime: number; error: string; }): Promise { - + const sessionData: NewOcrSession = { fileName: file.name, fileSize: file.size, @@ -337,241 +830,150 @@ async function saveErrorToDatabase({ // OCR 결과에서 Report No 추출 function extractReportNo(ocrResult: any): string { try { - console.log('📊 Extracting Report No from OCR result...'); - - // OCR 결과에서 tables와 fields 모두 확인 - const allTexts: string[] = []; - - // tables에서 텍스트 추출 - if (ocrResult.images?.[0]?.tables) { - for (const table of ocrResult.images[0].tables) { - if (table.cells) { - for (const cell of table.cells) { - if (cell.cellTextLines) { - for (const textLine of cell.cellTextLines) { - if (textLine.cellWords) { - for (const word of textLine.cellWords) { - if (word.inferText) { - allTexts.push(word.inferText.trim()); - } - } - } - } - } - } - } - } - } - - // fields에서 텍스트 추출 - if (ocrResult.images?.[0]?.fields) { - for (const field of ocrResult.images[0].fields) { - if (field.inferText) { - allTexts.push(field.inferText.trim()); - } - } - } - - // Report No. 패턴을 찾기 - let reportNo = ''; - let foundReportNoLabel = false; - - for (let i = 0; i < allTexts.length; i++) { - const text = allTexts[i]; - - // "Report", "No.", "Report No." 등의 패턴 찾기 - if (text.toLowerCase().includes('report') && - (text.toLowerCase().includes('no') || - (i + 1 < allTexts.length && allTexts[i + 1].toLowerCase().includes('no')))) { - foundReportNoLabel = true; - console.log(`📋 Found Report No label at index ${i}: "${text}"`); - continue; - } - - // Report No 라벨 다음에 오는 값이나 특정 패턴 (예: SN2661FT20250526) 찾기 - if (foundReportNoLabel || /^[A-Z]{2}\d{4}[A-Z]{2}\d{8}$/.test(text)) { - // Report No 형식 패턴 체크 (예: SN2661FT20250526) - if (/^[A-Z]{2}\d{4}[A-Z]{2}\d{8}$/.test(text) || - /^[A-Z0-9]{10,20}$/.test(text)) { - reportNo = text; - console.log(`✅ Found Report No: "${reportNo}"`); - break; - } - } - } - - // 패턴이 없으면 더 관대한 검색 - if (!reportNo) { - // Report나 No 근처의 영숫자 조합 찾기 - for (let i = 0; i < allTexts.length; i++) { - const text = allTexts[i]; - if ((text.toLowerCase().includes('report') || text.toLowerCase().includes('no')) && - i + 1 < allTexts.length) { - const nextText = allTexts[i + 1]; - if (/^[A-Z0-9]{6,}$/.test(nextText)) { - reportNo = nextText; - console.log(`✅ Found Report No (fallback): "${reportNo}"`); - break; - } - } - } - } - - // 기본값 설정 - if (!reportNo) { - console.warn('⚠️ Could not extract Report No, using default'); - reportNo = 'UNKNOWN'; - } - - return reportNo; - - } catch (error) { - console.error('❌ Error extracting Report No:', error); - return 'UNKNOWN'; - } -} + const table = ocrResult.images?.[0]?.tables?.[0]; + if (!table?.cells?.length) return 'UNKNOWN'; -// 여러 회전 각도 테스트 -async function tryMultipleRotations(base64: string, filename: string): Promise<(RotationTestResult & { score?: number })[]> { - const rotations = [0, 90, 180, 270]; - const results: RotationTestResult[] = []; + const target = table.cells.find( + (c: any) => c.rowIndex === 0 && c.columnIndex === 3 + ); + if (!target) return 'UNKNOWN'; - console.log('🔍 Testing rotations with server-side image processing...'); + const reportNo = cellText(target).replace(/\s+/g, ''); + return reportNo || 'UNKNOWN'; - for (const rotation of rotations) { - try { - console.log(` Testing ${rotation}° rotation...`); - - // 🔄 서버 사이드에서 실제 이미지 회전 - const rotatedBase64 = await rotateImageBase64(base64, rotation); + } catch (e) { + console.error('extractReportNo 오류:', e); + return 'UNKNOWN'; + } - // OCR API 호출 - const ocrResult = await callOCRAPI(rotatedBase64, 'jpg', `${rotation}_${filename}`); + function cellText(cell: any): string { + return (cell.cellTextLines ?? []) + .flatMap((l: any) => + (l.cellWords ?? []).map((w: any) => (w.inferText ?? '').trim()) + ) + .join(' '); + } +} - console.log(ocrResult) - - // Report No 추출 - const reportNo = extractReportNo(ocrResult); - console.log(` ${rotation}°: Report No = "${reportNo}"`); - - const analysis = analyzeOCRQuality(ocrResult); - const rawTables = await extractTablesFromOCR(ocrResult) as BaseExtractedRow[][]; // 기존 함수 호출 - - // reportNo를 각 행에 추가 - const extractedTables: ExtractedRow[][] = rawTables.map(table => - table.map(row => ({ - ...row, - reportNo // reportNo 필드 추가 - })) - ); - - const result: RotationTestResult = { - rotation, - confidence: analysis.confidence, - tablesFound: analysis.tablesFound, - textQuality: analysis.textQuality, - keywordCount: analysis.keywordCount, - extractedTables - }; +// OCR API 호출 (기존과 동일) +async function callOCRAPI(base64: string, format: string, filename: string, rotation?: number): Promise { + console.log('🌐 === OCR API CALL DEBUG ==='); + console.log(`📁 Filename: ${filename}`); + console.log(`🔄 Rotation: ${rotation || 0}°`); + console.log(`📊 Format: ${format}`); + + const validation = validateBase64Image(base64); + if (!validation.isValid) { + throw new Error(`Invalid base64 data: ${validation.error}`); + } - results.push(result); - - const extractedRows = extractedTables.reduce((sum, table) => sum + table.length, 0); - console.log(` ${rotation}°: confidence=${(analysis.confidence * 100).toFixed(1)}%, tables=${analysis.tablesFound}, quality=${(analysis.textQuality * 100).toFixed(1)}%, keywords=${analysis.keywordCount}, rows=${extractedRows}`); - - } catch (error) { - console.warn(` ${rotation}°: Failed -`, error instanceof Error ? error.message : 'Unknown error'); - results.push({ - rotation, - confidence: 0, - tablesFound: 0, - textQuality: 0, - keywordCount: 0, - extractedTables: [] - }); - } + console.log(`✅ Base64 validation passed: ${validation.size} bytes`); + + if (validation.size! > 52428800) { + throw new Error(`Image too large: ${validation.size} bytes (max: 50MB)`); } - return results.map(result => ({ ...result, score: 0 })); // score는 findBestRotation에서 계산 -} + if (validation.size! < 1000) { + throw new Error(`Image too small: ${validation.size} bytes (min: 1KB)`); + } -// 최적 회전 각도 찾기 -function findBestRotation(results: (RotationTestResult & { score?: number })[]): RotationTestResult & { score?: number } { - console.log('🎯 Analyzing rotation results...'); - - const scoredResults = results.map(result => { - const extractedRows = result.extractedTables?.reduce((sum, table) => sum + table.length, 0) || 0; - - // 개선된 점수 계산 알고리즘 - let score = 0; - - // 1. OCR 신뢰도 (25%) - score += result.confidence * 0.25; - - // 2. 발견된 테이블 수 (25%) - score += Math.min(result.tablesFound / 3, 1) * 0.25; // 최대 3개 테이블까지 점수 - - // 3. 텍스트 품질 (20%) - score += result.textQuality * 0.20; - - // 4. 키워드 개수 (15%) - score += Math.min(result.keywordCount / 10, 1) * 0.15; // 최대 10개 키워드까지 점수 - - // 5. 추출된 행 수 (15%) - score += Math.min(extractedRows / 20, 1) * 0.15; // 최대 20행까지 점수 - - // 보너스: 실제 데이터가 추출된 경우 - if (extractedRows > 0) { - score += 0.1; // 10% 보너스 - } - - console.log(` ${result.rotation}°: score=${score.toFixed(3)} (conf=${(result.confidence * 100).toFixed(1)}%, tables=${result.tablesFound}, quality=${(result.textQuality * 100).toFixed(1)}%, keywords=${result.keywordCount}, rows=${extractedRows})`); - - return { ...result, score }; - }); + const ocrSecretKey = process.env.OCR_SECRET_KEY; + if (!ocrSecretKey) { + throw new Error('OCR_SECRET_KEY environment variable is not set'); + } - const bestResult = scoredResults.reduce((best, current) => - current.score > best.score ? current : best - ); + let processedBase64: string; + try { + console.log('🔧 Normalizing image format...'); + processedBase64 = await normalizeImageFormat(base64); + console.log('✅ Image format normalized to JPEG'); + } catch (error) { + console.warn('⚠️ Format normalization failed, using original:', error); + processedBase64 = base64.replace(/^data:image\/[a-z]+;base64,/, ''); + } - console.log(`🏆 Winner: ${bestResult.rotation}° with score ${bestResult.score?.toFixed(3)}`); - - return bestResult; -} + const requestId = uuidv4(); + const timestamp = Math.floor(Date.now() / 1000); -// OCR API 호출 -async function callOCRAPI(base64: string, format: string, filename: string, rotation?: number): Promise { const ocrBody = { version: "V2", - requestId: uuidv4(), - timestamp: Math.floor(Date.now() / 1000), + requestId, + timestamp, lang: "ko", images: [{ - format, + format: "jpg", url: null, - data: base64, + data: processedBase64, name: filename, ...(rotation !== undefined && rotation !== 0 && { rotation }) }], enableTableDetection: true }; - const response = await fetch( - "https://n4a9z5rb5r.apigw.ntruss.com/custom/v1/35937/41dcc5202686a37ee5f4fae85bd07f599e3627e9c00d33bf6e469f409fe0ca62/general", - { + console.log('📤 Request details:', { + requestId, + timestamp, + dataSize: processedBase64.length, + enableTableDetection: ocrBody.enableTableDetection, + hasRotation: rotation !== undefined && rotation !== 0 + }); + + const apiUrl = "https://n4a9z5rb5r.apigw.ntruss.com/custom/v1/35937/41dcc5202686a37ee5f4fae85bd07f599e3627e9c00d33bf6e469f409fe0ca62/general"; + + try { + console.log('🚀 Sending OCR request...'); + + const response = await fetch(apiUrl, { method: 'POST', headers: { 'Content-Type': 'application/json', - 'X-OCR-SECRET': process.env.OCR_SECRET_KEY || '', + 'X-OCR-SECRET': ocrSecretKey, }, body: JSON.stringify(ocrBody), - signal: AbortSignal.timeout(60000) // 60초 타임아웃 + signal: AbortSignal.timeout(60000) + }); + + console.log(`📨 Response: ${response.status} ${response.statusText}`); + + if (!response.ok) { + const errorText = await response.text(); + console.error(`❌ OCR API Error: ${errorText}`); + + let parsedError; + try { + parsedError = JSON.parse(errorText); + } catch { + parsedError = { message: errorText }; + } + + if (parsedError.code === "0011") { + throw new Error(`Image data size error: ${parsedError.message} (actual size: ${validation.size} bytes)`); + } else if (response.status === 401) { + throw new Error('Authentication failed - check OCR_SECRET_KEY'); + } else if (response.status === 403) { + throw new Error('Access forbidden - check API permissions'); + } else if (response.status === 429) { + throw new Error('Rate limit exceeded - too many requests'); + } + + throw new Error(`OCR API error: ${response.status} ${response.statusText} - ${errorText}`); } - ); - if (!response.ok) { - throw new Error(`OCR API error: ${response.status} ${response.statusText}`); - } + const result = await response.json(); + console.log('✅ OCR API Success!'); + console.log('📊 Response structure:', { + hasImages: !!result.images, + imageCount: result.images?.length || 0, + firstImageHasTables: !!result.images?.[0]?.tables, + firstImageTableCount: result.images?.[0]?.tables?.length || 0, + firstImageHasFields: !!result.images?.[0]?.fields, + firstImageFieldCount: result.images?.[0]?.fields?.length || 0 + }); + + return result; - return response.json(); + } catch (error) { + console.error('💥 OCR API Call Failed:', error); + throw error; + } } \ No newline at end of file diff --git a/app/api/ocr/utils/imageRotation.ts b/app/api/ocr/utils/imageRotation.ts index fe9cf840..6d59dace 100644 --- a/app/api/ocr/utils/imageRotation.ts +++ b/app/api/ocr/utils/imageRotation.ts @@ -1,244 +1,427 @@ +// ============================================================================ // app/api/ocr/utils/imageRotation.ts -// Sharp을 사용한 서버 사이드 이미지 회전 +// PDF 페이지 처리 기능이 추가된 이미지 회전 유틸리티 +// ============================================================================ import sharp from 'sharp'; +import { promises as fs } from 'fs'; +import path from 'path'; +import { randomUUID } from 'crypto'; +import { execFile } from 'child_process'; +import { promisify } from 'util'; +import { tmpdir } from 'os'; + +const exec = promisify(execFile); /** - * 서버 사이드에서 이미지를 회전시킵니다 - * @param base64 - base64 인코딩된 이미지 데이터 - * @param degrees - 회전 각도 (0, 90, 180, 270) - * @returns Promise - 회전된 이미지의 base64 데이터 + * PDF 페이지 수를 확인하는 함수 */ -export async function rotateImageBase64(base64: string, degrees: number): Promise { +export async function getPDFPageCount(pdfBuffer: Buffer): Promise { + const tmp = tmpdir(); + const id = randomUUID(); + const pdfPath = path.join(tmp, `${id}.pdf`); + try { - console.log(`🔄 Rotating image by ${degrees} degrees...`); + await fs.writeFile(pdfPath, pdfBuffer); - // base64를 Buffer로 변환 - const inputBuffer = Buffer.from(base64, 'base64'); + // pdfinfo 명령어로 페이지 수 확인 + const { stdout } = await exec('pdfinfo', [pdfPath]); + const pageMatch = stdout.match(/Pages:\s+(\d+)/); + const pageCount = pageMatch ? parseInt(pageMatch[1]) : 1; - // 회전 각도에 따른 처리 - let rotatedBuffer: Buffer; - - switch (degrees) { - case 0: - // 회전 없음 - rotatedBuffer = inputBuffer; - break; - - case 90: - rotatedBuffer = await sharp(inputBuffer) - .rotate(90) - .jpeg({ - quality: 90, - progressive: true - }) - .toBuffer(); - break; - - case 180: - rotatedBuffer = await sharp(inputBuffer) - .rotate(180) - .jpeg({ - quality: 90, - progressive: true - }) - .toBuffer(); - break; - - case 270: - rotatedBuffer = await sharp(inputBuffer) - .rotate(270) - .jpeg({ - quality: 90, - progressive: true - }) - .toBuffer(); - break; - - default: - console.warn(`⚠️ Unsupported rotation angle: ${degrees}°. Using original image.`); - rotatedBuffer = inputBuffer; - } - - // Buffer를 다시 base64로 변환 - const rotatedBase64 = rotatedBuffer.toString('base64'); - - console.log(`✅ Image rotated successfully (${degrees}°)`); - return rotatedBase64; + console.log(`📄 PDF has ${pageCount} pages`); + return pageCount; } catch (error) { - console.error(`❌ Error rotating image by ${degrees}°:`, error); - console.warn('Using original image due to rotation error'); - return base64; // 실패시 원본 반환 + console.warn('❌ Could not get PDF page count, trying alternative method:', error); + + // pdfinfo가 실패하면 pdftoppm으로 테스트 + try { + await exec('pdftoppm', ['-l', '1', '-null', pdfPath]); + return 1; // 최소 1페이지는 있음 + } catch { + console.warn('⚠️ Could not determine page count, assuming 1 page'); + return 1; + } + } finally { + await fs.rm(pdfPath, { force: true }).catch(() => {}); } } /** - * 이미지 품질을 개선합니다 - * @param base64 - base64 인코딩된 이미지 데이터 - * @returns Promise - 개선된 이미지의 base64 데이터 + * base64 데이터 유효성 검증 */ -export async function enhanceImageQuality(base64: string): Promise { - try { - console.log('🎨 Enhancing image quality...'); - - const inputBuffer = Buffer.from(base64, 'base64'); - - const enhancedBuffer = await sharp(inputBuffer) - .resize(2000, 2000, { - fit: 'inside', - withoutEnlargement: true - }) - // 개별 매개변수 방식으로 수정 - .sharpen(1, 1, 2) // sigma, m1(flat), m2(jagged) - .normalize() // 히스토그램 정규화 - .gamma(1.1) // 약간의 감마 보정 - .jpeg({ - quality: 95, - progressive: true, - mozjpeg: true - }) - .toBuffer(); - - const enhancedBase64 = enhancedBuffer.toString('base64'); - - console.log('✅ Image quality enhanced'); - return enhancedBase64; - - } catch (error) { - console.error('❌ Error enhancing image:', error); - return base64; - } +export function validateBase64Image(base64: string): { isValid: boolean; error?: string; size?: number } { + try { + if (!base64 || typeof base64 !== 'string') { + return { isValid: false, error: 'Base64 data is empty or invalid type' }; + } + + const cleanBase64 = base64.replace(/^data:image\/[a-z]+;base64,/, ''); + + if (!/^[A-Za-z0-9+/]*={0,2}$/.test(cleanBase64)) { + return { isValid: false, error: 'Invalid base64 format' }; + } + + if (cleanBase64.length < 100) { + return { isValid: false, error: `Base64 too short: ${cleanBase64.length} characters` }; + } + + const buffer = Buffer.from(cleanBase64, 'base64'); + const bufferSize = buffer.length; + + if (bufferSize < 1) { + return { isValid: false, error: `Buffer too small: ${bufferSize} bytes` }; + } + + if (bufferSize > 52428800) { // 50MB + return { isValid: false, error: `Buffer too large: ${bufferSize} bytes (max: 50MB)` }; + } + + return { isValid: true, size: bufferSize }; + + } catch (error) { + return { + isValid: false, + error: `Base64 validation failed: ${error instanceof Error ? error.message : 'Unknown error'}` + }; + } } /** - * PDF를 고품질 이미지로 변환합니다 - * @param pdfBuffer - PDF Buffer 데이터 - * @param pageIndex - 변환할 페이지 인덱스 (0부터 시작) - * @returns Promise - 변환된 이미지의 base64 데이터 + * 서버 사이드에서 이미지를 회전시킵니다 */ -export async function convertPDFToImage(pdfBuffer: Buffer, pageIndex: number = 0): Promise { - try { - console.log(`📄 Converting PDF page ${pageIndex + 1} to image...`); - - // pdf2pic 라이브러리 사용 - const pdf2pic = require('pdf2pic'); - - const convert = pdf2pic.fromBuffer(pdfBuffer, { - density: 300, // 300 DPI for high quality - saveFilename: "page", - savePath: "/tmp", // 임시 경로 - format: "jpeg", - width: 2480, // A4 크기 @ 300 DPI - height: 3508, - quality: 100 - }); - - const result = await convert(pageIndex + 1, { responseType: "buffer" }); - const base64 = result.buffer.toString('base64'); - - console.log('✅ PDF converted to image successfully'); - return base64; - - } catch (error) { - console.error('❌ Error converting PDF to image:', error); - throw new Error('Failed to convert PDF to image'); - } +export async function rotateImageBase64(base64: string, degrees: number): Promise { + try { + console.log(`🔄 === ROTATING IMAGE BY ${degrees}° ===`); + + const validation = validateBase64Image(base64); + if (!validation.isValid) { + throw new Error(`Invalid input base64: ${validation.error}`); + } + + console.log(`✅ Input validation passed - size: ${validation.size} bytes`); + + const cleanBase64 = base64.replace(/^data:image\/[a-z]+;base64,/, ''); + const inputBuffer = Buffer.from(cleanBase64, 'base64'); + + console.log(`📊 Input buffer created: ${inputBuffer.length} bytes`); + + const normalizedDegrees = ((degrees % 360) + 360) % 360; + console.log(`📐 Normalized rotation: ${normalizedDegrees}°`); + + let rotatedBuffer: Buffer; + + if (normalizedDegrees === 0) { + console.log(' ↻ No rotation needed, applying quality enhancement...'); + rotatedBuffer = await sharp(inputBuffer) + .jpeg({ + quality: 90, + progressive: true, + mozjpeg: true + }) + .toBuffer(); + } else { + console.log(` 🔄 Applying ${normalizedDegrees}° rotation...`); + + const sharpInstance = sharp(inputBuffer); + const metadata = await sharpInstance.metadata(); + console.log(` 📏 Original image: ${metadata.width}x${metadata.height}, format: ${metadata.format}`); + + rotatedBuffer = await sharpInstance + .rotate(normalizedDegrees) + .jpeg({ + quality: 90, + progressive: true, + mozjpeg: true + }) + .toBuffer(); + } + + console.log(`📊 Output buffer created: ${rotatedBuffer.length} bytes`); + + if (rotatedBuffer.length === 0) { + throw new Error('Rotation resulted in empty buffer'); + } + + if (rotatedBuffer.length > 52428800) { + throw new Error(`Rotated image too large: ${rotatedBuffer.length} bytes`); + } + + const rotatedBase64 = rotatedBuffer.toString('base64'); + + const outputValidation = validateBase64Image(rotatedBase64); + if (!outputValidation.isValid) { + throw new Error(`Invalid output base64: ${outputValidation.error}`); + } + + console.log(`✅ Image rotated successfully: ${outputValidation.size} bytes`); + console.log(`📈 Size change: ${inputBuffer.length} → ${outputValidation.size} bytes`); + + return rotatedBase64; + + } catch (error) { + console.error(`❌ Error rotating image by ${degrees}°:`, error); + + if (error instanceof Error) { + if (error.message.includes('Input buffer contains unsupported image format')) { + console.error(' 🖼️ Unsupported image format - try converting to JPEG first'); + } else if (error.message.includes('Input image exceeds pixel limit')) { + console.error(' 📏 Image too large for processing'); + } else if (error.message.includes('premature close')) { + console.error(' 🔧 Corrupted image data'); + } + } + + const originalValidation = validateBase64Image(base64); + if (originalValidation.isValid) { + console.warn(' ↩️ Using original image due to rotation error'); + return base64; + } else { + throw new Error(`Rotation failed and original image is invalid: ${originalValidation.error}`); + } + } } /** - * 이미지에서 텍스트 방향을 감지합니다 - * @param base64 - base64 인코딩된 이미지 데이터 - * @returns Promise - 감지된 올바른 회전 각도 + * 이미지 품질을 개선합니다 */ -export async function detectTextOrientation(base64: string): Promise { - // 이 함수는 간단한 방향 감지를 시뮬레이션합니다 - // 실제로는 더 정교한 알고리즘이 필요할 수 있습니다 - - console.log('🧭 Detecting text orientation...'); - - const rotations = [0, 90, 180, 270]; - const scores: { rotation: number; score: number }[] = []; - - for (const rotation of rotations) { +export async function enhanceImageQuality(base64: string): Promise { try { - const rotatedBase64 = await rotateImageBase64(base64, rotation); - - // 간단한 품질 측정 (실제로는 OCR API 호출이나 다른 방법 사용) - const score = await estimateTextQuality(rotatedBase64); - scores.push({ rotation, score }); - - console.log(` ${rotation}°: quality score = ${score.toFixed(3)}`); - + console.log('🎨 === ENHANCING IMAGE QUALITY ==='); + + const validation = validateBase64Image(base64); + if (!validation.isValid) { + console.warn(`⚠️ Invalid input for enhancement: ${validation.error}`); + return base64; + } + + console.log(`✅ Enhancement input valid: ${validation.size} bytes`); + + const cleanBase64 = base64.replace(/^data:image\/[a-z]+;base64,/, ''); + const inputBuffer = Buffer.from(cleanBase64, 'base64'); + + const sharpInstance = sharp(inputBuffer); + const metadata = await sharpInstance.metadata(); + + console.log(`📏 Original: ${metadata.width}x${metadata.height}, ${metadata.format}`); + + const maxDimension = 2000; + let needsResize = false; + + if (metadata.width && metadata.height) { + needsResize = metadata.width > maxDimension || metadata.height > maxDimension; + } + + let enhancedBuffer: Buffer; + + if (needsResize) { + console.log(`📐 Resizing to fit ${maxDimension}px...`); + enhancedBuffer = await sharpInstance + .resize(maxDimension, maxDimension, { + fit: 'inside', + withoutEnlargement: true + }) + .sharpen(0.5, 1, 2) + .normalize() + .gamma(1.1) + .jpeg({ + quality: 95, + progressive: true, + mozjpeg: true + }) + .toBuffer(); + } else { + console.log('📐 No resize needed, applying enhancement only...'); + enhancedBuffer = await sharpInstance + .sharpen(0.5, 1, 2) + .normalize() + .gamma(1.1) + .jpeg({ + quality: 95, + progressive: true, + mozjpeg: true + }) + .toBuffer(); + } + + const enhancedBase64 = enhancedBuffer.toString('base64'); + + const outputValidation = validateBase64Image(enhancedBase64); + if (!outputValidation.isValid) { + console.warn(`⚠️ Enhancement resulted in invalid image: ${outputValidation.error}`); + return base64; + } + + console.log(`✅ Image enhanced: ${validation.size} → ${outputValidation.size} bytes`); + return enhancedBase64; + } catch (error) { - console.warn(` ${rotation}°: Failed to test orientation`); - scores.push({ rotation, score: 0 }); + console.error('❌ Error enhancing image:', error); + return base64; } - } - - const bestOrientation = scores.reduce((best, current) => - current.score > best.score ? current : best - ); - - console.log(`🎯 Best orientation detected: ${bestOrientation.rotation}°`); - return bestOrientation.rotation; } /** - * 이미지의 텍스트 품질을 추정합니다 (간단한 버전) + * PDF를 이미지로 변환합니다 (개선된 버전) */ -async function estimateTextQuality(base64: string): Promise { +export async function convertPDFToImage( + pdfBuffer: Buffer, + pageIndex = 0, + dpi = 300, +): Promise { + const tmp = tmpdir(); + const id = randomUUID(); + const pdfPath = path.join(tmp, `${id}.pdf`); + const outPrefix = path.join(tmp, id); + const jpgPath = `${outPrefix}.jpg`; + try { - const buffer = Buffer.from(base64, 'base64'); + console.log(`📄 Converting PDF page ${pageIndex + 1} to image (${dpi} DPI)...`); - // Sharp을 사용해 이미지 통계 분석 - const stats = await sharp(buffer) - .greyscale() - .stats(); - - // 간단한 품질 지표 계산 - // 실제로는 더 복잡한 알고리즘이 필요합니다 - const contrast = stats.channels[0].max - stats.channels[0].min; - const sharpness = stats.channels[0].stdev; + // 1) PDF 임시 저장 + await fs.writeFile(pdfPath, pdfBuffer); + + // 2) pdftoppm 실행 + const page = pageIndex + 1; // pdftoppm은 1-based + await exec('pdftoppm', [ + '-jpeg', + '-singlefile', + '-r', dpi.toString(), + '-f', page.toString(), + '-l', page.toString(), + pdfPath, + outPrefix, + ], { maxBuffer: 1024 * 1024 * 50 }); // 50MB 버퍼 + + // 3) 결과 읽어 base64 변환 + const img = await fs.readFile(jpgPath); + const base64 = img.toString('base64'); - return (contrast + sharpness) / 510; // 0-1 범위로 정규화 + console.log(`✅ PDF page ${pageIndex + 1} converted successfully: ${img.length} bytes`); + return base64; + } catch (error) { - return 0; + console.error(`❌ Error converting PDF page ${pageIndex + 1}:`, error); + throw new Error(`Failed to convert PDF page ${pageIndex + 1}: ${error instanceof Error ? error.message : 'Unknown error'}`); + } finally { + // 4) 임시 파일 정리 + await fs.rm(pdfPath, { force: true }).catch(() => {}); + await fs.rm(jpgPath, { force: true }).catch(() => {}); } } /** - * 이미지가 회전이 필요한지 빠르게 체크합니다 - * @param base64 - base64 인코딩된 이미지 데이터 - * @returns Promise - 회전이 필요하면 true + * 파일 형식을 JPEG로 정규화 */ -export async function needsRotation(base64: string): Promise { - try { - const buffer = Buffer.from(base64, 'base64'); - - // 이미지 메타데이터 확인 - const metadata = await sharp(buffer).metadata(); - - // EXIF 방향 정보가 있으면 회전 필요 - if (metadata.orientation && metadata.orientation > 1) { - console.log(`📐 EXIF orientation detected: ${metadata.orientation}`); - return true; +export async function normalizeImageFormat(base64: string): Promise { + try { + console.log('🔄 Normalizing image format to JPEG...'); + + const validation = validateBase64Image(base64); + if (!validation.isValid) { + throw new Error(`Cannot normalize invalid image: ${validation.error}`); + } + + const cleanBase64 = base64.replace(/^data:image\/[a-z]+;base64,/, ''); + const inputBuffer = Buffer.from(cleanBase64, 'base64'); + + const normalizedBuffer = await sharp(inputBuffer) + .jpeg({ + quality: 90, + progressive: true + }) + .toBuffer(); + + const normalizedBase64 = normalizedBuffer.toString('base64'); + + const outputValidation = validateBase64Image(normalizedBase64); + if (!outputValidation.isValid) { + throw new Error(`Normalization failed: ${outputValidation.error}`); + } + + console.log(`✅ Format normalized: ${validation.size} → ${outputValidation.size} bytes`); + return normalizedBase64; + + } catch (error) { + console.error('❌ Error normalizing image format:', error); + throw error; } - - // 가로/세로 비율 체크 (일반적으로 문서는 세로가 더 긺) - if (metadata.width && metadata.height) { - const aspectRatio = metadata.width / metadata.height; - if (aspectRatio > 1.5) { - console.log(`📐 Wide aspect ratio detected: ${aspectRatio.toFixed(2)}`); - return true; // 너무 가로로 긴 이미지는 회전 필요할 가능성 - } +} + +// 기존 함수들 +export async function detectTextOrientation(base64: string): Promise { + console.log('🧭 Detecting text orientation...'); + + const rotations = [0, 90, 180, 270]; + const scores: { rotation: number; score: number }[] = []; + + for (const rotation of rotations) { + try { + const rotatedBase64 = await rotateImageBase64(base64, rotation); + const score = await estimateTextQuality(rotatedBase64); + scores.push({ rotation, score }); + + console.log(` ${rotation}°: quality score = ${score.toFixed(3)}`); + + } catch (error) { + console.warn(` ${rotation}°: Failed to test orientation`); + scores.push({ rotation, score: 0 }); + } + } + + const bestOrientation = scores.reduce((best, current) => + current.score > best.score ? current : best + ); + + console.log(`🎯 Best orientation detected: ${bestOrientation.rotation}°`); + return bestOrientation.rotation; +} + +async function estimateTextQuality(base64: string): Promise { + try { + const cleanBase64 = base64.replace(/^data:image\/[a-z]+;base64,/, ''); + const buffer = Buffer.from(cleanBase64, 'base64'); + + const stats = await sharp(buffer) + .greyscale() + .stats(); + + const contrast = stats.channels[0].max - stats.channels[0].min; + const sharpness = stats.channels[0].stdev; + + return (contrast + sharpness) / 510; + + } catch (error) { + return 0; + } +} + +export async function needsRotation(base64: string): Promise { + try { + const cleanBase64 = base64.replace(/^data:image\/[a-z]+;base64,/, ''); + const buffer = Buffer.from(cleanBase64, 'base64'); + + const metadata = await sharp(buffer).metadata(); + + if (metadata.orientation && metadata.orientation > 1) { + console.log(`📐 EXIF orientation detected: ${metadata.orientation}`); + return true; + } + + if (metadata.width && metadata.height) { + const aspectRatio = metadata.width / metadata.height; + if (aspectRatio > 1.5) { + console.log(`📐 Wide aspect ratio detected: ${aspectRatio.toFixed(2)}`); + return true; + } + } + + return false; + + } catch (error) { + console.warn('Error checking if rotation needed:', error); + return false; } - - return false; - - } catch (error) { - console.warn('Error checking if rotation needed:', error); - return false; - } } \ No newline at end of file diff --git a/app/api/ocr/utils/tableExtraction.ts b/app/api/ocr/utils/tableExtraction.ts index ea543f8e..720e5a5f 100644 --- a/app/api/ocr/utils/tableExtraction.ts +++ b/app/api/ocr/utils/tableExtraction.ts @@ -1,7 +1,11 @@ // app/api/ocr/utils/tableExtraction.ts -// 완전한 테이블 추출 로직 구현 +// 개선된 완전 테이블 추출 로직 – Format‑1 식별번호 파싱 보강 & 중복 행 제거 -interface ExtractedRow { +/* -------------------------------------------------------------------------- */ +/* 타입 */ +/* -------------------------------------------------------------------------- */ + +export interface ExtractedRow { no: string; identificationNo: string; tagNo: string; @@ -41,516 +45,223 @@ interface ColumnMapping { weldingDate: number; } -// 메인 테이블 추출 함수 -export async function extractTablesFromOCR(ocrResult: any): Promise { - const extractedTables: ExtractedRow[][] = []; - const warnings: string[] = []; +/* -------------------------------------------------------------------------- */ +/* 메인 */ +/* -------------------------------------------------------------------------- */ - if (!ocrResult || !ocrResult.images) { - console.warn('No OCR images found in result'); - return []; - } +export async function extractTablesFromOCR (ocrResult: any): Promise { + const tables: ExtractedRow[][] = []; + if (!ocrResult?.images) return tables; - for (let imageIndex = 0; imageIndex < ocrResult.images.length; imageIndex++) { - const image = ocrResult.images[imageIndex]; - - if (!image.tables || image.tables.length === 0) { - console.warn(`No tables found in image ${imageIndex}`); - continue; - } + ocrResult.images.forEach((image: any, imgIdx: number) => { + image.tables?.forEach((table: OCRTable, tblIdx: number) => { + if (!isRelevantTable(table)) return; + const rows = extractTableData(table, imgIdx, tblIdx); + if (rows.length) tables.push(rows); + }); + }); + return tables; +} - for (let tableIndex = 0; tableIndex < image.tables.length; tableIndex++) { - const table = image.tables[tableIndex]; - - try { - if (isRelevantTable(table)) { - const extractedRows = extractTableData(table, imageIndex, tableIndex); - - if (extractedRows.length > 0) { - extractedTables.push(extractedRows); - console.log(`Successfully extracted ${extractedRows.length} rows from table ${tableIndex + 1} in image ${imageIndex + 1}`); - } else { - console.warn(`Table ${tableIndex + 1} in image ${imageIndex + 1} was identified as relevant but no data could be extracted`); - } - } else { - console.log(`Table ${tableIndex + 1} in image ${imageIndex + 1} is not relevant (no required headers found)`); - } - } catch (error) { - console.error(`Error processing table ${tableIndex + 1} in image ${imageIndex + 1}:`, error); - } - } - } +/* -------------------------------------------------------------------------- */ +/* 관련 테이블 판별 */ +/* -------------------------------------------------------------------------- */ - console.log(`Total extracted tables: ${extractedTables.length}`); - return extractedTables; +function isRelevantTable (table: OCRTable): boolean { + const headers = table.cells.filter(c => c.rowIndex < 3).map(getCellText).join(' ').toLowerCase(); + return /\bno\b|번호/.test(headers) && /identification|식별|ident|id/.test(headers); } -// 관련 테이블인지 확인 -function isRelevantTable(table: OCRTable): boolean { - if (!table.cells || table.cells.length === 0) { - return false; - } +/* -------------------------------------------------------------------------- */ +/* 표 해석 */ +/* -------------------------------------------------------------------------- */ - // 첫 3행에서 헤더 찾기 - const headerCells = table.cells.filter(cell => cell.rowIndex <= 2); - const headerTexts = headerCells - .map(cell => getCellText(cell).toLowerCase()) - .filter(text => text.length > 0); - - console.log('Header texts found:', headerTexts); - - // 필수 키워드 확인 - const hasNo = headerTexts.some(text => - text.includes('no.') || - text === 'no' || - text.includes('번호') || - text.match(/^no\.?$/i) - ); - - const hasIdentification = headerTexts.some(text => - text.includes('identification') || - text.includes('식별') || - text.includes('ident') || - text.includes('id') - ); - - // 테이블 품질 확인 - const hasMinimumCells = table.cells.length >= 6; // 최소 헤더 + 데이터 - const hasReasonableConfidence = table.inferConfidence >= 0.5; // 신뢰도 기준 완화 - - const isRelevant = hasNo && hasIdentification && hasMinimumCells && hasReasonableConfidence; - - console.log(`Table relevance check: hasNo=${hasNo}, hasIdentification=${hasIdentification}, minCells=${hasMinimumCells}, confidence=${hasReasonableConfidence} => ${isRelevant}`); - - return isRelevant; -} +function extractTableData (table: OCRTable, imgIdx: number, tblIdx: number): ExtractedRow[] { + const grid = buildGrid(table); + const headerRowIdx = findHeaderRow(grid); + if (headerRowIdx === -1) return []; -// 테이블 데이터 추출 -function extractTableData(table: OCRTable, imageIndex: number, tableIndex: number): ExtractedRow[] { - console.log(`Processing table ${tableIndex + 1} in image ${imageIndex + 1}`); - - // 테이블 그리드 구축 - const tableGrid = buildTableGrid(table); - - if (tableGrid.length < 2) { - console.warn('Table has less than 2 rows (need header + data)'); - return []; - } + const format = detectFormat(grid[headerRowIdx]); + const mapping = mapColumns(grid[headerRowIdx]); - console.log(`Table grid built: ${tableGrid.length} rows, ${tableGrid[0]?.length || 0} columns`); + const seen = new Set(); + const data: ExtractedRow[] = []; - // 헤더 행 찾기 - const headerRowIndex = findHeaderRow(tableGrid); - if (headerRowIndex === -1) { - console.warn('No header row found'); - return []; - } + for (let r = headerRowIdx + 1; r < grid.length; r++) { + const row = grid[r]; + if (isBlankRow(row)) continue; - console.log(`Header row found at index: ${headerRowIndex}`); - - // 테이블 형식 결정 - const headerRow = tableGrid[headerRowIndex]; - const tableFormat = determineTableFormat(headerRow); - console.log(`Table format detected: ${tableFormat}`); - - // 컬럼 매핑 찾기 - const columnMapping = findColumnMapping(headerRow, tableFormat); - console.log('Column mapping:', columnMapping); - - // 데이터 행 추출 - const dataRows: ExtractedRow[] = []; - - for (let i = headerRowIndex + 1; i < tableGrid.length; i++) { - const row = tableGrid[i]; - - if (row && row.length > 0 && !isEmptyRow(row)) { - try { - const extractedRow = extractRowData(row, tableFormat, columnMapping, imageIndex, tableIndex, i); - if (extractedRow && isValidRow(extractedRow)) { - dataRows.push(extractedRow); - } - } catch (error) { - console.warn(`Error processing row ${i}:`, error); - } - } + const parsed = buildRow(row, format, mapping, tblIdx, r); + if (!parsed || !isValidRow(parsed)) continue; + + const key = `${parsed.no}-${parsed.identificationNo}`; + if (seen.has(key)) continue; + seen.add(key); + + data.push(parsed); } - - console.log(`Extracted ${dataRows.length} valid rows from table`); - return dataRows; + return data; } -// 테이블 그리드 구축 -function buildTableGrid(table: OCRTable): string[][] { - if (!table.cells || table.cells.length === 0) { - return []; - } +/* -------------------------------------------------------------------------- */ +/* Grid & Header */ +/* -------------------------------------------------------------------------- */ + +function buildGrid (table: OCRTable): string[][] { + const maxR = Math.max(...table.cells.map(c => c.rowIndex + c.rowSpan - 1)); + const maxC = Math.max(...table.cells.map(c => c.columnIndex + c.columnSpan - 1)); + const grid = Array.from({ length: maxR + 1 }, () => Array(maxC + 1).fill('')); - const maxRow = Math.max(...table.cells.map(cell => cell.rowIndex + cell.rowSpan - 1)) + 1; - const maxCol = Math.max(...table.cells.map(cell => cell.columnIndex + cell.columnSpan - 1)) + 1; - - const grid: string[][] = Array(maxRow).fill(null).map(() => Array(maxCol).fill('')); - - // 셀 내용으로 그리드 채우기 table.cells.forEach(cell => { - const text = getCellText(cell); - + const txt = getCellText(cell); for (let r = cell.rowIndex; r < cell.rowIndex + cell.rowSpan; r++) { for (let c = cell.columnIndex; c < cell.columnIndex + cell.columnSpan; c++) { - if (grid[r] && grid[r][c] !== undefined) { - // 기존 텍스트가 있으면 결합 - grid[r][c] = grid[r][c] ? `${grid[r][c]} ${text}`.trim() : text; - } + grid[r][c] = grid[r][c] ? `${grid[r][c]} ${txt}` : txt; } } }); - return grid; } -// 셀 텍스트 추출 -function getCellText(cell: TableCell): string { - if (!cell.cellTextLines || cell.cellTextLines.length === 0) { - return ''; - } - - return cell.cellTextLines - .map(line => - line.cellWords - .map(word => word.inferText || '') - .join(' ') - ) - .join('\n') - .trim(); +function getCellText (cell: TableCell): string { + return cell.cellTextLines?.flatMap(l => l.cellWords.map(w => w.inferText.trim())).filter(Boolean).join(' ') ?? ''; } -// 헤더 행 찾기 -function findHeaderRow(tableGrid: string[][]): number { - for (let i = 0; i < Math.min(3, tableGrid.length); i++) { - const row = tableGrid[i]; - const rowText = row.join(' ').toLowerCase(); - - console.log(`Checking row ${i}: "${rowText}"`); - - const hasNo = rowText.includes('no.') || rowText.includes('번호') || /\bno\b/.test(rowText); - const hasIdent = rowText.includes('identification') || rowText.includes('식별') || rowText.includes('ident'); - - if (hasNo && hasIdent) { - console.log(`Header row found at ${i}`); - return i; - } +function findHeaderRow (grid: string[][]): number { + for (let i = 0; i < Math.min(3, grid.length); i++) { + const t = grid[i].join(' ').toLowerCase(); + if (/\bno\b|번호/.test(t) && /identification|식별|ident/.test(t)) return i; } return -1; } -// 테이블 형식 결정 -function determineTableFormat(headerRow: string[]): 'format1' | 'format2' { - const headerText = headerRow.join(' ').toLowerCase(); - - // Format 2: Tag No와 Joint No가 분리된 컬럼 - const hasTagNoColumn = headerText.includes('tag') && headerText.includes('no'); - const hasJointNoColumn = headerText.includes('joint') && headerText.includes('no'); - - if (hasTagNoColumn && hasJointNoColumn) { - return 'format2'; - } - - // Format 1: Identification No에 통합 - return 'format1'; -} +/* -------------------------------------------------------------------------- */ +/* Column Mapping */ +/* -------------------------------------------------------------------------- */ -// 컬럼 매핑 찾기 -function findColumnMapping(headerRow: string[], format: 'format1' | 'format2'): ColumnMapping { - const mapping: ColumnMapping = { - no: -1, - identification: -1, - tagNo: -1, - jointNo: -1, - jointType: -1, - weldingDate: -1 - }; +function detectFormat (header: string[]): 'format1' | 'format2' { + const h = header.join(' ').toLowerCase(); + return h.includes('tag') && h.includes('joint') ? 'format2' : 'format1'; +} - headerRow.forEach((header, index) => { - const lowerHeader = header.toLowerCase().trim(); - - console.log(`Column ${index}: "${header}" -> "${lowerHeader}"`); - - if ((lowerHeader.includes('no.') || lowerHeader === 'no') && - !lowerHeader.includes('identification') && - !lowerHeader.includes('tag') && - !lowerHeader.includes('joint')) { - mapping.no = index; - console.log(` -> Mapped to 'no'`); - } else if (lowerHeader.includes('identification') || lowerHeader.includes('ident')) { - mapping.identification = index; - console.log(` -> Mapped to 'identification'`); - } else if (lowerHeader.includes('tag') && lowerHeader.includes('no')) { - mapping.tagNo = index; - console.log(` -> Mapped to 'tagNo'`); - } else if (lowerHeader.includes('joint') && lowerHeader.includes('no')) { - mapping.jointNo = index; - console.log(` -> Mapped to 'jointNo'`); - } else if (lowerHeader.includes('joint') && lowerHeader.includes('type')) { - mapping.jointType = index; - console.log(` -> Mapped to 'jointType'`); - } else if (lowerHeader.includes('type') && !lowerHeader.includes('joint')) { - mapping.jointType = index; - console.log(` -> Mapped to 'jointType'`); - } else if (lowerHeader.includes('welding') || lowerHeader.includes('date')) { - mapping.weldingDate = index; - console.log(` -> Mapped to 'weldingDate'`); - } +function mapColumns (header: string[]): ColumnMapping { + const mp: ColumnMapping = { no: -1, identification: -1, tagNo: -1, jointNo: -1, jointType: -1, weldingDate: -1 }; + + header.forEach((h, i) => { + const t = h.toLowerCase(); + if (/^no\.?$/.test(t) && !/ident|tag|joint/.test(t)) mp.no = i; + else if (/identification|ident/.test(t)) mp.identification = i; + else if (/tag.*no/.test(t)) mp.tagNo = i; + else if (/joint.*no/.test(t)) mp.jointNo = i; + else if (/joint.*type/.test(t) || (/^type$/.test(t) && mp.jointType === -1)) mp.jointType = i; + else if (/welding|date/.test(t)) mp.weldingDate = i; }); - - console.log('Final column mapping:', mapping); - return mapping; + return mp; } -// 행 데이터 추출 -function extractRowData( - row: string[], - format: 'format1' | 'format2', - columnMapping: ColumnMapping, - imageIndex: number, - tableIndex: number, - rowIndex: number +/* -------------------------------------------------------------------------- */ +/* Row Extraction */ +/* -------------------------------------------------------------------------- */ + +function buildRow ( + row: string[], + format: 'format1' | 'format2', + mp: ColumnMapping, + tblIdx: number, + rowIdx: number ): ExtractedRow | null { - - const extractedRow: ExtractedRow = { - no: '', + const out: ExtractedRow = { + no: mp.no >= 0 ? clean(row[mp.no]) : '', identificationNo: '', tagNo: '', jointNo: '', - jointType: '', + jointType: mp.jointType >= 0 ? clean(row[mp.jointType]) : '', weldingDate: '', confidence: 0, - sourceTable: tableIndex, - sourceRow: rowIndex + sourceTable: tblIdx, + sourceRow: rowIdx, }; - console.log(`Processing row ${rowIndex}: [${row.map(cell => `"${cell}"`).join(', ')}]`); - - // No. 추출 - if (columnMapping.no >= 0 && columnMapping.no < row.length) { - extractedRow.no = cleanText(row[columnMapping.no]); + if (mp.weldingDate >= 0) out.weldingDate = clean(row[mp.weldingDate]); + else { + const idx = row.findIndex(col => /\d{4}[.\-/]\d{1,2}[.\-/]\d{1,2}/.test(col)); + if (idx >= 0) out.weldingDate = clean(row[idx]); } - if (format === 'format1') { - // Format 1: 통합된 identification 데이터 - if (columnMapping.identification >= 0 && columnMapping.identification < row.length) { - const combinedText = row[columnMapping.identification]; - const parsedData = parseIdentificationData(combinedText); - extractedRow.identificationNo = parsedData.identificationNo; - extractedRow.tagNo = parsedData.tagNo; - extractedRow.jointNo = parsedData.jointNo; - - console.log(` Parsed identification: "${combinedText}" -> `, parsedData); - } + if (format === 'format2') { + if (mp.identification >= 0) out.identificationNo = clean(row[mp.identification]); + if (mp.jointNo >= 0) out.jointNo = clean(row[mp.jointNo]); + if (mp.tagNo >= 0) out.tagNo = clean(row[mp.tagNo]); } else { - // Format 2: 분리된 컬럼들 - if (columnMapping.identification >= 0 && columnMapping.identification < row.length) { - extractedRow.identificationNo = cleanText(row[columnMapping.identification]); - } - if (columnMapping.tagNo >= 0 && columnMapping.tagNo < row.length) { - extractedRow.tagNo = cleanText(row[columnMapping.tagNo]); - } - if (columnMapping.jointNo >= 0 && columnMapping.jointNo < row.length) { - extractedRow.jointNo = cleanText(row[columnMapping.jointNo]); - } + const combined = mp.identification >= 0 ? row[mp.identification] : ''; + const parsed = parseIdentificationData(combined); + out.identificationNo = parsed.identificationNo; + out.jointNo = parsed.jointNo; + out.tagNo = parsed.tagNo; } - // Joint Type 추출 - if (columnMapping.jointType >= 0 && columnMapping.jointType < row.length) { - extractedRow.jointType = cleanText(row[columnMapping.jointType]); - } - - // Welding Date 추출 (컬럼 매핑이 있으면 사용, 없으면 날짜 패턴으로 찾기) - if (columnMapping.weldingDate >= 0 && columnMapping.weldingDate < row.length) { - extractedRow.weldingDate = cleanText(row[columnMapping.weldingDate]); - } else { - const dateIndex = findDateColumn(row); - if (dateIndex >= 0) { - extractedRow.weldingDate = cleanText(row[dateIndex]); - } - } - - // 신뢰도 계산 - extractedRow.confidence = calculateRowConfidence(extractedRow); - - console.log(` Extracted row:`, extractedRow); - - return extractedRow; + out.confidence = scoreRow(out); + return out; } -// Identification 데이터 파싱 (Format 1용) -function parseIdentificationData(combinedText: string): { - identificationNo: string; - tagNo: string; - jointNo: string; -} { - const cleanedText = cleanText(combinedText); - - console.log(`Parsing identification data: "${cleanedText}"`); - - // 줄바꿈으로 먼저 분리 - const lines = cleanedText.split(/[\r\n]+/).map(line => line.trim()).filter(line => line.length > 0); - - const allParts: string[] = []; - lines.forEach(line => { - // 공백과 특수문자로 분리 - const parts = line.split(/[\s\-_]+/).filter(part => part.length > 0); - allParts.push(...parts); - }); +/* -------------------------------------------------------------------------- */ +/* Format‑1 셀 파싱 */ +/* -------------------------------------------------------------------------- */ - console.log(` Split into parts:`, allParts); +function parseIdentificationData (txt: string): { identificationNo: string; jointNo: string; tagNo: string } { + const cleaned = clean(txt); + if (!cleaned) return { identificationNo: '', jointNo: '', tagNo: '' }; - if (allParts.length === 0) { - return { identificationNo: cleanedText, tagNo: '', jointNo: '' }; - } + const tokens = cleaned.split(/\s+/).map(clean).filter(Boolean); - if (allParts.length === 1) { - return { identificationNo: allParts[0], tagNo: '', jointNo: '' }; - } + // Identification 후보: 하이픈이 2개 이상 포함된 토큰 가운데 가장 긴 것 + const idCand = tokens.filter(t => t.split('-').length >= 3).sort((a, b) => b.length - a.length); + const identificationNo = idCand[0] || ''; - // 길이별로 정렬하여 식별 - const sortedParts = [...allParts].sort((a, b) => b.length - a.length); - - const identificationNo = sortedParts[0]; // 가장 긴 것 - const jointNo = allParts.find(part => part.length <= 3 && /^[A-Z0-9]+$/i.test(part)) || - sortedParts[sortedParts.length - 1]; // 3글자 이하 영숫자 또는 가장 짧은 것 - const tagNo = allParts.find(part => part !== identificationNo && part !== jointNo) || ''; - - const result = { identificationNo, tagNo, jointNo }; - console.log(` Parsed result:`, result); - - return result; -} + const residual = tokens.filter(t => t !== identificationNo); + if (!residual.length) return { identificationNo, jointNo: '', tagNo: '' }; -// 날짜 컬럼 찾기 -function findDateColumn(row: string[]): number { - const datePattern = /\d{4}[.\-\/]\d{1,2}[.\-\/]\d{1,2}/; - - for (let i = 0; i < row.length; i++) { - if (datePattern.test(row[i])) { - console.log(` Found date in column ${i}: "${row[i]}"`); - return i; - } - } - - return -1; -} + residual.sort((a, b) => a.length - b.length); + const jointNo = residual[0] || ''; + const tagNo = residual[residual.length - 1] || ''; -// 텍스트 정리 -function cleanText(text: string): string { - return text - .replace(/[\r\n\t]+/g, ' ') - .replace(/\s+/g, ' ') - .trim(); + return { identificationNo, jointNo, tagNo }; } -// 빈 행 확인 -function isEmptyRow(row: string[]): boolean { - return row.every(cell => !cell || cell.trim().length === 0); +/* -------------------------------------------------------------------------- */ +/* Helpers */ +/* -------------------------------------------------------------------------- */ + +const clean = (s: string = '') => s.replace(/[\r\n\t]+/g, ' ').replace(/\s+/g, ' ').trim(); +const isBlankRow = (row: string[]) => row.every(c => !clean(c)); +const isValidRow = (r: ExtractedRow) => !!(r.no || r.identificationNo); + +function scoreRow (r: ExtractedRow): number { + const w: Record = { + no: 1, identificationNo: 3, tagNo: 2, jointNo: 2, jointType: 1, weldingDate: 1, + confidence: 0, sourceTable: 0, sourceRow: 0, + } as any; + let s = 0, t = 0; + (Object.keys(w) as (keyof ExtractedRow)[]).forEach(k => { t += w[k]; if ((r[k] as string)?.length) s += w[k]; }); + return t ? s / t : 0; } -// 유효한 행 확인 -function isValidRow(row: ExtractedRow): boolean { - // 번호나 식별번호 중 하나라도 있으면 유효 - const hasBasicData = !!(row.no || row.identificationNo); - - // 너무 짧은 데이터는 제외 (오인식 방지) - const hasReasonableLength = (row.identificationNo?.length || 0) >= 3 || - (row.no?.length || 0) >= 1; - - return hasBasicData && hasReasonableLength; -} +/* -------------------------------------------------------------------------- */ +/* OCR 품질 분석 (기존 로직 유지) */ +/* -------------------------------------------------------------------------- */ -// 행 신뢰도 계산 -function calculateRowConfidence(row: ExtractedRow): number { - let score = 0; - let maxScore = 0; - - // 각 필드별 가중치 - const weights = { - no: 1, - identificationNo: 3, // 가장 중요 - tagNo: 2, - jointNo: 2, - jointType: 1, - weldingDate: 1 - }; +export function analyzeOCRQuality (ocrResult: any) { + let conf = 0, cnt = 0, tbl = 0, kw = 0; + const keys = ['no.', 'identification', 'joint', 'tag', 'type', 'weld', 'date']; - Object.entries(weights).forEach(([field, weight]) => { - maxScore += weight; - const value = row[field as keyof ExtractedRow] as string; - - if (value && value.length > 0) { - // 기본 점수 - score += weight * 0.5; - - // 길이 보너스 - if (field === 'identificationNo' && value.length > 10) { - score += weight * 0.3; - } else if (field === 'no' && /^\d+$/.test(value)) { - score += weight * 0.3; - } else if (field === 'weldingDate' && /\d{4}[.\-\/]\d{1,2}[.\-\/]\d{1,2}/.test(value)) { - score += weight * 0.3; - } else if (value.length > 2) { - score += weight * 0.2; - } - } + ocrResult.images?.forEach((img: any) => { + tbl += img.tables?.length || 0; + img.fields?.forEach((f: any) => { + conf += f.inferConfidence || 0; cnt++; + const t = (f.inferText || '').toLowerCase(); + keys.forEach(k => { if (t.includes(k)) kw++; }); + }); }); - return maxScore > 0 ? Math.min(score / maxScore, 1) : 0; + return { confidence: cnt ? conf / cnt : 0, tablesFound: tbl, textQuality: cnt ? kw / cnt : 0, keywordCount: kw }; } - -// 유틸리티: OCR 결과 품질 분석 -export function analyzeOCRQuality(ocrResult: any): { - confidence: number; - tablesFound: number; - textQuality: number; - keywordCount: number; -} { - let totalConfidence = 0; - let totalFields = 0; - let tablesFound = 0; - let relevantKeywords = 0; - - const keywords = ['no.', 'identification', 'joint', 'tag', 'type', 'weld', 'date']; - - if (ocrResult.images) { - ocrResult.images.forEach((image: any) => { - // 테이블 분석 - if (image.tables) { - tablesFound += image.tables.length; - } - - // 필드 신뢰도 분석 - if (image.fields) { - image.fields.forEach((field: any) => { - const confidence = field.inferConfidence || 0; - const text = (field.inferText || '').toLowerCase(); - - totalConfidence += confidence; - totalFields++; - - // 관련 키워드 확인 - keywords.forEach(keyword => { - if (text.includes(keyword)) { - relevantKeywords++; - } - }); - }); - } - }); - } - - const avgConfidence = totalFields > 0 ? totalConfidence / totalFields : 0; - const textQuality = totalFields > 0 ? relevantKeywords / totalFields : 0; - - return { - confidence: avgConfidence, - tablesFound, - textQuality, - keywordCount: relevantKeywords - }; -} \ No newline at end of file diff --git a/app/service.ts b/app/service.ts new file mode 100644 index 00000000..5c9b9a1d --- /dev/null +++ b/app/service.ts @@ -0,0 +1,224 @@ +import { unstable_cache } from "next/cache" +import { count, desc, asc, and, or, gte, lte, ilike, eq } from "drizzle-orm" +import { filterColumns } from "@/lib/filter-columns" +import db from "@/db/db" +import { bRfqs, projects, users } from "@/db/schema" // 실제 스키마 import 경로에 맞게 수정 +import { rfqDashboardView } from "@/db/schema" // 뷰 import +import type { SQL } from "drizzle-orm" +import { GetRFQDashboardSchema } from "./validations" + +export async function getRFQDashboard(input: GetRFQDashboardSchema) { + return unstable_cache( + async () => { + try { + const offset = (input.page - 1) * input.perPage; + + const rfqFilterMapping = createRFQFilterMapping(); + const joinedTables = getRFQJoinedTables(); + + console.log(input, "RFQ Dashboard input") + + // 1) 고급 필터 조건 + let advancedWhere: SQL | undefined = undefined; + if (input.filters && input.filters.length > 0) { + advancedWhere = filterColumns({ + table: rfqDashboardView, + filters: input.filters, + joinOperator: input.joinOperator || 'and', + joinedTables, + customColumnMapping: rfqFilterMapping, + }); + } + + // 2) 기본 필터 조건 + let basicWhere: SQL | undefined = undefined; + if (input.basicFilters && input.basicFilters.length > 0) { + basicWhere = filterColumns({ + table: rfqDashboardView, + filters: input.basicFilters, + joinOperator: input.basicJoinOperator || 'and', + joinedTables, + customColumnMapping: rfqFilterMapping, + }); + } + + // 3) 글로벌 검색 조건 + let globalWhere: SQL | undefined = undefined; + if (input.search) { + const s = `%${input.search}%`; + + const validSearchConditions: SQL[] = []; + + const rfqCodeCondition = ilike(rfqDashboardView.rfqCode, s); + if (rfqCodeCondition) validSearchConditions.push(rfqCodeCondition); + + const descriptionCondition = ilike(rfqDashboardView.description, s); + if (descriptionCondition) validSearchConditions.push(descriptionCondition); + + const projectNameCondition = ilike(rfqDashboardView.projectName, s); + if (projectNameCondition) validSearchConditions.push(projectNameCondition); + + const projectCodeCondition = ilike(rfqDashboardView.projectCode, s); + if (projectCodeCondition) validSearchConditions.push(projectCodeCondition); + + const picNameCondition = ilike(rfqDashboardView.picName, s); + if (picNameCondition) validSearchConditions.push(picNameCondition); + + const packageNoCondition = ilike(rfqDashboardView.packageNo, s); + if (packageNoCondition) validSearchConditions.push(packageNoCondition); + + const packageNameCondition = ilike(rfqDashboardView.packageName, s); + if (packageNameCondition) validSearchConditions.push(packageNameCondition); + + if (validSearchConditions.length > 0) { + globalWhere = or(...validSearchConditions); + } + } + + // 4) 날짜 조건 + let dueDateFromWhere: SQL | undefined = undefined; + let dueDateToWhere: SQL | undefined = undefined; + + if (input.dueDateFrom) { + const fromDate = new Date(input.dueDateFrom); + dueDateFromWhere = gte(rfqDashboardView.dueDate, fromDate); + } + + if (input.dueDateTo) { + const toDate = new Date(input.dueDateTo); + dueDateToWhere = lte(rfqDashboardView.dueDate, toDate); + } + + // 5) 진행률 조건 + let progressWhere: SQL | undefined = undefined; + if (input.progressMin > 0 || input.progressMax < 100) { + const progressConditions: SQL[] = []; + if (input.progressMin > 0) { + progressConditions.push(gte(rfqDashboardView.overallProgress, input.progressMin)); + } + if (input.progressMax < 100) { + progressConditions.push(lte(rfqDashboardView.overallProgress, input.progressMax)); + } + if (progressConditions.length > 0) { + progressWhere = and(...progressConditions); + } + } + + // 6) 최종 WHERE 조건 생성 + const whereConditions: SQL[] = []; + + if (advancedWhere) whereConditions.push(advancedWhere); + if (basicWhere) whereConditions.push(basicWhere); + if (globalWhere) whereConditions.push(globalWhere); + if (dueDateFromWhere) whereConditions.push(dueDateFromWhere); + if (dueDateToWhere) whereConditions.push(dueDateToWhere); + if (progressWhere) whereConditions.push(progressWhere); + + const finalWhere = whereConditions.length > 0 ? and(...whereConditions) : undefined; + + // 7) 전체 데이터 수 조회 + const totalResult = await db + .select({ count: count() }) + .from(rfqDashboardView) + .where(finalWhere); + + const total = totalResult[0]?.count || 0; + + if (total === 0) { + return { data: [], pageCount: 0, total: 0 }; + } + + // 8) 정렬 및 페이징 처리된 데이터 조회 + const orderByColumns = input.sort.map((sort) => { + const column = sort.id as keyof typeof rfqDashboardView.$inferSelect; + return sort.desc ? desc(rfqDashboardView[column]) : asc(rfqDashboardView[column]); + }); + + if (orderByColumns.length === 0) { + orderByColumns.push(desc(rfqDashboardView.createdAt)); + } + + const rfqData = await db + .select() + .from(rfqDashboardView) + .where(finalWhere) + .orderBy(...orderByColumns) + .limit(input.perPage) + .offset(offset); + + const pageCount = Math.ceil(total / input.perPage); + + return { data: rfqData, pageCount, total }; + } catch (err) { + console.error("Error in getRFQDashboard:", err); + return { data: [], pageCount: 0, total: 0 }; + } + }, + [JSON.stringify(input)], + { + revalidate: 3600, + tags: ["rfq-dashboard"], + } + )(); +} + +// 헬퍼 함수들 +function createRFQFilterMapping() { + return { + // 뷰의 컬럼명과 실제 필터링할 컬럼 매핑 + rfqCode: rfqDashboardView.rfqCode, + description: rfqDashboardView.description, + status: rfqDashboardView.status, + projectName: rfqDashboardView.projectName, + projectCode: rfqDashboardView.projectCode, + picName: rfqDashboardView.picName, + packageNo: rfqDashboardView.packageNo, + packageName: rfqDashboardView.packageName, + dueDate: rfqDashboardView.dueDate, + overallProgress: rfqDashboardView.overallProgress, + createdAt: rfqDashboardView.createdAt, + }; +} + +function getRFQJoinedTables() { + return { + // 조인된 테이블 정보 (뷰이므로 실제로는 사용되지 않을 수 있음) + projects, + users, + }; +} + +// ================================================================ +// 3. RFQ Dashboard 타입 정의 +// ================================================================ +export interface RFQDashboard { + rfqId: number; + rfqCode: string; + description: string | null; + status: string; + dueDate: Date | null; + projectCode: string | null; + projectName: string | null; + projectType: string | null; + packageNo: string | null; + packageName: string | null; + picName: string | null; + totalAttachments: number; + initialVendorCount: number; + finalVendorCount: number; + initialResponseRate: number; + finalResponseRate: number; + overallProgress: number; + daysToDeadline: number; + createdAt: Date; + // 추가 계산 필드들 + statusBadge: { + variant: "default" | "outline" | "secondary" | "destructive" | "success"; + label: string; + }; + progressBadge: { + variant: "default" | "outline" | "secondary" | "destructive" | "success"; + label: string; + }; + urgencyLevel: "high" | "medium" | "low"; +} \ No newline at end of file diff --git a/components/layout/HeaderSimple.tsx b/components/layout/HeaderSimple.tsx new file mode 100644 index 00000000..f099d3ef --- /dev/null +++ b/components/layout/HeaderSimple.tsx @@ -0,0 +1,192 @@ +"use client"; + +import * as React from "react"; +import Link from "next/link"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuLabel, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; +import { + NavigationMenu, + NavigationMenuContent, + NavigationMenuItem, + NavigationMenuLink, + NavigationMenuList, + NavigationMenuTrigger, + navigationMenuTriggerStyle, +} from "@/components/ui/navigation-menu"; +import { SearchIcon, BellIcon, Menu } from "lucide-react"; +import { useParams, usePathname } from "next/navigation"; +import { cn } from "@/lib/utils"; +import Image from "next/image"; +import { mainNav, additionalNav, MenuSection, MenuItem, mainNavVendor, additionalNavVendor } from "@/config/menuConfig"; // 메뉴 구성 임포트 +import { MobileMenu } from "./MobileMenu"; +import { CommandMenu } from "./command-menu"; +import { useSession, signOut } from "next-auth/react"; +import GroupedMenuRenderer from "./GroupedMenuRender"; + +export function HeaderSimple() { + const params = useParams(); + const lng = params?.lng as string; + const pathname = usePathname(); + const { data: session } = useSession(); + + const userName = session?.user?.name || ""; + const domain = session?.user?.domain || ""; + const initials = userName + .split(" ") + .map((word) => word[0]?.toUpperCase()) + .join(""); + + + const [isMobileMenuOpen, setIsMobileMenuOpen] = React.useState(false); // 모바일 메뉴 상태 + + const toggleMobileMenu = () => { + setIsMobileMenuOpen(!isMobileMenuOpen); + }; + + const isPartnerRoute = pathname?.includes("/partners"); + + const main = isPartnerRoute ? mainNavVendor : mainNav; + const additional = isPartnerRoute ? additionalNavVendor : additionalNav; + + const basePath = `/${lng}${isPartnerRoute ? "/partners" : "/evcp"}`; + + return ( + <> + {/*
*/} +
+
+
+ {/* 햄버거 메뉴 버튼 (모바일) */} + + + {/* 로고 영역 - 항상 표시 */} +
+ + EVCP Logo + + {isPartnerRoute + ? "eVCP Partners" + : pathname?.includes("/evcp") + ? "eVCP 삼성중공업" + : "eVCP"} + + +
+ + {/* 네비게이션 메뉴 - 내부 스크롤 적용, 드롭다운은 제약 없이 표시 */} +
+ +
+ + {/* 우측 영역 - 고정 너비와 우선순위로 항상 표시되도록 함 */} +
+ {/* 데스크탑에서는 CommandMenu, 모바일에서는 검색 아이콘만 */} +
+ +
+ {/* */} + + {/* 알림 버튼 */} + {/* */} + + {/* 사용자 메뉴 (DropdownMenu) */} + + + + + + {initials || "?"} + + + + + My Account + + + Settings + + + signOut({ callbackUrl: `/${lng}/${domain}` })}> + Logout + + + +
+
+
+ + {/* 모바일 메뉴 */} + {isMobileMenuOpen && } +
+ + ); +} + +const ListItem = React.forwardRef< + React.ElementRef<"a">, + React.ComponentPropsWithoutRef<"a"> +>(({ className, title, children, ...props }, ref) => { + return ( +
  • + + +
    {title}
    + {children && ( +

    + {children} +

    + )} +
    +
    +
  • + ); +}); +ListItem.displayName = "ListItem"; \ No newline at end of file diff --git a/components/login/login-form-shi.tsx b/components/login/login-form-shi.tsx index ef39d122..d22e15a8 100644 --- a/components/login/login-form-shi.tsx +++ b/components/login/login-form-shi.tsx @@ -203,10 +203,10 @@ export function LoginFormSHI({
    {/* Here's your existing login/OTP forms: */} - {/* {!otpSent ? - ( */} - {/*
    */} - + {!otpSent ? ( + // ( */} + + {/* */}

    {t('loginMessage')}

    @@ -251,7 +251,7 @@ export function LoginFormSHI({
    - {/* ) + ) : ( @@ -305,7 +305,7 @@ export function LoginFormSHI({
    - )} */} + )}
    {t('termsMessage')} {t('termsOfService')} {t('and')} diff --git a/components/login/login-form.tsx b/components/login/login-form.tsx index 04701c3a..4f9fbb53 100644 --- a/components/login/login-form.tsx +++ b/components/login/login-form.tsx @@ -264,10 +264,10 @@ export function LoginForm({
    {/* Here's your existing login/OTP forms: */} - {/* {!otpSent ? ( */} + {!otpSent ? ( - {/*
    */} - + + {/* */}

    {t('loginMessage')}

    @@ -399,7 +399,7 @@ export function LoginForm({
    - {/* ) : ( + ) : (
    @@ -450,7 +450,7 @@ export function LoginForm({
    - )} */} + )}
    {t('termsMessage')} {t('termsOfService')} {t('and')} diff --git a/config/menuConfig.ts b/config/menuConfig.ts index b159bba9..c039ed34 100644 --- a/config/menuConfig.ts +++ b/config/menuConfig.ts @@ -210,8 +210,8 @@ export const mainNav: MenuSection[] = [ useGrouping: true, // 그룹핑 적용 items: [ { - title: "검토용 견적", - href: "/evcp/budgetary-rfq", + title: "견적 RFQ", + href: "/evcp/b-rfq", description: "예산이나 내정가를 산정하기 위해 견적을 요청하고 관리", // icon: "FileText", group: "견적/입찰 관리" diff --git a/db/migrations/0113_gifted_adam_destine.sql b/db/migrations/0113_gifted_adam_destine.sql new file mode 100644 index 00000000..4527051a --- /dev/null +++ b/db/migrations/0113_gifted_adam_destine.sql @@ -0,0 +1,92 @@ +ALTER TABLE "vendor_business_groups" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint +ALTER TABLE "vendor_internal_partners" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint +ALTER TABLE "vendor_partner_functions" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint +ALTER TABLE "vendor_purchase_organizations" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint +ALTER TABLE "vendor_representative_emails" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint +ALTER TABLE "vendor_representative_faxes" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint +ALTER TABLE "vendor_representative_telephones" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint +ALTER TABLE "vendor_representative_urls" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint +ALTER TABLE "vendor_tax_numbers" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint +ALTER TABLE "vendor_withholding_tax" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint +DROP TABLE "vendor_business_groups" CASCADE;--> statement-breakpoint +DROP TABLE "vendor_internal_partners" CASCADE;--> statement-breakpoint +DROP TABLE "vendor_partner_functions" CASCADE;--> statement-breakpoint +DROP TABLE "vendor_purchase_organizations" CASCADE;--> statement-breakpoint +DROP TABLE "vendor_representative_emails" CASCADE;--> statement-breakpoint +DROP TABLE "vendor_representative_faxes" CASCADE;--> statement-breakpoint +DROP TABLE "vendor_representative_telephones" CASCADE;--> statement-breakpoint +DROP TABLE "vendor_representative_urls" CASCADE;--> statement-breakpoint +DROP TABLE "vendor_tax_numbers" CASCADE;--> statement-breakpoint +DROP TABLE "vendor_withholding_tax" CASCADE;--> statement-breakpoint +ALTER TABLE "ocr_rows" ADD COLUMN "user_id" integer;--> statement-breakpoint +ALTER TABLE "ocr_rows" ADD CONSTRAINT "ocr_rows_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +CREATE UNIQUE INDEX "idx_ocr_row_unique" ON "ocr_rows" USING btree ("table_id","report_no","no");--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "account_group";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "account_group_type";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "customer_code";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "posting_hold_indicator";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "purchase_hold_indicator";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "hold_reason";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "delete_indicator";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "company_id";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "business_type";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "industry_type";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "registration_date";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "registration_time";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "registrar_id";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "approval_date";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "approval_time";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "approver_id";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "change_date";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "change_time";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "changer_id";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "nation_code";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "representative_tel_number";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "representative_fax_number";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "business_registration_number";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "corporate_registration_number_oracle";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "tax_code_4";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "company_establishment_date";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "vendor_type";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "global_top_code";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "global_top_name";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "domestic_top_code";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "domestic_top_name";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "business_unit_code";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "business_unit_name";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "duns_number";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "interface_date";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "interface_time";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "interface_status";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "interface_message";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "title";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "vat_registration_number";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "giro_vendor_indicator";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "vendor_name_1";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "vendor_name_2";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "vendor_name_3";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "vendor_name_4";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "vendor_name_abbreviation_1";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "vendor_name_abbreviation_2";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "potential_vendor_code";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "address_1";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "address_2";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "quality_manager_name";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "quality_manager_tel_number";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "quality_manager_email";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "sub_workplace_sequence";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "overlap_cause_code";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "document_type";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "document_number";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "partial_document";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "document_version";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "inbound_flag";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "delete_hold_indicator";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "purchase_hold_date";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "post_box";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "international_location_check_number";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "withholding_tax_gender_key";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "vendor_contract_manager_1";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "vendor_contract_manager_2";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "representative_resident_number";--> statement-breakpoint +ALTER TABLE "vendors" DROP COLUMN "company_volume"; \ No newline at end of file diff --git a/db/migrations/0114_even_callisto.sql b/db/migrations/0114_even_callisto.sql new file mode 100644 index 00000000..3b24f18b --- /dev/null +++ b/db/migrations/0114_even_callisto.sql @@ -0,0 +1 @@ +ALTER TABLE "revisions" ADD COLUMN "usage" varchar(100); \ No newline at end of file diff --git a/db/migrations/0115_clear_magik.sql b/db/migrations/0115_clear_magik.sql new file mode 100644 index 00000000..32924618 --- /dev/null +++ b/db/migrations/0115_clear_magik.sql @@ -0,0 +1,215 @@ +DROP VIEW "public"."enhanced_documents_view";--> statement-breakpoint +CREATE VIEW "public"."enhanced_documents_view" AS ( + WITH document_stats AS ( + SELECT + d.id as document_id, + COUNT(ist.id) as total_stages, + COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) as completed_stages, + CASE + WHEN COUNT(ist.id) > 0 + THEN ROUND((COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) * 100.0) / COUNT(ist.id)) + ELSE 0 + END as progress_percentage + FROM documents d + LEFT JOIN issue_stages ist ON d.id = ist.document_id + GROUP BY d.id + ), + current_stage_info AS ( + SELECT DISTINCT ON (document_id) + document_id, + id as current_stage_id, + stage_name as current_stage_name, + stage_status as current_stage_status, + stage_order as current_stage_order, + plan_date as current_stage_plan_date, + actual_date as current_stage_actual_date, + assignee_name as current_stage_assignee_name, + priority as current_stage_priority, + CASE + WHEN actual_date IS NULL AND plan_date IS NOT NULL + THEN plan_date - CURRENT_DATE + ELSE NULL + END as days_until_due, + CASE + WHEN actual_date IS NULL AND plan_date < CURRENT_DATE + THEN true + WHEN actual_date IS NOT NULL AND actual_date > plan_date + THEN true + ELSE false + END as is_overdue, + CASE + WHEN actual_date IS NOT NULL AND plan_date IS NOT NULL + THEN actual_date - plan_date + ELSE NULL + END as days_difference + FROM issue_stages + WHERE stage_status NOT IN ('COMPLETED', 'APPROVED') + ORDER BY document_id, stage_order ASC, priority DESC + ), + latest_revision_info AS ( + SELECT DISTINCT ON (ist.document_id) + ist.document_id, + r.id as latest_revision_id, + r.revision as latest_revision, + r.revision_status as latest_revision_status, + r.uploader_name as latest_revision_uploader_name, + r.submitted_date as latest_submitted_date + FROM revisions r + JOIN issue_stages ist ON r.issue_stage_id = ist.id + ORDER BY ist.document_id, r.created_at DESC + ), + -- 리비전별 첨부파일 집계 + revision_attachments AS ( + SELECT + r.id as revision_id, + COALESCE( + json_agg( + json_build_object( + 'id', da.id, + 'revisionId', da.revision_id, + 'fileName', da.file_name, + 'filePath', da.file_path, + 'fileSize', da.file_size, + 'fileType', da.file_type, + 'createdAt', da.created_at, + 'updatedAt', da.updated_at + ) ORDER BY da.created_at + ) FILTER (WHERE da.id IS NOT NULL), + '[]'::json + ) as attachments + FROM revisions r + LEFT JOIN document_attachments da ON r.id = da.revision_id + GROUP BY r.id + ), + -- 스테이지별 리비전 집계 (첨부파일 포함) + stage_revisions AS ( + SELECT + ist.id as stage_id, + COALESCE( + json_agg( + json_build_object( + 'id', r.id, + 'issueStageId', r.issue_stage_id, + 'revision', r.revision, + 'uploaderType', r.uploader_type, + 'uploaderId', r.uploader_id, + 'uploaderName', r.uploader_name, + 'comment', r.comment, + 'usage', r.usage, + 'revisionStatus', r.revision_status, + 'submittedDate', r.submitted_date, + 'uploadedAt', r.uploaded_at, + 'approvedDate', r.approved_date, + 'reviewStartDate', r.review_start_date, + 'rejectedDate', r.rejected_date, + 'reviewerId', r.reviewer_id, + 'reviewerName', r.reviewer_name, + 'reviewComments', r.review_comments, + 'createdAt', r.created_at, + 'updatedAt', r.updated_at, + 'attachments', ra.attachments + ) ORDER BY r.created_at + ) FILTER (WHERE r.id IS NOT NULL), + '[]'::json + ) as revisions + FROM issue_stages ist + LEFT JOIN revisions r ON ist.id = r.issue_stage_id + LEFT JOIN revision_attachments ra ON r.id = ra.revision_id + GROUP BY ist.id + ), + -- 문서별 스테이지 집계 (리비전 포함) + stage_aggregation AS ( + SELECT + ist.document_id, + json_agg( + json_build_object( + 'id', ist.id, + 'stageName', ist.stage_name, + 'stageStatus', ist.stage_status, + 'stageOrder', ist.stage_order, + 'planDate', ist.plan_date, + 'actualDate', ist.actual_date, + 'assigneeName', ist.assignee_name, + 'priority', ist.priority, + 'revisions', sr.revisions + ) ORDER BY ist.stage_order + ) as all_stages + FROM issue_stages ist + LEFT JOIN stage_revisions sr ON ist.id = sr.stage_id + GROUP BY ist.document_id + ), + attachment_counts AS ( + SELECT + ist.document_id, + COUNT(da.id) as attachment_count + FROM issue_stages ist + LEFT JOIN revisions r ON ist.id = r.issue_stage_id + LEFT JOIN document_attachments da ON r.id = da.revision_id + GROUP BY ist.document_id + ) + + SELECT + d.id as document_id, + d.doc_number, + d.drawing_kind, + d.vendor_doc_number, -- ✅ 벤더 문서 번호 추가 + d.title, + d.pic, + d.status, + d.issued_date, + d.contract_id, + + -- ✅ 프로젝트 및 벤더 정보 추가 + p.code as project_code, + v.vendor_name as vendor_name, + v.vendor_code as vendor_code, + + -- 현재 스테이지 정보 + csi.current_stage_id, + csi.current_stage_name, + csi.current_stage_status, + csi.current_stage_order, + csi.current_stage_plan_date, + csi.current_stage_actual_date, + csi.current_stage_assignee_name, + csi.current_stage_priority, + + -- 계산 필드 + csi.days_until_due, + csi.is_overdue, + csi.days_difference, + + -- 진행률 정보 + ds.total_stages, + ds.completed_stages, + ds.progress_percentage, + + -- 최신 리비전 정보 + lri.latest_revision_id, + lri.latest_revision, + lri.latest_revision_status, + lri.latest_revision_uploader_name, + lri.latest_submitted_date, + + -- 전체 스테이지 (리비전 및 첨부파일 포함) + COALESCE(sa.all_stages, '[]'::json) as all_stages, + + -- 기타 + COALESCE(ac.attachment_count, 0) as attachment_count, + d.created_at, + d.updated_at + + FROM documents d + -- ✅ contracts, projects, vendors 테이블 JOIN 추가 + LEFT JOIN contracts c ON d.contract_id = c.id + LEFT JOIN projects p ON c.project_id = p.id + LEFT JOIN vendors v ON c.vendor_id = v.id + + LEFT JOIN document_stats ds ON d.id = ds.document_id + LEFT JOIN current_stage_info csi ON d.id = csi.document_id + LEFT JOIN latest_revision_info lri ON d.id = lri.document_id + LEFT JOIN stage_aggregation sa ON d.id = sa.document_id + LEFT JOIN attachment_counts ac ON d.id = ac.document_id + + ORDER BY d.created_at DESC +); \ No newline at end of file diff --git a/db/migrations/0116_medical_frightful_four.sql b/db/migrations/0116_medical_frightful_four.sql new file mode 100644 index 00000000..eaf9d9c2 --- /dev/null +++ b/db/migrations/0116_medical_frightful_four.sql @@ -0,0 +1,5 @@ +ALTER TABLE "document_attachments" ADD COLUMN "upload_id" varchar(36);--> statement-breakpoint +ALTER TABLE "document_attachments" ADD COLUMN "file_id" varchar(36);--> statement-breakpoint +ALTER TABLE "document_attachments" ADD COLUMN "uploaded_by" varchar(255);--> statement-breakpoint +ALTER TABLE "document_attachments" ADD COLUMN "dolce_file_path" varchar(1024);--> statement-breakpoint +ALTER TABLE "document_attachments" ADD COLUMN "uploaded_at" timestamp; \ No newline at end of file diff --git a/db/migrations/0117_sloppy_famine.sql b/db/migrations/0117_sloppy_famine.sql new file mode 100644 index 00000000..0a39ad5d --- /dev/null +++ b/db/migrations/0117_sloppy_famine.sql @@ -0,0 +1 @@ +ALTER TABLE "document_attachments" ADD COLUMN "user_id" varchar(255); \ No newline at end of file diff --git a/db/migrations/0118_condemned_junta.sql b/db/migrations/0118_condemned_junta.sql new file mode 100644 index 00000000..af128d5a --- /dev/null +++ b/db/migrations/0118_condemned_junta.sql @@ -0,0 +1 @@ +ALTER TABLE "document_attachments" DROP COLUMN "user_id"; \ No newline at end of file diff --git a/db/migrations/0119_flowery_kabuki.sql b/db/migrations/0119_flowery_kabuki.sql new file mode 100644 index 00000000..fc127bf0 --- /dev/null +++ b/db/migrations/0119_flowery_kabuki.sql @@ -0,0 +1,2 @@ +DROP INDEX "idx_ocr_row_unique";--> statement-breakpoint +CREATE UNIQUE INDEX "idx_ocr_report_no_unique" ON "ocr_rows" USING btree ("report_no","no"); \ No newline at end of file diff --git a/db/migrations/0120_broad_lenny_balinger.sql b/db/migrations/0120_broad_lenny_balinger.sql new file mode 100644 index 00000000..84770058 --- /dev/null +++ b/db/migrations/0120_broad_lenny_balinger.sql @@ -0,0 +1,2 @@ +DROP INDEX "idx_ocr_report_no_unique";--> statement-breakpoint +CREATE UNIQUE INDEX "idx_ocr_report_no_unique" ON "ocr_rows" USING btree ("report_no","no","tag_no","joint_no","joint_type"); \ No newline at end of file diff --git a/db/migrations/0121_gigantic_shinko_yamashiro.sql b/db/migrations/0121_gigantic_shinko_yamashiro.sql new file mode 100644 index 00000000..2d3b4308 --- /dev/null +++ b/db/migrations/0121_gigantic_shinko_yamashiro.sql @@ -0,0 +1,223 @@ +DROP VIEW "public"."enhanced_documents_view";--> statement-breakpoint +CREATE VIEW "public"."enhanced_documents_view" AS ( + WITH document_stats AS ( + SELECT + d.id as document_id, + COUNT(ist.id) as total_stages, + COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) as completed_stages, + CASE + WHEN COUNT(ist.id) > 0 + THEN ROUND((COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) * 100.0) / COUNT(ist.id)) + ELSE 0 + END as progress_percentage + FROM documents d + LEFT JOIN issue_stages ist ON d.id = ist.document_id + GROUP BY d.id + ), + current_stage_info AS ( + SELECT DISTINCT ON (document_id) + document_id, + id as current_stage_id, + stage_name as current_stage_name, + stage_status as current_stage_status, + stage_order as current_stage_order, + plan_date as current_stage_plan_date, + actual_date as current_stage_actual_date, + assignee_name as current_stage_assignee_name, + priority as current_stage_priority, + CASE + WHEN actual_date IS NULL AND plan_date IS NOT NULL + THEN plan_date - CURRENT_DATE + ELSE NULL + END as days_until_due, + CASE + WHEN actual_date IS NULL AND plan_date < CURRENT_DATE + THEN true + WHEN actual_date IS NOT NULL AND actual_date > plan_date + THEN true + ELSE false + END as is_overdue, + CASE + WHEN actual_date IS NOT NULL AND plan_date IS NOT NULL + THEN actual_date - plan_date + ELSE NULL + END as days_difference + FROM issue_stages + WHERE stage_status NOT IN ('COMPLETED', 'APPROVED') + ORDER BY document_id, stage_order ASC, priority DESC + ), + latest_revision_info AS ( + SELECT DISTINCT ON (ist.document_id) + ist.document_id, + r.id as latest_revision_id, + r.revision as latest_revision, + r.revision_status as latest_revision_status, + r.uploader_name as latest_revision_uploader_name, + r.submitted_date as latest_submitted_date + FROM revisions r + JOIN issue_stages ist ON r.issue_stage_id = ist.id + ORDER BY ist.document_id, r.created_at DESC + ), + -- 리비전별 첨부파일 집계 + revision_attachments AS ( + SELECT + r.id as revision_id, + COALESCE( + json_agg( + json_build_object( + 'id', da.id, + 'revisionId', da.revision_id, + 'fileName', da.file_name, + 'filePath', da.file_path, + 'fileSize', da.file_size, + 'fileType', da.file_type, + 'createdAt', da.created_at, + 'updatedAt', da.updated_at + ) ORDER BY da.created_at + ) FILTER (WHERE da.id IS NOT NULL), + '[]'::json + ) as attachments + FROM revisions r + LEFT JOIN document_attachments da ON r.id = da.revision_id + GROUP BY r.id + ), + -- 스테이지별 리비전 집계 (첨부파일 포함) + stage_revisions AS ( + SELECT + ist.id as stage_id, + COALESCE( + json_agg( + json_build_object( + 'id', r.id, + 'issueStageId', r.issue_stage_id, + 'revision', r.revision, + 'uploaderType', r.uploader_type, + 'uploaderId', r.uploader_id, + 'uploaderName', r.uploader_name, + 'comment', r.comment, + 'usage', r.usage, + 'revisionStatus', r.revision_status, + 'submittedDate', r.submitted_date, + 'uploadedAt', r.uploaded_at, + 'approvedDate', r.approved_date, + 'reviewStartDate', r.review_start_date, + 'rejectedDate', r.rejected_date, + 'reviewerId', r.reviewer_id, + 'reviewerName', r.reviewer_name, + 'reviewComments', r.review_comments, + 'createdAt', r.created_at, + 'updatedAt', r.updated_at, + 'attachments', ra.attachments + ) ORDER BY r.created_at + ) FILTER (WHERE r.id IS NOT NULL), + '[]'::json + ) as revisions + FROM issue_stages ist + LEFT JOIN revisions r ON ist.id = r.issue_stage_id + LEFT JOIN revision_attachments ra ON r.id = ra.revision_id + GROUP BY ist.id + ), + -- 문서별 스테이지 집계 (리비전 포함) + stage_aggregation AS ( + SELECT + ist.document_id, + json_agg( + json_build_object( + 'id', ist.id, + 'stageName', ist.stage_name, + 'stageStatus', ist.stage_status, + 'stageOrder', ist.stage_order, + 'planDate', ist.plan_date, + 'actualDate', ist.actual_date, + 'assigneeName', ist.assignee_name, + 'priority', ist.priority, + 'revisions', sr.revisions + ) ORDER BY ist.stage_order + ) as all_stages + FROM issue_stages ist + LEFT JOIN stage_revisions sr ON ist.id = sr.stage_id + GROUP BY ist.document_id + ), + attachment_counts AS ( + SELECT + ist.document_id, + COUNT(da.id) as attachment_count + FROM issue_stages ist + LEFT JOIN revisions r ON ist.id = r.issue_stage_id + LEFT JOIN document_attachments da ON r.id = da.revision_id + GROUP BY ist.document_id + ) + + SELECT + d.id as document_id, + d.doc_number, + d.drawing_kind, + d.vendor_doc_number, -- ✅ 벤더 문서 번호 추가 + d.title, + d.pic, + d.status, + d.issued_date, + d.contract_id, + + d.cGbn, + d.dGbn, + d.degreeGbn, + d.deptGbn, + d.sGbn, + + + + -- ✅ 프로젝트 및 벤더 정보 추가 + p.code as project_code, + v.vendor_name as vendor_name, + v.vendor_code as vendor_code, + + -- 현재 스테이지 정보 + csi.current_stage_id, + csi.current_stage_name, + csi.current_stage_status, + csi.current_stage_order, + csi.current_stage_plan_date, + csi.current_stage_actual_date, + csi.current_stage_assignee_name, + csi.current_stage_priority, + + -- 계산 필드 + csi.days_until_due, + csi.is_overdue, + csi.days_difference, + + -- 진행률 정보 + ds.total_stages, + ds.completed_stages, + ds.progress_percentage, + + -- 최신 리비전 정보 + lri.latest_revision_id, + lri.latest_revision, + lri.latest_revision_status, + lri.latest_revision_uploader_name, + lri.latest_submitted_date, + + -- 전체 스테이지 (리비전 및 첨부파일 포함) + COALESCE(sa.all_stages, '[]'::json) as all_stages, + + -- 기타 + COALESCE(ac.attachment_count, 0) as attachment_count, + d.created_at, + d.updated_at + + FROM documents d + -- ✅ contracts, projects, vendors 테이블 JOIN 추가 + LEFT JOIN contracts c ON d.contract_id = c.id + LEFT JOIN projects p ON c.project_id = p.id + LEFT JOIN vendors v ON c.vendor_id = v.id + + LEFT JOIN document_stats ds ON d.id = ds.document_id + LEFT JOIN current_stage_info csi ON d.id = csi.document_id + LEFT JOIN latest_revision_info lri ON d.id = lri.document_id + LEFT JOIN stage_aggregation sa ON d.id = sa.document_id + LEFT JOIN attachment_counts ac ON d.id = ac.document_id + + ORDER BY d.created_at DESC +); \ No newline at end of file diff --git a/db/migrations/0122_eager_celestials.sql b/db/migrations/0122_eager_celestials.sql new file mode 100644 index 00000000..ca0a9a08 --- /dev/null +++ b/db/migrations/0122_eager_celestials.sql @@ -0,0 +1,223 @@ +DROP VIEW "public"."enhanced_documents_view";--> statement-breakpoint +CREATE VIEW "public"."enhanced_documents_view" AS ( + WITH document_stats AS ( + SELECT + d.id as document_id, + COUNT(ist.id) as total_stages, + COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) as completed_stages, + CASE + WHEN COUNT(ist.id) > 0 + THEN ROUND((COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) * 100.0) / COUNT(ist.id)) + ELSE 0 + END as progress_percentage + FROM documents d + LEFT JOIN issue_stages ist ON d.id = ist.document_id + GROUP BY d.id + ), + current_stage_info AS ( + SELECT DISTINCT ON (document_id) + document_id, + id as current_stage_id, + stage_name as current_stage_name, + stage_status as current_stage_status, + stage_order as current_stage_order, + plan_date as current_stage_plan_date, + actual_date as current_stage_actual_date, + assignee_name as current_stage_assignee_name, + priority as current_stage_priority, + CASE + WHEN actual_date IS NULL AND plan_date IS NOT NULL + THEN plan_date - CURRENT_DATE + ELSE NULL + END as days_until_due, + CASE + WHEN actual_date IS NULL AND plan_date < CURRENT_DATE + THEN true + WHEN actual_date IS NOT NULL AND actual_date > plan_date + THEN true + ELSE false + END as is_overdue, + CASE + WHEN actual_date IS NOT NULL AND plan_date IS NOT NULL + THEN actual_date - plan_date + ELSE NULL + END as days_difference + FROM issue_stages + WHERE stage_status NOT IN ('COMPLETED', 'APPROVED') + ORDER BY document_id, stage_order ASC, priority DESC + ), + latest_revision_info AS ( + SELECT DISTINCT ON (ist.document_id) + ist.document_id, + r.id as latest_revision_id, + r.revision as latest_revision, + r.revision_status as latest_revision_status, + r.uploader_name as latest_revision_uploader_name, + r.submitted_date as latest_submitted_date + FROM revisions r + JOIN issue_stages ist ON r.issue_stage_id = ist.id + ORDER BY ist.document_id, r.created_at DESC + ), + -- 리비전별 첨부파일 집계 + revision_attachments AS ( + SELECT + r.id as revision_id, + COALESCE( + json_agg( + json_build_object( + 'id', da.id, + 'revisionId', da.revision_id, + 'fileName', da.file_name, + 'filePath', da.file_path, + 'fileSize', da.file_size, + 'fileType', da.file_type, + 'createdAt', da.created_at, + 'updatedAt', da.updated_at + ) ORDER BY da.created_at + ) FILTER (WHERE da.id IS NOT NULL), + '[]'::json + ) as attachments + FROM revisions r + LEFT JOIN document_attachments da ON r.id = da.revision_id + GROUP BY r.id + ), + -- 스테이지별 리비전 집계 (첨부파일 포함) + stage_revisions AS ( + SELECT + ist.id as stage_id, + COALESCE( + json_agg( + json_build_object( + 'id', r.id, + 'issueStageId', r.issue_stage_id, + 'revision', r.revision, + 'uploaderType', r.uploader_type, + 'uploaderId', r.uploader_id, + 'uploaderName', r.uploader_name, + 'comment', r.comment, + 'usage', r.usage, + 'revisionStatus', r.revision_status, + 'submittedDate', r.submitted_date, + 'uploadedAt', r.uploaded_at, + 'approvedDate', r.approved_date, + 'reviewStartDate', r.review_start_date, + 'rejectedDate', r.rejected_date, + 'reviewerId', r.reviewer_id, + 'reviewerName', r.reviewer_name, + 'reviewComments', r.review_comments, + 'createdAt', r.created_at, + 'updatedAt', r.updated_at, + 'attachments', ra.attachments + ) ORDER BY r.created_at + ) FILTER (WHERE r.id IS NOT NULL), + '[]'::json + ) as revisions + FROM issue_stages ist + LEFT JOIN revisions r ON ist.id = r.issue_stage_id + LEFT JOIN revision_attachments ra ON r.id = ra.revision_id + GROUP BY ist.id + ), + -- 문서별 스테이지 집계 (리비전 포함) + stage_aggregation AS ( + SELECT + ist.document_id, + json_agg( + json_build_object( + 'id', ist.id, + 'stageName', ist.stage_name, + 'stageStatus', ist.stage_status, + 'stageOrder', ist.stage_order, + 'planDate', ist.plan_date, + 'actualDate', ist.actual_date, + 'assigneeName', ist.assignee_name, + 'priority', ist.priority, + 'revisions', sr.revisions + ) ORDER BY ist.stage_order + ) as all_stages + FROM issue_stages ist + LEFT JOIN stage_revisions sr ON ist.id = sr.stage_id + GROUP BY ist.document_id + ), + attachment_counts AS ( + SELECT + ist.document_id, + COUNT(da.id) as attachment_count + FROM issue_stages ist + LEFT JOIN revisions r ON ist.id = r.issue_stage_id + LEFT JOIN document_attachments da ON r.id = da.revision_id + GROUP BY ist.document_id + ) + + SELECT + d.id as document_id, + d.doc_number, + d.drawing_kind, + d.vendor_doc_number, -- ✅ 벤더 문서 번호 추가 + d.title, + d.pic, + d.status, + d.issued_date, + d.contract_id, + + d.c_gbn, + d.d_gbn, + d.degree_gbn, + d.dept_gbn, + d.s_gbn, + + + + -- ✅ 프로젝트 및 벤더 정보 추가 + p.code as project_code, + v.vendor_name as vendor_name, + v.vendor_code as vendor_code, + + -- 현재 스테이지 정보 + csi.current_stage_id, + csi.current_stage_name, + csi.current_stage_status, + csi.current_stage_order, + csi.current_stage_plan_date, + csi.current_stage_actual_date, + csi.current_stage_assignee_name, + csi.current_stage_priority, + + -- 계산 필드 + csi.days_until_due, + csi.is_overdue, + csi.days_difference, + + -- 진행률 정보 + ds.total_stages, + ds.completed_stages, + ds.progress_percentage, + + -- 최신 리비전 정보 + lri.latest_revision_id, + lri.latest_revision, + lri.latest_revision_status, + lri.latest_revision_uploader_name, + lri.latest_submitted_date, + + -- 전체 스테이지 (리비전 및 첨부파일 포함) + COALESCE(sa.all_stages, '[]'::json) as all_stages, + + -- 기타 + COALESCE(ac.attachment_count, 0) as attachment_count, + d.created_at, + d.updated_at + + FROM documents d + -- ✅ contracts, projects, vendors 테이블 JOIN 추가 + LEFT JOIN contracts c ON d.contract_id = c.id + LEFT JOIN projects p ON c.project_id = p.id + LEFT JOIN vendors v ON c.vendor_id = v.id + + LEFT JOIN document_stats ds ON d.id = ds.document_id + LEFT JOIN current_stage_info csi ON d.id = csi.document_id + LEFT JOIN latest_revision_info lri ON d.id = lri.document_id + LEFT JOIN stage_aggregation sa ON d.id = sa.document_id + LEFT JOIN attachment_counts ac ON d.id = ac.document_id + + ORDER BY d.created_at DESC +); \ No newline at end of file diff --git a/db/migrations/0123_magenta_nightcrawler.sql b/db/migrations/0123_magenta_nightcrawler.sql new file mode 100644 index 00000000..e18ec150 --- /dev/null +++ b/db/migrations/0123_magenta_nightcrawler.sql @@ -0,0 +1,351 @@ +CREATE TABLE "b_rfq_attachment_revisions" ( + "id" serial PRIMARY KEY NOT NULL, + "attachment_id" integer NOT NULL, + "revision_no" varchar(10) NOT NULL, + "file_name" varchar(255) NOT NULL, + "original_file_name" varchar(255) NOT NULL, + "file_path" varchar(512) NOT NULL, + "file_size" integer, + "file_type" varchar(100), + "is_latest" boolean DEFAULT true NOT NULL, + "revision_comment" text, + "created_by" integer NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "b_rfqs" ( + "id" serial PRIMARY KEY NOT NULL, + "rfq_code" varchar(50), + "project_id" integer, + "description" varchar(255), + "remark" text, + "due_date" date NOT NULL, + "status" varchar(30) DEFAULT 'DRAFT' NOT NULL, + "pic_code" varchar(50), + "pic_name" varchar(50), + "eng_pic_name" varchar(50), + "project_company" varchar(255), + "project_flag" varchar(255), + "project_site" varchar(255), + "package_no" varchar(50), + "package_name" varchar(255), + "created_by" integer NOT NULL, + "updated_by" integer NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL, + CONSTRAINT "b_rfqs_rfq_code_unique" UNIQUE("rfq_code") +); +--> statement-breakpoint +CREATE TABLE "b_rfq_attachments" ( + "id" serial PRIMARY KEY NOT NULL, + "attachment_type" varchar(50) NOT NULL, + "serial_no" varchar(50) NOT NULL, + "rfq_id" integer NOT NULL, + "file_name" varchar(255) NOT NULL, + "original_file_name" varchar(255) NOT NULL, + "file_path" varchar(512) NOT NULL, + "file_size" integer, + "file_type" varchar(100), + "description" varchar(500), + "created_by" integer NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "final_rfq" ( + "id" serial PRIMARY KEY NOT NULL, + "rfq_id" integer NOT NULL, + "final_rfq_status" varchar(30) DEFAULT 'DRAFT' NOT NULL, + "vendor_id" integer NOT NULL, + "due_date" date NOT NULL, + "valid_date" date, + "incoterms_code" varchar(20), + "gtc" varchar(255), + "gtc_valid_date" varchar(255), + "classification" varchar(255), + "sparepart" varchar(255), + "short_list" boolean DEFAULT false NOT NULL, + "return_yn" boolean DEFAULT false NOT NULL, + "cp_request_yn" boolean DEFAULT false NOT NULL, + "prject_gtc_yn" boolean DEFAULT true NOT NULL, + "return_revision" integer DEFAULT 0 NOT NULL, + "currency" varchar(10) DEFAULT 'KRW', + "payment_terms_code" varchar(50), + "tax_code" varchar(255) DEFAULT 'VV', + "delivery_date" date NOT NULL, + "place_of_shipping" varchar(255), + "place_of_destination" varchar(255), + "firsttime_yn" boolean DEFAULT true NOT NULL, + "material_price_related_yn" boolean DEFAULT false, + "remark" text, + "vendor_remark" text, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "initial_rfq" ( + "id" serial PRIMARY KEY NOT NULL, + "rfq_id" integer NOT NULL, + "initial_rfq_status" varchar(30) DEFAULT 'DRAFT' NOT NULL, + "vendor_id" integer NOT NULL, + "due_date" date NOT NULL, + "valid_date" date, + "incoterms_code" varchar(20), + "gtc" varchar(255), + "gtc_valid_date" varchar(255), + "classification" varchar(255), + "sparepart" varchar(255), + "short_list" boolean DEFAULT false NOT NULL, + "return_yn" boolean DEFAULT false NOT NULL, + "cp_request_yn" boolean DEFAULT false NOT NULL, + "prject_gtc_yn" boolean DEFAULT false NOT NULL, + "return_revision" integer DEFAULT 0 NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "vendor_attachment_responses" ( + "id" serial PRIMARY KEY NOT NULL, + "attachment_id" integer NOT NULL, + "vendor_id" integer NOT NULL, + "rfq_type" varchar(20) NOT NULL, + "rfq_record_id" integer NOT NULL, + "response_status" varchar(30) DEFAULT 'NOT_RESPONDED' NOT NULL, + "current_revision" varchar(10) DEFAULT 'Rev.0', + "responded_revision" varchar(10), + "response_comment" text, + "vendor_comment" text, + "requested_at" timestamp NOT NULL, + "responded_at" timestamp, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "vendor_response_history" ( + "id" serial PRIMARY KEY NOT NULL, + "vendor_response_id" integer NOT NULL, + "action" varchar(50) NOT NULL, + "previous_status" varchar(30), + "new_status" varchar(30), + "comment" text, + "action_by" integer, + "action_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +ALTER TABLE "b_rfq_attachment_revisions" ADD CONSTRAINT "b_rfq_attachment_revisions_attachment_id_b_rfq_attachments_id_fk" FOREIGN KEY ("attachment_id") REFERENCES "public"."b_rfq_attachments"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "b_rfq_attachment_revisions" ADD CONSTRAINT "b_rfq_attachment_revisions_created_by_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "b_rfqs" ADD CONSTRAINT "b_rfqs_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "b_rfqs" ADD CONSTRAINT "b_rfqs_created_by_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "b_rfqs" ADD CONSTRAINT "b_rfqs_updated_by_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "b_rfq_attachments" ADD CONSTRAINT "b_rfq_attachments_rfq_id_b_rfqs_id_fk" FOREIGN KEY ("rfq_id") REFERENCES "public"."b_rfqs"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "b_rfq_attachments" ADD CONSTRAINT "b_rfq_attachments_created_by_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "final_rfq" ADD CONSTRAINT "final_rfq_rfq_id_b_rfqs_id_fk" FOREIGN KEY ("rfq_id") REFERENCES "public"."b_rfqs"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "final_rfq" ADD CONSTRAINT "final_rfq_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "final_rfq" ADD CONSTRAINT "final_rfq_incoterms_code_incoterms_code_fk" FOREIGN KEY ("incoterms_code") REFERENCES "public"."incoterms"("code") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "final_rfq" ADD CONSTRAINT "final_rfq_payment_terms_code_payment_terms_code_fk" FOREIGN KEY ("payment_terms_code") REFERENCES "public"."payment_terms"("code") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "initial_rfq" ADD CONSTRAINT "initial_rfq_rfq_id_b_rfqs_id_fk" FOREIGN KEY ("rfq_id") REFERENCES "public"."b_rfqs"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "initial_rfq" ADD CONSTRAINT "initial_rfq_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "initial_rfq" ADD CONSTRAINT "initial_rfq_incoterms_code_incoterms_code_fk" FOREIGN KEY ("incoterms_code") REFERENCES "public"."incoterms"("code") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_attachment_responses" ADD CONSTRAINT "vendor_attachment_responses_attachment_id_b_rfq_attachments_id_fk" FOREIGN KEY ("attachment_id") REFERENCES "public"."b_rfq_attachments"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_attachment_responses" ADD CONSTRAINT "vendor_attachment_responses_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_response_history" ADD CONSTRAINT "vendor_response_history_vendor_response_id_vendor_attachment_responses_id_fk" FOREIGN KEY ("vendor_response_id") REFERENCES "public"."vendor_attachment_responses"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_response_history" ADD CONSTRAINT "vendor_response_history_action_by_users_id_fk" FOREIGN KEY ("action_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +CREATE UNIQUE INDEX "latest_revision_idx" ON "b_rfq_attachment_revisions" USING btree ("attachment_id","is_latest");--> statement-breakpoint +CREATE UNIQUE INDEX "vendor_response_idx" ON "vendor_attachment_responses" USING btree ("attachment_id","vendor_id","rfq_type");--> statement-breakpoint +CREATE VIEW "public"."b_rfqs_master" AS ( + SELECT + br.id as rfq_id, + br.rfq_code, + br.description, + br.status, + br.due_date, + br.pic_code, + br.pic_name, + br.eng_pic_name, + br.package_no, + br.package_name, + br.project_id, + p.code as project_code, + p.name as project_name, + p.type as project_type, + br.project_company, + br.project_flag, + br.project_site, + COALESCE(att_count.total_attachments, 0) as total_attachments, + br.created_at, + br.updated_at + FROM b_rfqs br + LEFT JOIN projects p ON br.project_id = p.id + LEFT JOIN ( + SELECT rfq_id, COUNT(*) as total_attachments + FROM b_rfq_attachments + GROUP BY rfq_id + ) att_count ON br.id = att_count.rfq_id +);--> statement-breakpoint +CREATE VIEW "public"."final_rfq_detail" AS ( + SELECT + br.id as rfq_id, + br.rfq_code, + br.status as rfq_status, + fr.id as final_rfq_id, + fr.final_rfq_status, + fr.vendor_id, + v.vendor_code, + v.vendor_name, + v.country as vendor_country, + v.business_size as vendor_business_size, + fr.due_date, + fr.valid_date, + fr.delivery_date, + fr.incoterms_code, + inc.description as incoterms_description, + fr.payment_terms_code, + pt.description as payment_terms_description, + fr.currency, + fr.tax_code, + fr.place_of_shipping, + fr.place_of_destination, + fr.short_list, + fr.return_yn, + fr.cp_request_yn, + fr.prject_gtc_yn, + fr.firsttime_yn, + fr.material_price_related_yn, + fr.return_revision, + fr.gtc, + fr.gtc_valid_date, + fr.classification, + fr.sparepart, + fr.remark, + fr.vendor_remark, + fr.created_at, + fr.updated_at + FROM b_rfqs br + JOIN final_rfq fr ON br.id = fr.rfq_id + LEFT JOIN vendors v ON fr.vendor_id = v.id + LEFT JOIN incoterms inc ON fr.incoterms_code = inc.code + LEFT JOIN payment_terms pt ON fr.payment_terms_code = pt.code +);--> statement-breakpoint +CREATE VIEW "public"."initial_rfq_detail" AS ( + SELECT + br.id as rfq_id, + br.rfq_code, + br.status as rfq_status, + ir.id as initial_rfq_id, + ir.initial_rfq_status, + ir.vendor_id, + v.vendor_code, + v.vendor_name, + v.country as vendor_country, + v.business_size as vendor_business_size, + ir.due_date, + ir.valid_date, + ir.incoterms_code, + inc.description as incoterms_description, + ir.incoterms_detail, + ir.short_list, + ir.return_yn, + ir.cp_request_yn, + ir.prject_gtc_yn, + ir.return_revision, + ir.gtc, + ir.gtc_valid_date, + ir.classification, + ir.sparepart, + ir.created_at, + ir.updated_at + FROM b_rfqs br + JOIN initial_rfq ir ON br.id = ir.rfq_id + LEFT JOIN vendors v ON ir.vendor_id = v.id + LEFT JOIN incoterms inc ON ir.incoterms_code = inc.code +);--> statement-breakpoint +CREATE VIEW "public"."rfq_dashboard" AS ( + SELECT + br.id as rfq_id, + br.rfq_code, + br.description, + br.status, + br.due_date, + p.code as project_code, + p.name as project_name, + br.package_no, + br.package_name, + br.pic_name, + COALESCE(att_count.total_attachments, 0) as total_attachments, + COALESCE(init_summary.vendor_count, 0) as initial_vendor_count, + COALESCE(final_summary.vendor_count, 0) as final_vendor_count, + COALESCE(init_summary.avg_response_rate, 0) as initial_response_rate, + COALESCE(final_summary.avg_response_rate, 0) as final_response_rate, + CASE + WHEN br.status = 'DRAFT' THEN 0 + WHEN br.status = 'Doc. Received' THEN 10 + WHEN br.status = 'PIC Assigned' THEN 20 + WHEN br.status = 'Doc. Confirmed' THEN 30 + WHEN br.status = 'Init. RFQ Sent' THEN 40 + WHEN br.status = 'Init. RFQ Answered' THEN 50 + WHEN br.status = 'TBE started' THEN 60 + WHEN br.status = 'TBE finished' THEN 70 + WHEN br.status = 'Final RFQ Sent' THEN 80 + WHEN br.status = 'Quotation Received' THEN 90 + WHEN br.status = 'Vendor Selected' THEN 100 + ELSE 0 + END as overall_progress, + (br.due_date - CURRENT_DATE) as days_to_deadline, + br.created_at + FROM b_rfqs br + LEFT JOIN projects p ON br.project_id = p.id + LEFT JOIN ( + SELECT rfq_id, COUNT(*) as total_attachments + FROM b_rfq_attachments + GROUP BY rfq_id + ) att_count ON br.id = att_count.rfq_id + LEFT JOIN ( + SELECT + rfq_id, + COUNT(DISTINCT vendor_id) as vendor_count, + AVG(response_rate) as avg_response_rate + FROM vendor_response_summary + WHERE rfq_type = 'INITIAL' + GROUP BY rfq_id + ) init_summary ON br.id = init_summary.rfq_id + LEFT JOIN ( + SELECT + rfq_id, + COUNT(DISTINCT vendor_id) as vendor_count, + AVG(response_rate) as avg_response_rate + FROM vendor_response_summary + WHERE rfq_type = 'FINAL' + GROUP BY rfq_id + ) final_summary ON br.id = final_summary.rfq_id +);--> statement-breakpoint +CREATE VIEW "public"."vendor_response_summary" AS ( + SELECT + br.id as rfq_id, + br.rfq_code, + br.status as rfq_status, + v.id as vendor_id, + v.vendor_code, + v.vendor_name, + v.country as vendor_country, + v.business_size as vendor_business_size, + var.rfq_type, + COUNT(var.id) as total_attachments, + COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) as responded_count, + COUNT(CASE WHEN var.response_status = 'NOT_RESPONDED' THEN 1 END) as pending_count, + COUNT(CASE WHEN var.response_status = 'WAIVED' THEN 1 END) as waived_count, + COUNT(CASE WHEN var.response_status = 'REVISION_REQUESTED' THEN 1 END) as revision_requested_count, + ROUND( + (COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) * 100.0 / + NULLIF(COUNT(CASE WHEN var.response_status != 'WAIVED' THEN 1 END), 0)), + 2 + ) as response_rate, + ROUND( + ((COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) + + COUNT(CASE WHEN var.response_status = 'WAIVED' THEN 1 END)) * 100.0 / COUNT(var.id)), + 2 + ) as completion_rate + FROM b_rfqs br + JOIN b_rfq_attachments bra ON br.id = bra.rfq_id + JOIN vendor_attachment_responses var ON bra.id = var.attachment_id + JOIN vendors v ON var.vendor_id = v.id + GROUP BY br.id, br.rfq_code, br.status, v.id, v.vendor_code, v.vendor_name, v.country, v.business_size, var.rfq_type +); \ No newline at end of file diff --git a/db/migrations/0124_sparkling_shinko_yamashiro.sql b/db/migrations/0124_sparkling_shinko_yamashiro.sql new file mode 100644 index 00000000..2affccea --- /dev/null +++ b/db/migrations/0124_sparkling_shinko_yamashiro.sql @@ -0,0 +1,48 @@ +CREATE TABLE "vendor_response_attachments_b" ( + "id" serial PRIMARY KEY NOT NULL, + "vendor_response_id" integer NOT NULL, + "file_name" varchar(255) NOT NULL, + "original_file_name" varchar(255) NOT NULL, + "file_path" varchar(512) NOT NULL, + "file_size" integer, + "file_type" varchar(100), + "description" varchar(500), + "uploaded_by" integer, + "uploaded_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +DROP VIEW "public"."initial_rfq_detail";--> statement-breakpoint +ALTER TABLE "vendor_response_attachments_b" ADD CONSTRAINT "vendor_response_attachments_b_vendor_response_id_vendor_attachment_responses_id_fk" FOREIGN KEY ("vendor_response_id") REFERENCES "public"."vendor_attachment_responses"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_response_attachments_b" ADD CONSTRAINT "vendor_response_attachments_b_uploaded_by_users_id_fk" FOREIGN KEY ("uploaded_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +CREATE VIEW "public"."initial_rfq_detail" AS ( + SELECT + br.id as rfq_id, + br.rfq_code, + br.status as rfq_status, + ir.id as initial_rfq_id, + ir.initial_rfq_status, + ir.vendor_id, + v.vendor_code, + v.vendor_name, + v.country as vendor_country, + v.business_size as vendor_business_size, + ir.due_date, + ir.valid_date, + ir.incoterms_code, + inc.description as incoterms_description, + ir.short_list, + ir.return_yn, + ir.cp_request_yn, + ir.prject_gtc_yn, + ir.return_revision, + ir.gtc, + ir.gtc_valid_date, + ir.classification, + ir.sparepart, + ir.created_at, + ir.updated_at + FROM b_rfqs br + JOIN initial_rfq ir ON br.id = ir.rfq_id + LEFT JOIN vendors v ON ir.vendor_id = v.id + LEFT JOIN incoterms inc ON ir.incoterms_code = inc.code +); \ No newline at end of file diff --git a/db/migrations/0125_handy_shaman.sql b/db/migrations/0125_handy_shaman.sql new file mode 100644 index 00000000..5d7c4beb --- /dev/null +++ b/db/migrations/0125_handy_shaman.sql @@ -0,0 +1,62 @@ +DROP VIEW "public"."rfq_dashboard";--> statement-breakpoint +CREATE VIEW "public"."rfq_dashboard" AS ( + SELECT + br.id as rfq_id, + br.rfq_code, + br.description, + br.status, + br.due_date, + p.code as project_code, + p.name as project_name, + br.package_no, + br.package_name, + br.pic_code, + br.pic_name, + br.eng_pic_name, + COALESCE(att_count.total_attachments, 0) as total_attachments, + COALESCE(init_summary.vendor_count, 0) as initial_vendor_count, + COALESCE(final_summary.vendor_count, 0) as final_vendor_count, + COALESCE(init_summary.avg_response_rate, 0) as initial_response_rate, + COALESCE(final_summary.avg_response_rate, 0) as final_response_rate, + CASE + WHEN br.status = 'DRAFT' THEN 0 + WHEN br.status = 'Doc. Received' THEN 10 + WHEN br.status = 'PIC Assigned' THEN 20 + WHEN br.status = 'Doc. Confirmed' THEN 30 + WHEN br.status = 'Init. RFQ Sent' THEN 40 + WHEN br.status = 'Init. RFQ Answered' THEN 50 + WHEN br.status = 'TBE started' THEN 60 + WHEN br.status = 'TBE finished' THEN 70 + WHEN br.status = 'Final RFQ Sent' THEN 80 + WHEN br.status = 'Quotation Received' THEN 90 + WHEN br.status = 'Vendor Selected' THEN 100 + ELSE 0 + END as overall_progress, + (br.due_date - CURRENT_DATE) as days_to_deadline, + br.created_at + FROM b_rfqs br + LEFT JOIN projects p ON br.project_id = p.id + LEFT JOIN ( + SELECT rfq_id, COUNT(*) as total_attachments + FROM b_rfq_attachments + GROUP BY rfq_id + ) att_count ON br.id = att_count.rfq_id + LEFT JOIN ( + SELECT + rfq_id, + COUNT(DISTINCT vendor_id) as vendor_count, + AVG(response_rate) as avg_response_rate + FROM vendor_response_summary + WHERE rfq_type = 'INITIAL' + GROUP BY rfq_id + ) init_summary ON br.id = init_summary.rfq_id + LEFT JOIN ( + SELECT + rfq_id, + COUNT(DISTINCT vendor_id) as vendor_count, + AVG(response_rate) as avg_response_rate + FROM vendor_response_summary + WHERE rfq_type = 'FINAL' + GROUP BY rfq_id + ) final_summary ON br.id = final_summary.rfq_id +); \ No newline at end of file diff --git a/db/migrations/0126_vengeful_kid_colt.sql b/db/migrations/0126_vengeful_kid_colt.sql new file mode 100644 index 00000000..25bf4ed0 --- /dev/null +++ b/db/migrations/0126_vengeful_kid_colt.sql @@ -0,0 +1,151 @@ +DROP VIEW "public"."rfq_dashboard";--> statement-breakpoint +DROP VIEW "public"."vendor_response_summary";--> statement-breakpoint +CREATE VIEW "public"."rfq_dashboard" AS ( + SELECT + br.id as rfq_id, + br.rfq_code, + br.description, + br.status, + br.due_date, + p.code as project_code, + p.name as project_name, + br.package_no, + br.package_name, + br.pic_code, + br.pic_name, + br.eng_pic_name, + br.project_company, + br.project_flag, + br.project_site, + br.remark, + COALESCE(att_count.total_attachments, 0) as total_attachments, + COALESCE(init_summary.vendor_count, 0) as initial_vendor_count, + COALESCE(final_summary.vendor_count, 0) as final_vendor_count, + COALESCE(init_summary.avg_response_rate, 0) as initial_response_rate, + COALESCE(final_summary.avg_response_rate, 0) as final_response_rate, + CASE + WHEN br.status = 'DRAFT' THEN 0 + WHEN br.status = 'Doc. Received' THEN 10 + WHEN br.status = 'PIC Assigned' THEN 20 + WHEN br.status = 'Doc. Confirmed' THEN 30 + WHEN br.status = 'Init. RFQ Sent' THEN 40 + WHEN br.status = 'Init. RFQ Answered' THEN 50 + WHEN br.status = 'TBE started' THEN 60 + WHEN br.status = 'TBE finished' THEN 70 + WHEN br.status = 'Final RFQ Sent' THEN 80 + WHEN br.status = 'Quotation Received' THEN 90 + WHEN br.status = 'Vendor Selected' THEN 100 + ELSE 0 + END as overall_progress, + (br.due_date - CURRENT_DATE) as days_to_deadline, + br.created_at, + br.updated_at + FROM b_rfqs br + LEFT JOIN projects p ON br.project_id = p.id + LEFT JOIN ( + SELECT rfq_id, COUNT(*) as total_attachments + FROM b_rfq_attachments + GROUP BY rfq_id + ) att_count ON br.id = att_count.rfq_id + LEFT JOIN ( + SELECT + rfq_id, + COUNT(DISTINCT vendor_id) as vendor_count, + AVG(response_rate) as avg_response_rate + FROM vendor_response_summary + WHERE rfq_type = 'INITIAL' + GROUP BY rfq_id + ) init_summary ON br.id = init_summary.rfq_id + LEFT JOIN ( + SELECT + rfq_id, + COUNT(DISTINCT vendor_id) as vendor_count, + AVG(response_rate) as avg_response_rate + FROM vendor_response_summary + WHERE rfq_type = 'FINAL' + GROUP BY rfq_id + ) final_summary ON br.id = final_summary.rfq_id +);--> statement-breakpoint +CREATE VIEW "public"."vendor_response_summary" AS ( + -- ② SELECT 절 확장 ------------------------------------------- + SELECT + br.id AS rfq_id, + br.rfq_code, + br.description, + br.status, + br.due_date, + p.code AS project_code, + p.name AS project_name, + br.package_no, + br.package_name, + br.pic_code, + br.pic_name, + br.eng_pic_name, + br.project_company, + br.project_flag, + br.project_site, + br.remark, + + -- 첨부/벤더 요약 ----------------------- + COALESCE(att_count.total_attachments, 0) AS total_attachments, + COALESCE(init_summary.vendor_count, 0) AS initial_vendor_count, + COALESCE(final_summary.vendor_count, 0) AS final_vendor_count, + COALESCE(init_summary.avg_response_rate, 0) AS initial_response_rate, + COALESCE(final_summary.avg_response_rate, 0) AS final_response_rate, + + -- 진행률·마감까지 일수 -------------- + CASE + WHEN br.status = 'DRAFT' THEN 0 + WHEN br.status = 'Doc. Received' THEN 10 + WHEN br.status = 'PIC Assigned' THEN 20 + WHEN br.status = 'Doc. Confirmed' THEN 30 + WHEN br.status = 'Init. RFQ Sent' THEN 40 + WHEN br.status = 'Init. RFQ Answered' THEN 50 + WHEN br.status = 'TBE started' THEN 60 + WHEN br.status = 'TBE finished' THEN 70 + WHEN br.status = 'Final RFQ Sent' THEN 80 + WHEN br.status = 'Quotation Received' THEN 90 + WHEN br.status = 'Vendor Selected' THEN 100 + ELSE 0 + END AS overall_progress, + (br.due_date - CURRENT_DATE) AS days_to_deadline, + + br.created_at, + br.updated_at, + + -- 💡 추가되는 컬럼 ------------------- + upd.name AS updated_by_name, + upd.email AS updated_by_email + FROM b_rfqs br + LEFT JOIN projects p ON br.project_id = p.id + + -- ③ 사용자 정보 조인 -------------------- + LEFT JOIN users upd ON br.updated_by = upd.id + + -- (나머지 이미 있던 JOIN 들은 그대로) ----- + LEFT JOIN ( + SELECT rfq_id, COUNT(*) AS total_attachments + FROM b_rfq_attachments + GROUP BY rfq_id + ) att_count ON br.id = att_count.rfq_id + + LEFT JOIN ( + SELECT + rfq_id, + COUNT(DISTINCT vendor_id) AS vendor_count, + AVG(response_rate) AS avg_response_rate + FROM vendor_response_summary + WHERE rfq_type = 'INITIAL' + GROUP BY rfq_id + ) init_summary ON br.id = init_summary.rfq_id + + LEFT JOIN ( + SELECT + rfq_id, + COUNT(DISTINCT vendor_id) AS vendor_count, + AVG(response_rate) AS avg_response_rate + FROM vendor_response_summary + WHERE rfq_type = 'FINAL' + GROUP BY rfq_id + ) final_summary ON br.id = final_summary.rfq_id + ); \ No newline at end of file diff --git a/db/migrations/0127_sweet_spiral.sql b/db/migrations/0127_sweet_spiral.sql new file mode 100644 index 00000000..93df76ee --- /dev/null +++ b/db/migrations/0127_sweet_spiral.sql @@ -0,0 +1,119 @@ +DROP VIEW "public"."rfq_dashboard";--> statement-breakpoint +DROP VIEW "public"."vendor_response_summary";--> statement-breakpoint +CREATE VIEW "public"."rfq_dashboard" AS ( + -- ② SELECT 절 확장 ------------------------------------------- + SELECT + br.id AS rfq_id, + br.rfq_code, + br.description, + br.status, + br.due_date, + p.code AS project_code, + p.name AS project_name, + br.package_no, + br.package_name, + br.pic_code, + br.pic_name, + br.eng_pic_name, + br.project_company, + br.project_flag, + br.project_site, + br.remark, + + -- 첨부/벤더 요약 ----------------------- + COALESCE(att_count.total_attachments, 0) AS total_attachments, + COALESCE(init_summary.vendor_count, 0) AS initial_vendor_count, + COALESCE(final_summary.vendor_count, 0) AS final_vendor_count, + COALESCE(init_summary.avg_response_rate, 0) AS initial_response_rate, + COALESCE(final_summary.avg_response_rate, 0) AS final_response_rate, + + -- 진행률·마감까지 일수 -------------- + CASE + WHEN br.status = 'DRAFT' THEN 0 + WHEN br.status = 'Doc. Received' THEN 10 + WHEN br.status = 'PIC Assigned' THEN 20 + WHEN br.status = 'Doc. Confirmed' THEN 30 + WHEN br.status = 'Init. RFQ Sent' THEN 40 + WHEN br.status = 'Init. RFQ Answered' THEN 50 + WHEN br.status = 'TBE started' THEN 60 + WHEN br.status = 'TBE finished' THEN 70 + WHEN br.status = 'Final RFQ Sent' THEN 80 + WHEN br.status = 'Quotation Received' THEN 90 + WHEN br.status = 'Vendor Selected' THEN 100 + ELSE 0 + END AS overall_progress, + (br.due_date - CURRENT_DATE) AS days_to_deadline, + + br.created_at, + br.updated_at, + + -- 💡 추가되는 컬럼 ------------------- + upd.name AS updated_by_name, + upd.email AS updated_by_email + FROM b_rfqs br + LEFT JOIN projects p ON br.project_id = p.id + + -- ③ 사용자 정보 조인 -------------------- + LEFT JOIN users upd ON br.updated_by = upd.id + + -- (나머지 이미 있던 JOIN 들은 그대로) ----- + LEFT JOIN ( + SELECT rfq_id, COUNT(*) AS total_attachments + FROM b_rfq_attachments + GROUP BY rfq_id + ) att_count ON br.id = att_count.rfq_id + + LEFT JOIN ( + SELECT + rfq_id, + COUNT(DISTINCT vendor_id) AS vendor_count, + AVG(response_rate) AS avg_response_rate + FROM vendor_response_summary + WHERE rfq_type = 'INITIAL' + GROUP BY rfq_id + ) init_summary ON br.id = init_summary.rfq_id + + LEFT JOIN ( + SELECT + rfq_id, + COUNT(DISTINCT vendor_id) AS vendor_count, + AVG(response_rate) AS avg_response_rate + FROM vendor_response_summary + WHERE rfq_type = 'FINAL' + GROUP BY rfq_id + ) final_summary ON br.id = final_summary.rfq_id + );--> statement-breakpoint + + +CREATE VIEW "public"."vendor_response_summary" AS ( + SELECT + br.id as rfq_id, + br.rfq_code, + br.status as rfq_status, + v.id as vendor_id, + v.vendor_code, + v.vendor_name, + v.country as vendor_country, + v.business_size as vendor_business_size, + var.rfq_type, + COUNT(var.id) as total_attachments, + COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) as responded_count, + COUNT(CASE WHEN var.response_status = 'NOT_RESPONDED' THEN 1 END) as pending_count, + COUNT(CASE WHEN var.response_status = 'WAIVED' THEN 1 END) as waived_count, + COUNT(CASE WHEN var.response_status = 'REVISION_REQUESTED' THEN 1 END) as revision_requested_count, + ROUND( + (COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) * 100.0 / + NULLIF(COUNT(CASE WHEN var.response_status != 'WAIVED' THEN 1 END), 0)), + 2 + ) as response_rate, + ROUND( + ((COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) + + COUNT(CASE WHEN var.response_status = 'WAIVED' THEN 1 END)) * 100.0 / COUNT(var.id)), + 2 + ) as completion_rate + FROM b_rfqs br + JOIN b_rfq_attachments bra ON br.id = bra.rfq_id + JOIN vendor_attachment_responses var ON bra.id = var.attachment_id + JOIN vendors v ON var.vendor_id = v.id + GROUP BY br.id, br.rfq_code, br.status, v.id, v.vendor_code, v.vendor_name, v.country, v.business_size, var.rfq_type +); \ No newline at end of file diff --git a/db/migrations/meta/0113_snapshot.json b/db/migrations/meta/0113_snapshot.json new file mode 100644 index 00000000..df44bbcb --- /dev/null +++ b/db/migrations/meta/0113_snapshot.json @@ -0,0 +1,11998 @@ +{ + "id": "2cf5716b-3f28-458e-b0d2-52ab7aea3c75", + "prevId": "6ac68c4d-4040-479c-b0f2-74d75a01b88d", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.companies": { + "name": "companies", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "companies_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "taxID": { + "name": "taxID", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_envelopes": { + "name": "contract_envelopes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_envelopes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "envelope_id": { + "name": "envelope_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": true + }, + "document_id": { + "name": "document_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": false + }, + "envelope_status": { + "name": "envelope_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_envelopes_contract_id_contracts_id_fk": { + "name": "contract_envelopes_contract_id_contracts_id_fk", + "tableFrom": "contract_envelopes", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_items": { + "name": "contract_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_items_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_id": { + "name": "item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "unit_price": { + "name": "unit_price", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "total_line_amount": { + "name": "total_line_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_items_contract_item_idx": { + "name": "contract_items_contract_item_idx", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "contract_items_contract_id_contracts_id_fk": { + "name": "contract_items_contract_id_contracts_id_fk", + "tableFrom": "contract_items", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_items_item_id_items_id_fk": { + "name": "contract_items_item_id_items_id_fk", + "tableFrom": "contract_items", + "tableTo": "items", + "columnsFrom": [ + "item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_items_contract_id_item_id_unique": { + "name": "contract_items_contract_id_item_id_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_id", + "item_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_signers": { + "name": "contract_signers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_signers_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "envelope_id": { + "name": "envelope_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_contact_id": { + "name": "vendor_contact_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "signer_type": { + "name": "signer_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'VENDOR'" + }, + "signer_email": { + "name": "signer_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "signer_name": { + "name": "signer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "signer_position": { + "name": "signer_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "signer_status": { + "name": "signer_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "signed_at": { + "name": "signed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_signers_envelope_id_contract_envelopes_id_fk": { + "name": "contract_signers_envelope_id_contract_envelopes_id_fk", + "tableFrom": "contract_signers", + "tableTo": "contract_envelopes", + "columnsFrom": [ + "envelope_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_signers_vendor_contact_id_vendor_contacts_id_fk": { + "name": "contract_signers_vendor_contact_id_vendor_contacts_id_fk", + "tableFrom": "contract_signers", + "tableTo": "vendor_contacts", + "columnsFrom": [ + "vendor_contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contracts": { + "name": "contracts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contracts_project_id_projects_id_fk": { + "name": "contracts_project_id_projects_id_fk", + "tableFrom": "contracts", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contracts_vendor_id_vendors_id_fk": { + "name": "contracts_vendor_id_vendors_id_fk", + "tableFrom": "contracts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contracts_contract_no_unique": { + "name": "contracts_contract_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.poa": { + "name": "poa", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "original_contract_no": { + "name": "original_contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "original_contract_name": { + "name": "original_contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_status": { + "name": "original_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "poa_original_contract_no_contracts_contract_no_fk": { + "name": "poa_original_contract_no_contracts_contract_no_fk", + "tableFrom": "poa", + "tableTo": "contracts", + "columnsFrom": [ + "original_contract_no" + ], + "columnsTo": [ + "contract_no" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_project_id_projects_id_fk": { + "name": "poa_project_id_projects_id_fk", + "tableFrom": "poa", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_vendor_id_vendors_id_fk": { + "name": "poa_vendor_id_vendors_id_fk", + "tableFrom": "poa", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_hull": { + "name": "item_offshore_hull", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_hull_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_hull_item_code_items_item_code_fk": { + "name": "item_offshore_hull_item_code_items_item_code_fk", + "tableFrom": "item_offshore_hull", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_top": { + "name": "item_offshore_top", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_top_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_top_item_code_items_item_code_fk": { + "name": "item_offshore_top_item_code_items_item_code_fk", + "tableFrom": "item_offshore_top", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_shipbuilding": { + "name": "item_shipbuilding", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ship_types": { + "name": "ship_types", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'OPTION'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_shipbuilding_item_code_items_item_code_fk": { + "name": "item_shipbuilding_item_code_items_item_code_fk", + "tableFrom": "item_shipbuilding", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.items": { + "name": "items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_no": { + "name": "project_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "package_code": { + "name": "package_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "sm_code": { + "name": "sm_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "items_item_code_unique": { + "name": "items_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.materials": { + "name": "materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "materials_item_code_unique": { + "name": "materials_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias": { + "name": "pq_criterias", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "check_point": { + "name": "check_point", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "group_name": { + "name": "group_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias_extension": { + "name": "pq_criterias_extension", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_criteria_id": { + "name": "pq_criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_info": { + "name": "contract_info", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "additional_requirement": { + "name": "additional_requirement", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk": { + "name": "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "pq_criterias", + "columnsFrom": [ + "pq_criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "pq_criterias_extension_project_id_projects_id_fk": { + "name": "pq_criterias_extension_project_id_projects_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_criteria_attachments": { + "name": "vendor_criteria_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_criteria_answer_id": { + "name": "vendor_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_criteria_attachments", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigation_attachments": { + "name": "vendor_investigation_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "investigation_id": { + "name": "investigation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'REPORT'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { + "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", + "tableFrom": "vendor_investigation_attachments", + "tableTo": "vendor_investigations", + "columnsFrom": [ + "investigation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigations": { + "name": "vendor_investigations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigations_vendor_id_vendors_id_fk": { + "name": "vendor_investigations_vendor_id_vendors_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk": { + "name": "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendor_pq_submissions", + "columnsFrom": [ + "pq_submission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "vendor_investigations_requester_id_users_id_fk": { + "name": "vendor_investigations_requester_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_qm_manager_id_users_id_fk": { + "name": "vendor_investigations_qm_manager_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "qm_manager_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_submissions": { + "name": "vendor_pq_submissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_number": { + "name": "pq_number", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_pq_submission": { + "name": "unique_pq_submission", + "columns": [ + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_pq_submissions_requester_id_users_id_fk": { + "name": "vendor_pq_submissions_requester_id_users_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_pq_submissions_vendor_id_vendors_id_fk": { + "name": "vendor_pq_submissions_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_submissions_project_id_projects_id_fk": { + "name": "vendor_pq_submissions_project_id_projects_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_pq_submissions_pq_number_unique": { + "name": "vendor_pq_submissions_pq_number_unique", + "nullsNotDistinct": false, + "columns": [ + "pq_number" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_criteria_answers": { + "name": "vendor_pq_criteria_answers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "criteria_id": { + "name": "criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "answer": { + "name": "answer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_criteria_answers_vendor_id_vendors_id_fk": { + "name": "vendor_pq_criteria_answers_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": { + "name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "pq_criterias", + "columnsFrom": [ + "criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_project_id_projects_id_fk": { + "name": "vendor_pq_criteria_answers_project_id_projects_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_review_logs": { + "name": "vendor_pq_review_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_pq_criteria_answer_id": { + "name": "vendor_pq_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "reviewer_comment": { + "name": "reviewer_comment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_pq_review_logs", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_pq_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_project_pqs": { + "name": "vendor_project_pqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_project_pqs_vendor_id_vendors_id_fk": { + "name": "vendor_project_pqs_vendor_id_vendors_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_project_pqs_project_id_projects_id_fk": { + "name": "vendor_project_pqs_project_id_projects_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bidding_projects": { + "name": "bidding_projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "proj_nm": { + "name": "proj_nm", + "type": "varchar(90)", + "primaryKey": false, + "notNull": false + }, + "sector": { + "name": "sector", + "type": "char(1)", + "primaryKey": false, + "notNull": false + }, + "proj_msrm": { + "name": "proj_msrm", + "type": "numeric(3, 0)", + "primaryKey": false, + "notNull": false + }, + "kunnr": { + "name": "kunnr", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "kunnr_nm": { + "name": "kunnr_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "cls_1": { + "name": "cls_1", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "cls1_nm": { + "name": "cls1_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "ptype": { + "name": "ptype", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "ptype_nm": { + "name": "ptype_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_cd": { + "name": "pmodel_cd", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "pmodel_nm": { + "name": "pmodel_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_sz": { + "name": "pmodel_sz", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "pmodel_uom": { + "name": "pmodel_uom", + "type": "char(5)", + "primaryKey": false, + "notNull": false + }, + "txt04": { + "name": "txt04", + "type": "char(4)", + "primaryKey": false, + "notNull": false + }, + "txt30": { + "name": "txt30", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "estm_pm": { + "name": "estm_pm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "bidding_projects_pspid_unique": { + "name": "bidding_projects_pspid_unique", + "nullsNotDistinct": false, + "columns": [ + "pspid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_series": { + "name": "project_series", + "schema": "", + "columns": { + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "sers_no": { + "name": "sers_no", + "type": "char(3)", + "primaryKey": false, + "notNull": true + }, + "sc_dt": { + "name": "sc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "kl_dt": { + "name": "kl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "lc_dt": { + "name": "lc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dl_dt": { + "name": "dl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dock_no": { + "name": "dock_no", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "dock_nm": { + "name": "dock_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "proj_no": { + "name": "proj_no", + "type": "char(24)", + "primaryKey": false, + "notNull": false + }, + "post1": { + "name": "post1", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "project_sersNo_unique": { + "name": "project_sersNo_unique", + "columns": [ + { + "expression": "pspid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sers_no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "project_series_pspid_bidding_projects_pspid_fk": { + "name": "project_series_pspid_bidding_projects_pspid_fk", + "tableFrom": "project_series", + "tableTo": "bidding_projects", + "columnsFrom": [ + "pspid" + ], + "columnsTo": [ + "pspid" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projects": { + "name": "projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cbe_evaluations": { + "name": "cbe_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluated_by": { + "name": "evaluated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluated_at": { + "name": "evaluated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "result": { + "name": "result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "total_cost": { + "name": "total_cost", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_schedule": { + "name": "delivery_schedule", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "cbe_evaluations_rfq_id_rfqs_id_fk": { + "name": "cbe_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_vendor_id_vendors_id_fk": { + "name": "cbe_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_evaluated_by_users_id_fk": { + "name": "cbe_evaluations_evaluated_by_users_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "users", + "columnsFrom": [ + "evaluated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_attachments": { + "name": "rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_attachments_rfq_id_rfqs_id_fk": { + "name": "rfq_attachments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_vendor_id_vendors_id_fk": { + "name": "rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_attachments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_cbe_id_cbe_evaluations_id_fk": { + "name": "rfq_attachments_cbe_id_cbe_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "cbe_evaluations", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_comment_id_rfq_comments_id_fk": { + "name": "rfq_attachments_comment_id_rfq_comments_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_comments": { + "name": "rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "comment_text": { + "name": "comment_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "commented_by": { + "name": "commented_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_comments_rfq_id_rfqs_id_fk": { + "name": "rfq_comments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_vendor_id_vendors_id_fk": { + "name": "rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_commented_by_users_id_fk": { + "name": "rfq_comments_commented_by_users_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "commented_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_comments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_cbe_id_vendor_responses_id_fk": { + "name": "rfq_comments_cbe_id_vendor_responses_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_evaluations": { + "name": "rfq_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "eval_type": { + "name": "eval_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "result": { + "name": "result", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_evaluations_rfq_id_rfqs_id_fk": { + "name": "rfq_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_evaluations_vendor_id_vendors_id_fk": { + "name": "rfq_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_items": { + "name": "rfq_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_items_rfq_id_rfqs_id_fk": { + "name": "rfq_items_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_items", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "rfq_items_item_code_items_item_code_fk": { + "name": "rfq_items_item_code_items_item_code_fk", + "tableFrom": "rfq_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfqs": { + "name": "rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "bid_project_id": { + "name": "bid_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false, + "default": "'PURCHASE'" + }, + "parent_rfq_id": { + "name": "parent_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfqs_project_id_projects_id_fk": { + "name": "rfqs_project_id_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_bid_project_id_bidding_projects_id_fk": { + "name": "rfqs_bid_project_id_bidding_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bid_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_created_by_users_id_fk": { + "name": "rfqs_created_by_users_id_fk", + "tableFrom": "rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_parent_rfq_id_rfqs_id_fk": { + "name": "rfqs_parent_rfq_id_rfqs_id_fk", + "tableFrom": "rfqs", + "tableTo": "rfqs", + "columnsFrom": [ + "parent_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "rfqs_rfq_code_unique": { + "name": "rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_commercial_responses": { + "name": "vendor_commercial_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "total_price": { + "name": "total_price", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_period": { + "name": "delivery_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "warranty_period": { + "name": "warranty_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "validity_period": { + "name": "validity_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "price_breakdown": { + "name": "price_breakdown", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "commercial_notes": { + "name": "commercial_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_commercial_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_commercial_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_commercial_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_attachments": { + "name": "vendor_response_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "technical_response_id": { + "name": "technical_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "commercial_response_id": { + "name": "commercial_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_attachments_response_id_vendor_responses_id_fk": { + "name": "vendor_response_attachments_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk": { + "name": "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_technical_responses", + "columnsFrom": [ + "technical_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk": { + "name": "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_commercial_responses", + "columnsFrom": [ + "commercial_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_responses": { + "name": "vendor_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'REVIEWING'" + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "responded_by": { + "name": "responded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "responded_at": { + "name": "responded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "vendor_response_unique": { + "name": "vendor_response_unique", + "columns": [ + { + "expression": "rfq_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_responses_rfq_id_rfqs_id_fk": { + "name": "vendor_responses_rfq_id_rfqs_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_responses_vendor_id_vendors_id_fk": { + "name": "vendor_responses_vendor_id_vendors_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_technical_responses": { + "name": "vendor_technical_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_technical_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_technical_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_technical_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.otps": { + "name": "otps", + "schema": "", + "columns": { + "email": { + "name": "email", + "type": "varchar(256)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(6)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "otpToken": { + "name": "otpToken", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "otp_expires": { + "name": "otp_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permissions": { + "name": "permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "permissions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "permission_key": { + "name": "permission_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.role_permissions": { + "name": "role_permissions", + "schema": "", + "columns": { + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "permission_id": { + "name": "permission_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "role_permissions_role_id_roles_id_fk": { + "name": "role_permissions_role_id_roles_id_fk", + "tableFrom": "role_permissions", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "role_permissions_permission_id_permissions_id_fk": { + "name": "role_permissions_permission_id_permissions_id_fk", + "tableFrom": "role_permissions", + "tableTo": "permissions", + "columnsFrom": [ + "permission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.roles": { + "name": "roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "roles_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "roles_company_id_vendors_id_fk": { + "name": "roles_company_id_vendors_id_fk", + "tableFrom": "roles", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_roles": { + "name": "user_roles", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_roles_user_id_users_id_fk": { + "name": "user_roles_user_id_users_id_fk", + "tableFrom": "user_roles", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_roles_role_id_roles_id_fk": { + "name": "user_roles_role_id_roles_id_fk", + "tableFrom": "user_roles", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "users_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'partners'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "image_url": { + "name": "image_url", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "language": { + "name": "language", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'en'" + } + }, + "indexes": {}, + "foreignKeys": { + "users_company_id_vendors_id_fk": { + "name": "users_company_id_vendors_id_fk", + "tableFrom": "users", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_entries": { + "name": "form_entries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_entries_contract_item_id_contract_items_id_fk": { + "name": "form_entries_contract_item_id_contract_items_id_fk", + "tableFrom": "form_entries", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_metas": { + "name": "form_metas", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "columns": { + "name": "columns", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_metas_project_id_projects_id_fk": { + "name": "form_metas_project_id_projects_id_fk", + "tableFrom": "form_metas", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "form_code_project_unique": { + "name": "form_code_project_unique", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.forms": { + "name": "forms", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "forms_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "eng": { + "name": "eng", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "im": { + "name": "im", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_item_form_code_unique": { + "name": "contract_item_form_code_unique", + "columns": [ + { + "expression": "contract_item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "form_code", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "forms_contract_item_id_contract_items_id_fk": { + "name": "forms_contract_item_id_contract_items_id_fk", + "tableFrom": "forms", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_class_attributes": { + "name": "tag_class_attributes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_class_attributes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "tag_class_id": { + "name": "tag_class_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "att_id": { + "name": "att_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "def_val": { + "name": "def_val", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uom_id": { + "name": "uom_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "seq": { + "name": "seq", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "tag_class_attributes_seq_idx": { + "name": "tag_class_attributes_seq_idx", + "columns": [ + { + "expression": "seq", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "tag_class_attributes_tag_class_id_tag_classes_id_fk": { + "name": "tag_class_attributes_tag_class_id_tag_classes_id_fk", + "tableFrom": "tag_class_attributes", + "tableTo": "tag_classes", + "columnsFrom": [ + "tag_class_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_att_id_in_tag_class": { + "name": "uniq_att_id_in_tag_class", + "nullsNotDistinct": false, + "columns": [ + "tag_class_id", + "att_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_classes": { + "name": "tag_classes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_classes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_classes_project_id_projects_id_fk": { + "name": "tag_classes_project_id_projects_id_fk", + "tableFrom": "tag_classes", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk": { + "name": "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk", + "tableFrom": "tag_classes", + "tableTo": "tag_types", + "columnsFrom": [ + "tag_type_code", + "project_id" + ], + "columnsTo": [ + "code", + "project_id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_code_in_project": { + "name": "uniq_code_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfield_options": { + "name": "tag_subfield_options", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfield_options_project_id_projects_id_fk": { + "name": "tag_subfield_options_project_id_projects_id_fk", + "tableFrom": "tag_subfield_options", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_attribute_project_code": { + "name": "uniq_attribute_project_code", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "attributes_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfields": { + "name": "tag_subfields", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfields_project_id_projects_id_fk": { + "name": "tag_subfields_project_id_projects_id_fk", + "tableFrom": "tag_subfields", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_tag_type_attribute": { + "name": "uniq_tag_type_attribute", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_code", + "attributes_id" + ] + }, + "uniq_attribute_id_project": { + "name": "uniq_attribute_id_project", + "nullsNotDistinct": false, + "columns": [ + "attributes_id", + "project_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_type_class_form_mappings": { + "name": "tag_type_class_form_mappings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_label": { + "name": "tag_type_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "class_label": { + "name": "class_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "ep": { + "name": "ep", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_mapping_in_project": { + "name": "uniq_mapping_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_label", + "class_label", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_types": { + "name": "tag_types", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_types_project_id_projects_id_fk": { + "name": "tag_types_project_id_projects_id_fk", + "tableFrom": "tag_types", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "tag_types_code_project_id_pk": { + "name": "tag_types_code_project_id_pk", + "columns": [ + "code", + "project_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tags": { + "name": "tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tags_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "tag_type": { + "name": "tag_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "class": { + "name": "class", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tags_contract_item_id_contract_items_id_fk": { + "name": "tags_contract_item_id_contract_items_id_fk", + "tableFrom": "tags", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_form_id_forms_id_fk": { + "name": "tags_form_id_forms_id_fk", + "tableFrom": "tags", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_item_tag_no_unique": { + "name": "contract_item_tag_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_item_id", + "tag_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_data_report_temps": { + "name": "vendor_data_report_temps", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_data_report_temps_contract_item_id_contract_items_id_fk": { + "name": "vendor_data_report_temps_contract_item_id_contract_items_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_data_report_temps_form_id_forms_id_fk": { + "name": "vendor_data_report_temps_form_id_forms_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.change_logs": { + "name": "change_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "changed_fields": { + "name": "changed_fields", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "old_values": { + "name": "old_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "new_values": { + "name": "new_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_name": { + "name": "user_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_synced": { + "name": "is_synced", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "sync_attempts": { + "name": "sync_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_sync_error": { + "name": "last_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "synced_at": { + "name": "synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "target_systems": { + "name": "target_systems", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + } + }, + "indexes": { + "idx_change_logs_contract_synced": { + "name": "idx_change_logs_contract_synced", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_synced", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_created_at": { + "name": "idx_change_logs_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_entity": { + "name": "idx_change_logs_entity", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_sync_attempts": { + "name": "idx_change_logs_sync_attempts", + "columns": [ + { + "expression": "sync_attempts", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.document_attachments": { + "name": "document_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "document_attachments_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "revision_id": { + "name": "revision_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "document_attachments_revision_id_revisions_id_fk": { + "name": "document_attachments_revision_id_revisions_id_fk", + "tableFrom": "document_attachments", + "tableTo": "revisions", + "columnsFrom": [ + "revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.documents": { + "name": "documents", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "documents_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "drawing_move_gbn": { + "name": "drawing_move_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "discipline": { + "name": "discipline", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "external_document_id": { + "name": "external_document_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "external_system_type": { + "name": "external_system_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "external_synced_at": { + "name": "external_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "shi_drawing_no": { + "name": "shi_drawing_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager": { + "name": "manager", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_enm": { + "name": "manager_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_no": { + "name": "manager_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "register_group": { + "name": "register_group", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "register_group_id": { + "name": "register_group_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "create_user_no": { + "name": "create_user_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "create_user_id": { + "name": "create_user_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "create_user_enm": { + "name": "create_user_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_contract_doc_status": { + "name": "unique_contract_doc_status", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_contract_vendor_doc": { + "name": "unique_contract_vendor_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"vendor_doc_number\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_external_doc": { + "name": "unique_external_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_system_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"external_document_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "drawing_kind_idx": { + "name": "drawing_kind_idx", + "columns": [ + { + "expression": "drawing_kind", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "documents_contract_id_contracts_id_fk": { + "name": "documents_contract_id_contracts_id_fk", + "tableFrom": "documents", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.issue_stages": { + "name": "issue_stages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "issue_stages_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_name": { + "name": "stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "plan_date": { + "name": "plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "actual_date": { + "name": "actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "stage_status": { + "name": "stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "stage_order": { + "name": "stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "priority": { + "name": "priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'MEDIUM'" + }, + "assignee_id": { + "name": "assignee_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "assignee_name": { + "name": "assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "reminder_days": { + "name": "reminder_days", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_document_stage": { + "name": "unique_document_stage", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_stage_order": { + "name": "document_stage_order", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "issue_stages_document_id_documents_id_fk": { + "name": "issue_stages_document_id_documents_id_fk", + "tableFrom": "issue_stages", + "tableTo": "documents", + "columnsFrom": [ + "document_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.revisions": { + "name": "revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "revisions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "issue_stage_id": { + "name": "issue_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "revision": { + "name": "revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "uploader_type": { + "name": "uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'vendor'" + }, + "uploader_id": { + "name": "uploader_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploader_name": { + "name": "uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "revision_status": { + "name": "revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'SUBMITTED'" + }, + "submitted_date": { + "name": "submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "review_start_date": { + "name": "review_start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "approved_date": { + "name": "approved_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "rejected_date": { + "name": "rejected_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "reviewer_id": { + "name": "reviewer_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "review_comments": { + "name": "review_comments", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "external_upload_id": { + "name": "external_upload_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_stage_rev": { + "name": "unique_stage_rev", + "columns": [ + { + "expression": "issue_stage_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "revision", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_batches": { + "name": "sync_batches", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "batch_size": { + "name": "batch_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "retry_count": { + "name": "retry_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "change_log_ids": { + "name": "change_log_ids", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "success_count": { + "name": "success_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "failure_count": { + "name": "failure_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sync_metadata": { + "name": "sync_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_batches_contract_system": { + "name": "idx_sync_batches_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_status": { + "name": "idx_sync_batches_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_created_at": { + "name": "idx_sync_batches_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_configs": { + "name": "sync_configs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "sync_interval_minutes": { + "name": "sync_interval_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 30 + }, + "last_successful_sync": { + "name": "last_successful_sync", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_sync_attempt": { + "name": "last_sync_attempt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "endpoint_url": { + "name": "endpoint_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "auth_token": { + "name": "auth_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "api_version": { + "name": "api_version", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'v1'" + }, + "max_batch_size": { + "name": "max_batch_size", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 100 + }, + "retry_max_attempts": { + "name": "retry_max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_configs_contract_system": { + "name": "idx_sync_configs_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sync_configs_contract_id_contracts_id_fk": { + "name": "sync_configs_contract_id_contracts_id_fk", + "tableFrom": "sync_configs", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_attachments": { + "name": "vendor_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'GENERAL'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_attachments_vendor_id_vendors_id_fk": { + "name": "vendor_attachments_vendor_id_vendors_id_fk", + "tableFrom": "vendor_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidates": { + "name": "vendor_candidates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidates_vendor_id_vendors_id_fk": { + "name": "vendor_candidates_vendor_id_vendors_id_fk", + "tableFrom": "vendor_candidates", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_contacts": { + "name": "vendor_contacts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contact_name": { + "name": "contact_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_position": { + "name": "contact_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "is_primary": { + "name": "is_primary", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_contacts_vendor_id_vendors_id_fk": { + "name": "vendor_contacts_vendor_id_vendors_id_fk", + "tableFrom": "vendor_contacts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_items": { + "name": "vendor_possible_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_items_vendor_id_vendors_id_fk": { + "name": "vendor_possible_items_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_items_item_code_items_item_code_fk": { + "name": "vendor_possible_items_item_code_items_item_code_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_materials": { + "name": "vendor_possible_materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_materials_vendor_id_vendors_id_fk": { + "name": "vendor_possible_materials_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_materials_item_code_materials_item_code_fk": { + "name": "vendor_possible_materials_item_code_materials_item_code_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "materials", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_types": { + "name": "vendor_types", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_types_code_unique": { + "name": "vendor_types_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors": { + "name": "vendors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "vendor_type_id": { + "name": "vendor_type_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_vendor_type_id_vendor_types_id_fk": { + "name": "vendors_vendor_type_id_vendor_types_id_fk", + "tableFrom": "vendors", + "tableTo": "vendor_types", + "columnsFrom": [ + "vendor_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tasks": { + "name": "tasks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'todo'" + }, + "label": { + "name": "label", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'bug'" + }, + "priority": { + "name": "priority", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'low'" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "current_timestamp" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tasks_code_unique": { + "name": "tasks_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidate_logs": { + "name": "vendor_candidate_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_candidate_id": { + "name": "vendor_candidate_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk": { + "name": "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "vendor_candidates", + "columnsFrom": [ + "vendor_candidate_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_candidate_logs_user_id_users_id_fk": { + "name": "vendor_candidate_logs_user_id_users_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors_logs": { + "name": "vendors_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_logs_vendor_id_vendors_id_fk": { + "name": "vendors_logs_vendor_id_vendors_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendors_logs_user_id_users_id_fk": { + "name": "vendors_logs_user_id_users_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract": { + "name": "basic_contract", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_id": { + "name": "template_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requested_by": { + "name": "requested_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "basic_contract_template_id_basic_contract_templates_id_fk": { + "name": "basic_contract_template_id_basic_contract_templates_id_fk", + "tableFrom": "basic_contract", + "tableTo": "basic_contract_templates", + "columnsFrom": [ + "template_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_vendor_id_vendors_id_fk": { + "name": "basic_contract_vendor_id_vendors_id_fk", + "tableFrom": "basic_contract", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_requested_by_users_id_fk": { + "name": "basic_contract_requested_by_users_id_fk", + "tableFrom": "basic_contract", + "tableTo": "users", + "columnsFrom": [ + "requested_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract_templates": { + "name": "basic_contract_templates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_templates_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_name": { + "name": "template_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "validity_period": { + "name": "validity_period", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.incoterms": { + "name": "incoterms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(20)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "incoterms_created_by_users_id_fk": { + "name": "incoterms_created_by_users_id_fk", + "tableFrom": "incoterms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payment_terms": { + "name": "payment_terms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "payment_terms_created_by_users_id_fk": { + "name": "payment_terms_created_by_users_id_fk", + "tableFrom": "payment_terms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pr_items": { + "name": "pr_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "pr_items", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_attachments": { + "name": "procurement_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "procurement_rfq_details_id": { + "name": "procurement_rfq_details_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk": { + "name": "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfq_details", + "columnsFrom": [ + "procurement_rfq_details_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_created_by_users_id_fk": { + "name": "procurement_attachments_created_by_users_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "attachment_type_check": { + "name": "attachment_type_check", + "value": "\"procurement_attachments\".\"procurement_rfqs_id\" IS NOT NULL OR \"procurement_attachments\".\"procurement_rfq_details_id\" IS NOT NULL" + } + }, + "isRLSEnabled": false + }, + "public.procurement_quotation_items": { + "name": "procurement_quotation_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pr_item_id": { + "name": "pr_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "material_code": { + "name": "material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "uom": { + "name": "uom", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "unit_price": { + "name": "unit_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "vendor_material_code": { + "name": "vendor_material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_material_description": { + "name": "vendor_material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "lead_time_in_days": { + "name": "lead_time_in_days", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_rate": { + "name": "discount_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_amount": { + "name": "discount_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_alternative": { + "name": "is_alternative", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_recommended": { + "name": "is_recommended", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_quotation_items_pr_item_id_pr_items_id_fk": { + "name": "procurement_quotation_items_pr_item_id_pr_items_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "pr_items", + "columnsFrom": [ + "pr_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_attachments": { + "name": "procurement_rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_uploaded_by_users_id_fk": { + "name": "procurement_rfq_attachments_uploaded_by_users_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_comments": { + "name": "procurement_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_comments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_user_id_users_id_fk": { + "name": "procurement_rfq_comments_user_id_users_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_details": { + "name": "procurement_rfq_details", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendors_id": { + "name": "vendors_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'VV'" + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_vendors_id_vendors_id_fk": { + "name": "procurement_rfq_details_vendors_id_vendors_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "vendors", + "columnsFrom": [ + "vendors_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_rfq_details_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_incoterms_code_incoterms_code_fk": { + "name": "procurement_rfq_details_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_updated_by_users_id_fk": { + "name": "procurement_rfq_details_updated_by_users_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfqs": { + "name": "procurement_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "series": { + "name": "series", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "rfq_sealed_yn": { + "name": "rfq_sealed_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfqs_project_id_projects_id_fk": { + "name": "procurement_rfqs_project_id_projects_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_sent_by_users_id_fk": { + "name": "procurement_rfqs_sent_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_created_by_users_id_fk": { + "name": "procurement_rfqs_created_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_updated_by_users_id_fk": { + "name": "procurement_rfqs_updated_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "procurement_rfqs_rfq_code_unique": { + "name": "procurement_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_vendor_quotations": { + "name": "procurement_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_items_count": { + "name": "total_items_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sub_total": { + "name": "sub_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "tax_total": { + "name": "tax_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "discount_total": { + "name": "discount_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "estimated_delivery_date": { + "name": "estimated_delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "procurement_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_incoterms_code_incoterms_code_fk": { + "name": "procurement_vendor_quotations_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.preset_shares": { + "name": "preset_shares", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "preset_id": { + "name": "preset_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "shared_with_user_id": { + "name": "shared_with_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'read'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "preset_shares_preset_id_table_presets_id_fk": { + "name": "preset_shares_preset_id_table_presets_id_fk", + "tableFrom": "preset_shares", + "tableTo": "table_presets", + "columnsFrom": [ + "preset_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_presets": { + "name": "table_presets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_shared": { + "name": "is_shared", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_attachments": { + "name": "tech_sales_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "tech_sales_rfq_id": { + "name": "tech_sales_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "tech_sales_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_attachments_created_by_users_id_fk": { + "name": "tech_sales_attachments_created_by_users_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comment_attachments": { + "name": "tech_sales_rfq_comment_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk": { + "name": "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk": { + "name": "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comments": { + "name": "tech_sales_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_user_id_users_id_fk": { + "name": "tech_sales_rfq_comments_user_id_users_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfqs": { + "name": "tech_sales_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_shipbuilding_id": { + "name": "item_shipbuilding_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "bidding_project_id": { + "name": "bidding_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_snapshot": { + "name": "project_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "series_snapshot": { + "name": "series_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk": { + "name": "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "item_shipbuilding", + "columnsFrom": [ + "item_shipbuilding_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk": { + "name": "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bidding_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_sent_by_users_id_fk": { + "name": "tech_sales_rfqs_sent_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_created_by_users_id_fk": { + "name": "tech_sales_rfqs_created_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_updated_by_users_id_fk": { + "name": "tech_sales_rfqs_updated_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tech_sales_rfqs_rfq_code_unique": { + "name": "tech_sales_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_vendor_quotations": { + "name": "tech_sales_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "tech_sales_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rotation_attempts": { + "name": "ocr_rotation_attempts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "rotation": { + "name": "rotation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "tables_found": { + "name": "tables_found", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "text_quality": { + "name": "text_quality", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "keyword_count": { + "name": "keyword_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "score": { + "name": "score", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "extracted_rows_count": { + "name": "extracted_rows_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_rotation_attempts_session_id_ocr_sessions_id_fk": { + "name": "ocr_rotation_attempts_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rotation_attempts", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rows": { + "name": "ocr_rows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "table_id": { + "name": "table_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "row_index": { + "name": "row_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "report_no": { + "name": "report_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "no": { + "name": "no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "identification_no": { + "name": "identification_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_no": { + "name": "joint_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_type": { + "name": "joint_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "welding_date": { + "name": "welding_date", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "source_table": { + "name": "source_table", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "source_row": { + "name": "source_row", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_ocr_row_unique": { + "name": "idx_ocr_row_unique", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "report_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "ocr_rows_table_id_ocr_tables_id_fk": { + "name": "ocr_rows_table_id_ocr_tables_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_tables", + "columnsFrom": [ + "table_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_session_id_ocr_sessions_id_fk": { + "name": "ocr_rows_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_user_id_users_id_fk": { + "name": "ocr_rows_user_id_users_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_sessions": { + "name": "ocr_sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "processing_time": { + "name": "processing_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "best_rotation": { + "name": "best_rotation", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_tables": { + "name": "total_tables", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_rows": { + "name": "total_rows", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "image_enhanced": { + "name": "image_enhanced", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pdf_converted": { + "name": "pdf_converted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "success": { + "name": "success", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "warnings": { + "name": "warnings", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_tables": { + "name": "ocr_tables", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "table_index": { + "name": "table_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "row_count": { + "name": "row_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_tables_session_id_ocr_sessions_id_fk": { + "name": "ocr_tables_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_tables", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.offshore_hull_work_type": { + "name": "offshore_hull_work_type", + "schema": "public", + "values": [ + "HA", + "HE", + "HH", + "HM", + "NC" + ] + }, + "public.offshore_top_work_type": { + "name": "offshore_top_work_type", + "schema": "public", + "values": [ + "TM", + "TS", + "TE", + "TP" + ] + }, + "public.work_type": { + "name": "work_type", + "schema": "public", + "values": [ + "기장", + "전장", + "선실", + "배관", + "철의" + ] + }, + "public.user_domain": { + "name": "user_domain", + "schema": "public", + "values": [ + "evcp", + "partners" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": { + "public.contracts_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"contracts\".\"id\", \"contracts\".\"contract_no\", \"contracts\".\"contract_name\", \"contracts\".\"status\", \"contracts\".\"start_date\", \"contracts\".\"end_date\", \"contracts\".\"project_id\", \"projects\".\"code\", \"projects\".\"name\", \"contracts\".\"vendor_id\", \"vendors\".\"vendor_name\", \"contracts\".\"payment_terms\", \"contracts\".\"delivery_terms\", \"contracts\".\"delivery_date\", \"contracts\".\"delivery_location\", \"contracts\".\"currency\", \"contracts\".\"total_amount\", \"contracts\".\"discount\", \"contracts\".\"tax\", \"contracts\".\"shipping_fee\", \"contracts\".\"net_total\", \"contracts\".\"partial_shipping_allowed\", \"contracts\".\"partial_payment_allowed\", \"contracts\".\"remarks\", \"contracts\".\"version\", \"contracts\".\"created_at\", \"contracts\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"contracts\".\"id\"\n ) as \"has_signature\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "contracts_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.poa_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", + "name": "poa_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.project_approved_vendors": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"status\", \"vendor_types\".\"name_ko\", \"vendor_types\".\"name_en\", \"projects\".\"code\", \"projects\".\"name\", \"projects\".\"type\", \"vendor_pq_submissions\".\"submitted_at\", \"vendor_pq_submissions\".\"approved_at\" from \"vendors\" inner join \"vendor_pq_submissions\" on \"vendor_pq_submissions\".\"vendor_id\" = \"vendors\".\"id\" inner join \"projects\" on \"vendor_pq_submissions\".\"project_id\" = \"projects\".\"id\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\" where \"vendor_pq_submissions\".\"status\" = 'APPROVED'", + "name": "project_approved_vendors", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_investigations_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"vendor_id\", \"vendor_investigations\".\"pq_submission_id\", \"vendor_investigations\".\"requester_id\", \"vendor_investigations\".\"qm_manager_id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"evaluation_type\", \"vendor_investigations\".\"investigation_address\", \"vendor_investigations\".\"investigation_method\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"forecasted_at\", \"vendor_investigations\".\"requested_at\", \"vendor_investigations\".\"confirmed_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"evaluation_score\", \"vendor_investigations\".\"evaluation_result\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", requester.name as \"requesterName\", requester.email as \"requesterEmail\", qm_manager.name as \"qmManagerName\", qm_manager.email as \"qmManagerEmail\", (\n CASE \n WHEN EXISTS (\n SELECT 1 FROM vendor_investigation_attachments via \n WHERE via.investigation_id = \"vendor_investigations\".\"id\"\n ) \n THEN true \n ELSE false \n END\n ) as \"hasAttachments\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\" left join users AS requester on \"vendor_investigations\".\"requester_id\" = requester.id left join users AS qm_manager on \"vendor_investigations\".\"qm_manager_id\" = qm_manager.id", + "name": "vendor_investigations_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.cbe_view": { + "columns": {}, + "definition": "select \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"rfq_id\" as \"rfq_id\", \"cbe_evaluations\".\"vendor_id\" as \"vendor_id\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"result\" as \"result\", \"cbe_evaluations\".\"notes\" as \"notes\", \"cbe_evaluations\".\"evaluated_by\" as \"evaluated_by\", \"cbe_evaluations\".\"evaluated_at\" as \"evaluated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"name\" as \"evaluator_name\", \"users\".\"email\" as \"evaluator_email\" from \"cbe_evaluations\" inner join \"rfqs\" on \"cbe_evaluations\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"cbe_evaluations\".\"evaluated_by\" = \"users\".\"id\"", + "name": "cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.rfqs_view": { + "columns": {}, + "definition": "select \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"rfqs\".\"parent_rfq_id\" as \"parent_rfq_id\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"email\" as \"user_email\", \"users\".\"name\" as \"user_name\", (\n SELECT COUNT(*) \n FROM \"rfq_items\" \n WHERE \"rfq_items\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"item_count\", (\n SELECT COUNT(*) \n FROM \"rfq_attachments\" \n WHERE \"rfq_attachments\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"attachment_count\" from \"rfqs\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"rfqs\".\"created_by\" = \"users\".\"id\"", + "name": "rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_cbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", \"cbe_evaluations\".\"notes\" as \"cbe_note\", \"cbe_evaluations\".\"updated_at\" as \"cbe_updated\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"delivery_schedule\" as \"delivery_schedule\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_response_cbe_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"notes\" as \"response_notes\", \"vendor_responses\".\"responded_by\" as \"responded_by\", \"vendor_responses\".\"responded_at\" as \"responded_at\", \"vendor_responses\".\"updated_at\" as \"response_updated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"status\" as \"vendor_status\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"response_status\" as \"commercial_response_status\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"vendor_commercial_responses\".\"payment_terms\" as \"payment_terms\", \"vendor_commercial_responses\".\"incoterms\" as \"incoterms\", \"vendor_commercial_responses\".\"delivery_period\" as \"delivery_period\", \"vendor_commercial_responses\".\"warranty_period\" as \"warranty_period\", \"vendor_commercial_responses\".\"validity_period\" as \"validity_period\", \"vendor_commercial_responses\".\"price_breakdown\" as \"price_breakdown\", \"vendor_commercial_responses\".\"commercial_notes\" as \"commercial_notes\", \"vendor_commercial_responses\".\"created_at\" as \"commercial_created_at\", \"vendor_commercial_responses\".\"updated_at\" as \"commercial_updated_at\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"commercial_response_id\" = \"vendor_commercial_responses\".\"id\"\n ) as \"commercial_attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n AND \"vendor_response_attachments\".\"attachment_type\" = 'TECHNICAL_SPEC'\n ) as \"technical_attachment_count\", (\n SELECT MAX(\"uploaded_at\") \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"latest_attachment_date\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\"", + "name": "vendor_response_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_responses_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"created_at\" as \"rfq_created_at\", \"rfqs\".\"updated_at\" as \"rfq_updated_at\", \"rfqs\".\"created_by\" as \"rfq_created_by\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"responded_at\" as \"responded_at\", CASE WHEN \"vendor_technical_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_technical_response\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", CASE WHEN \"vendor_commercial_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_commercial_response\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"rfq_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE') left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"cbe_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\")", + "name": "vendor_responses_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_rfq_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", + "name": "vendor_rfq_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_tbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", \"vendor_technical_responses\".\"response_status\" as \"technical_response_status\", \"vendor_technical_responses\".\"summary\" as \"technical_summary\", \"vendor_technical_responses\".\"notes\" as \"technical_notes\", \"vendor_technical_responses\".\"updated_at\" as \"technical_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"rfq_evaluations\".\"notes\" as \"tbe_note\", \"rfq_evaluations\".\"updated_at\" as \"tbe_updated\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_tbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.role_view": { + "columns": {}, + "definition": "select \"roles\".\"id\" as \"id\", \"roles\".\"name\" as \"name\", \"roles\".\"description\" as \"description\", \"roles\".\"domain\" as \"domain\", \"roles\".\"created_at\" as \"created_at\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", COUNT(\"users\".\"id\") as \"user_count\" from \"roles\" left join \"user_roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" left join \"users\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"vendors\" on \"roles\".\"company_id\" = \"vendors\".\"id\" group by \"roles\".\"id\", \"vendors\".\"id\"", + "name": "role_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.user_view": { + "columns": {}, + "definition": "select \"users\".\"id\" as \"user_id\", \"users\".\"name\" as \"user_name\", \"users\".\"email\" as \"user_email\", \"users\".\"domain\" as \"user_domain\", \"users\".\"image_url\" as \"user_image\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"vendors\" on \"users\".\"company_id\" = \"vendors\".\"id\" left join \"user_roles\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" group by \"users\".\"id\", \"vendors\".\"id\"", + "name": "user_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.form_lists_view": { + "columns": {}, + "definition": "select \"tag_type_class_form_mappings\".\"id\" as \"id\", \"tag_type_class_form_mappings\".\"project_id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"tag_type_class_form_mappings\".\"tag_type_label\" as \"tag_type_label\", \"tag_type_class_form_mappings\".\"class_label\" as \"class_label\", \"tag_type_class_form_mappings\".\"form_code\" as \"form_code\", \"tag_type_class_form_mappings\".\"form_name\" as \"form_name\", \"tag_type_class_form_mappings\".\"ep\" as \"ep\", \"tag_type_class_form_mappings\".\"remark\" as \"remark\", \"tag_type_class_form_mappings\".\"created_at\" as \"created_at\", \"tag_type_class_form_mappings\".\"updated_at\" as \"updated_at\" from \"tag_type_class_form_mappings\" inner join \"projects\" on \"tag_type_class_form_mappings\".\"project_id\" = \"projects\".\"id\"", + "name": "form_lists_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.view_tag_subfields": { + "columns": { + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "definition": "select \"tag_subfields\".\"id\" as \"id\", \"tag_subfields\".\"tag_type_code\", \"tag_types\".\"description\", \"tag_subfields\".\"attributes_id\", \"tag_subfields\".\"attributes_description\", \"tag_subfields\".\"expression\", \"tag_subfields\".\"delimiter\", \"tag_subfields\".\"sort_order\", \"tag_subfields\".\"created_at\", \"tag_subfields\".\"updated_at\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\", \"projects\".\"name\" from \"tag_subfields\" inner join \"tag_types\" on (\"tag_subfields\".\"tag_type_code\" = \"tag_types\".\"code\" and \"tag_subfields\".\"project_id\" = \"tag_types\".\"project_id\") inner join \"projects\" on \"tag_subfields\".\"project_id\" = \"projects\".\"id\"", + "name": "view_tag_subfields", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.document_stages_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_count": { + "name": "stage_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_list": { + "name": "stage_list", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT\n d.id AS document_id,\n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n d.contract_id,\n (SELECT COUNT(*) FROM issue_stages WHERE document_id = d.id) AS stage_count,\n COALESCE( \n (SELECT json_agg(i.stage_name) FROM issue_stages i WHERE i.document_id = d.id), \n '[]'\n ) AS stage_list,\n d.created_at,\n d.updated_at\n FROM documents d\n", + "name": "document_stages_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.enhanced_documents_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_id": { + "name": "current_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_name": { + "name": "current_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_status": { + "name": "current_stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_order": { + "name": "current_stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_plan_date": { + "name": "current_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_actual_date": { + "name": "current_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_assignee_name": { + "name": "current_stage_assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_priority": { + "name": "current_stage_priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "days_until_due": { + "name": "days_until_due", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_overdue": { + "name": "is_overdue", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "days_difference": { + "name": "days_difference", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "total_stages": { + "name": "total_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "completed_stages": { + "name": "completed_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "progress_percentage": { + "name": "progress_percentage", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_status": { + "name": "latest_revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_submitted_date": { + "name": "latest_submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "all_stages": { + "name": "all_stages", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n WITH document_stats AS (\n SELECT \n d.id as document_id,\n COUNT(ist.id) as total_stages,\n COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) as completed_stages,\n CASE \n WHEN COUNT(ist.id) > 0 \n THEN ROUND((COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) * 100.0) / COUNT(ist.id))\n ELSE 0 \n END as progress_percentage\n FROM documents d\n LEFT JOIN issue_stages ist ON d.id = ist.document_id\n GROUP BY d.id\n ),\n current_stage_info AS (\n SELECT DISTINCT ON (document_id)\n document_id,\n id as current_stage_id,\n stage_name as current_stage_name,\n stage_status as current_stage_status,\n stage_order as current_stage_order,\n plan_date as current_stage_plan_date,\n actual_date as current_stage_actual_date,\n assignee_name as current_stage_assignee_name,\n priority as current_stage_priority,\n CASE \n WHEN actual_date IS NULL AND plan_date IS NOT NULL \n THEN plan_date - CURRENT_DATE\n ELSE NULL \n END as days_until_due,\n CASE \n WHEN actual_date IS NULL AND plan_date < CURRENT_DATE \n THEN true\n WHEN actual_date IS NOT NULL AND actual_date > plan_date \n THEN true\n ELSE false \n END as is_overdue,\n CASE \n WHEN actual_date IS NOT NULL AND plan_date IS NOT NULL \n THEN actual_date - plan_date\n ELSE NULL \n END as days_difference\n FROM issue_stages\n WHERE stage_status NOT IN ('COMPLETED', 'APPROVED')\n ORDER BY document_id, stage_order ASC, priority DESC\n ),\n latest_revision_info AS (\n SELECT DISTINCT ON (ist.document_id)\n ist.document_id,\n r.id as latest_revision_id,\n r.revision as latest_revision,\n r.revision_status as latest_revision_status,\n r.uploader_name as latest_revision_uploader_name,\n r.submitted_date as latest_submitted_date\n FROM revisions r\n JOIN issue_stages ist ON r.issue_stage_id = ist.id\n ORDER BY ist.document_id, r.created_at DESC\n ),\n -- 리비전별 첨부파일 집계\n revision_attachments AS (\n SELECT \n r.id as revision_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', da.id,\n 'revisionId', da.revision_id,\n 'fileName', da.file_name,\n 'filePath', da.file_path,\n 'fileSize', da.file_size,\n 'fileType', da.file_type,\n 'createdAt', da.created_at,\n 'updatedAt', da.updated_at\n ) ORDER BY da.created_at\n ) FILTER (WHERE da.id IS NOT NULL),\n '[]'::json\n ) as attachments\n FROM revisions r\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY r.id\n ),\n -- 스테이지별 리비전 집계 (첨부파일 포함)\n stage_revisions AS (\n SELECT \n ist.id as stage_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', r.id,\n 'issueStageId', r.issue_stage_id,\n 'revision', r.revision,\n 'uploaderType', r.uploader_type,\n 'uploaderId', r.uploader_id,\n 'uploaderName', r.uploader_name,\n 'comment', r.comment,\n 'revisionStatus', r.revision_status,\n 'submittedDate', r.submitted_date,\n 'uploadedAt', r.uploaded_at,\n 'approvedDate', r.approved_date,\n 'reviewStartDate', r.review_start_date,\n 'rejectedDate', r.rejected_date,\n 'reviewerId', r.reviewer_id,\n 'reviewerName', r.reviewer_name,\n 'reviewComments', r.review_comments,\n 'createdAt', r.created_at,\n 'updatedAt', r.updated_at,\n 'attachments', ra.attachments\n ) ORDER BY r.created_at\n ) FILTER (WHERE r.id IS NOT NULL),\n '[]'::json\n ) as revisions\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN revision_attachments ra ON r.id = ra.revision_id\n GROUP BY ist.id\n ),\n -- 문서별 스테이지 집계 (리비전 포함)\n stage_aggregation AS (\n SELECT \n ist.document_id,\n json_agg(\n json_build_object(\n 'id', ist.id,\n 'stageName', ist.stage_name,\n 'stageStatus', ist.stage_status,\n 'stageOrder', ist.stage_order,\n 'planDate', ist.plan_date,\n 'actualDate', ist.actual_date,\n 'assigneeName', ist.assignee_name,\n 'priority', ist.priority,\n 'revisions', sr.revisions\n ) ORDER BY ist.stage_order\n ) as all_stages\n FROM issue_stages ist\n LEFT JOIN stage_revisions sr ON ist.id = sr.stage_id\n GROUP BY ist.document_id\n ),\n attachment_counts AS (\n SELECT \n ist.document_id,\n COUNT(da.id) as attachment_count\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY ist.document_id\n )\n \n SELECT \n d.id as document_id,\n d.doc_number,\n d.vendor_doc_number, -- ✅ 벤더 문서 번호 추가\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n -- ✅ 프로젝트 및 벤더 정보 추가\n p.code as project_code,\n v.vendor_name as vendor_name,\n v.vendor_code as vendor_code,\n \n -- 현재 스테이지 정보\n csi.current_stage_id,\n csi.current_stage_name,\n csi.current_stage_status,\n csi.current_stage_order,\n csi.current_stage_plan_date,\n csi.current_stage_actual_date,\n csi.current_stage_assignee_name,\n csi.current_stage_priority,\n \n -- 계산 필드\n csi.days_until_due,\n csi.is_overdue,\n csi.days_difference,\n \n -- 진행률 정보\n ds.total_stages,\n ds.completed_stages,\n ds.progress_percentage,\n \n -- 최신 리비전 정보\n lri.latest_revision_id,\n lri.latest_revision,\n lri.latest_revision_status,\n lri.latest_revision_uploader_name,\n lri.latest_submitted_date,\n \n -- 전체 스테이지 (리비전 및 첨부파일 포함)\n COALESCE(sa.all_stages, '[]'::json) as all_stages,\n \n -- 기타\n COALESCE(ac.attachment_count, 0) as attachment_count,\n d.created_at,\n d.updated_at\n \n FROM documents d\n -- ✅ contracts, projects, vendors 테이블 JOIN 추가\n LEFT JOIN contracts c ON d.contract_id = c.id\n LEFT JOIN projects p ON c.project_id = p.id\n LEFT JOIN vendors v ON c.vendor_id = v.id\n \n LEFT JOIN document_stats ds ON d.id = ds.document_id\n LEFT JOIN current_stage_info csi ON d.id = csi.document_id\n LEFT JOIN latest_revision_info lri ON d.id = lri.document_id\n LEFT JOIN stage_aggregation sa ON d.id = sa.document_id\n LEFT JOIN attachment_counts ac ON d.id = ac.document_id\n \n ORDER BY d.created_at DESC\n", + "name": "enhanced_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.sync_status_view": { + "columns": { + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "total_changes": { + "name": "total_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pending_changes": { + "name": "pending_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "synced_changes": { + "name": "synced_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "failed_changes": { + "name": "failed_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "last_sync_at": { + "name": "last_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_sync_at": { + "name": "next_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n WITH change_stats AS (\n SELECT \n cl.contract_id,\n sc.target_system,\n COUNT(*) as total_changes,\n COUNT(CASE WHEN cl.is_synced = false AND cl.sync_attempts < sc.retry_max_attempts THEN 1 END) as pending_changes,\n COUNT(CASE WHEN cl.is_synced = true THEN 1 END) as synced_changes,\n COUNT(CASE WHEN cl.sync_attempts >= sc.retry_max_attempts AND cl.is_synced = false THEN 1 END) as failed_changes,\n MAX(cl.synced_at) as last_sync_at\n FROM change_logs cl\n CROSS JOIN sync_configs sc \n WHERE cl.contract_id = sc.contract_id\n AND (cl.target_systems IS NULL OR cl.target_systems @> to_jsonb(sc.target_system))\n GROUP BY cl.contract_id, sc.target_system\n )\n SELECT \n cs.contract_id,\n cs.target_system,\n COALESCE(cs.total_changes, 0) as total_changes,\n COALESCE(cs.pending_changes, 0) as pending_changes,\n COALESCE(cs.synced_changes, 0) as synced_changes,\n COALESCE(cs.failed_changes, 0) as failed_changes,\n cs.last_sync_at,\n CASE \n WHEN sc.sync_enabled = true AND sc.last_successful_sync IS NOT NULL \n THEN sc.last_successful_sync + (sc.sync_interval_minutes || ' minutes')::interval\n ELSE NULL\n END as next_sync_at,\n sc.sync_enabled\n FROM sync_configs sc\n LEFT JOIN change_stats cs ON sc.contract_id = cs.contract_id AND sc.target_system = cs.target_system\n", + "name": "sync_status_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_documents_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "latest_stage_id": { + "name": "latest_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_stage_name": { + "name": "latest_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_stage_plan_date": { + "name": "latest_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_stage_actual_date": { + "name": "latest_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_type": { + "name": "latest_revision_uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT \n d.id, \n d.doc_number,\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n (SELECT id FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_id,\n (SELECT stage_name FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_name,\n (SELECT plan_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_plan_date,\n (SELECT actual_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_actual_date,\n \n (SELECT r.id FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_id,\n (SELECT r.revision FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision,\n (SELECT r.uploader_type FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_type,\n (SELECT r.uploader_name FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_name,\n \n (SELECT COUNT(*) FROM document_attachments a JOIN revisions r ON a.revision_id = r.id JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id) AS attachment_count,\n \n d.created_at,\n d.updated_at\n FROM documents d\n JOIN contracts c ON d.contract_id = c.id\n ", + "name": "vendor_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_candidates_with_vendor_info": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_candidates\".\"id\", \"vendor_candidates\".\"company_name\", \"vendor_candidates\".\"contact_email\", \"vendor_candidates\".\"contact_phone\", \"vendor_candidates\".\"tax_id\", \"vendor_candidates\".\"address\", \"vendor_candidates\".\"country\", \"vendor_candidates\".\"source\", \"vendor_candidates\".\"status\", \"vendor_candidates\".\"items\", \"vendor_candidates\".\"remark\", \"vendor_candidates\".\"created_at\", \"vendor_candidates\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"created_at\" as \"vendor_created_at\", (\n SELECT l2.\"created_at\"\n FROM \"vendor_candidate_logs\" l2\n WHERE l2.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l2.\"action\" = 'status_change'\n ORDER BY l2.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_at\", (\n SELECT u.\"name\"\n FROM \"users\" u\n JOIN \"vendor_candidate_logs\" l3\n ON l3.\"user_id\" = u.\"id\"\n WHERE l3.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l3.\"action\" = 'status_change'\n ORDER BY l3.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_by\", (\n SELECT l4.\"created_at\"\n FROM \"vendor_candidate_logs\" l4\n WHERE l4.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l4.\"action\" = 'invite_sent'\n ORDER BY l4.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_at\", (\n SELECT u2.\"name\"\n FROM \"users\" u2\n JOIN \"vendor_candidate_logs\" l5\n ON l5.\"user_id\" = u2.\"id\"\n WHERE l5.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l5.\"action\" = 'invite_sent'\n ORDER BY l5.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_by\" from \"vendor_candidates\" left join \"vendors\" on \"vendor_candidates\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "vendor_candidates_with_vendor_info", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"business_size\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"", + "name": "vendor_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", + "name": "vendor_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_materials_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_materials\".\"id\", \"vendor_possible_materials\".\"vendor_id\", \"materials\".\"item_name\", \"materials\".\"item_code\", \"materials\".\"description\", \"materials\".\"unit_of_measure\", \"materials\".\"steel_type\", \"materials\".\"grade_material\", \"vendor_possible_materials\".\"created_at\", \"vendor_possible_materials\".\"updated_at\" from \"vendor_possible_materials\" left join \"materials\" on \"vendor_possible_materials\".\"item_code\" = \"materials\".\"item_code\"", + "name": "vendor_materials_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendors_with_types": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"tax_id\" as \"tax_id\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"phone\" as \"phone\", \"vendors\".\"email\" as \"email\", \"vendors\".\"business_size\" as \"business_size\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"status\", \"vendors\".\"vendor_type_id\" as \"vendor_type_id\", \"vendors\".\"representative_name\" as \"representative_name\", \"vendors\".\"representative_birth\" as \"representative_birth\", \"vendors\".\"representative_email\" as \"representative_email\", \"vendors\".\"representative_phone\" as \"representative_phone\", \"vendors\".\"corporate_registration_number\" as \"corporate_registration_number\", \"vendors\".\"items\" as \"items\", \"vendors\".\"credit_agency\" as \"credit_agency\", \"vendors\".\"credit_rating\" as \"credit_rating\", \"vendors\".\"cash_flow_rating\" as \"cash_flow_rating\", \"vendors\".\"created_at\" as \"created_at\", \"vendors\".\"updated_at\" as \"updated_at\", \"vendor_types\".\"name_ko\" as \"vendor_type_name\", \"vendor_types\".\"name_en\" as \"vendor_type_name_en\", \"vendor_types\".\"code\" as \"vendor_type_code\", \n CASE\n WHEN \"vendors\".\"status\" = 'ACTIVE' THEN '정규업체'\n WHEN \"vendors\".\"status\" IN ('INACTIVE', 'BLACKLISTED', 'REJECTED') THEN ''\n ELSE '잠재업체'\n END\n as \"vendor_category\" from \"vendors\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\"", + "name": "vendors_with_types", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.basic_contract_view": { + "columns": {}, + "definition": "select \"basic_contract\".\"id\" as \"id\", \"basic_contract\".\"template_id\" as \"template_id\", \"basic_contract\".\"vendor_id\" as \"vendor_id\", \"basic_contract\".\"requested_by\" as \"requested_by\", \"basic_contract\".\"status\" as \"basic_contract_status\", \"basic_contract\".\"created_at\" as \"created_at\", \"basic_contract\".\"updated_at\" as \"updated_at\", \"basic_contract\".\"updated_at\" as \"completed_at\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"email\" as \"vendor_email\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"users\".\"name\" as \"user_name\", \"basic_contract_templates\".\"template_name\" as \"template_name\", \"basic_contract_templates\".\"validity_period\" as \"validityPeriod\", \"basic_contract_templates\".\"file_path\" as \"file_path\", \"basic_contract_templates\".\"file_name\" as \"file_name\", \"basic_contract\".\"file_path\" as \"signed_file_path\" from \"basic_contract\" left join \"vendors\" on \"basic_contract\".\"vendor_id\" = \"vendors\".\"id\" left join \"users\" on \"basic_contract\".\"requested_by\" = \"users\".\"id\" left join \"basic_contract_templates\" on \"basic_contract\".\"template_id\" = \"basic_contract_templates\".\"id\"", + "name": "basic_contract_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.pr_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"pr_items\".\"id\", \"pr_items\".\"procurement_rfqs_id\", \"pr_items\".\"rfq_item\", \"pr_items\".\"pr_item\", \"pr_items\".\"pr_no\", \"pr_items\".\"material_code\", \"pr_items\".\"material_category\", \"pr_items\".\"acc\", \"pr_items\".\"material_description\", \"pr_items\".\"size\", \"pr_items\".\"delivery_date\", \"pr_items\".\"quantity\", \"pr_items\".\"uom\", \"pr_items\".\"gross_weight\", \"pr_items\".\"gw_uom\", \"pr_items\".\"spec_no\", \"pr_items\".\"spec_url\", \"pr_items\".\"tracking_no\", \"pr_items\".\"major_yn\", \"pr_items\".\"project_def\", \"pr_items\".\"project_sc\", \"pr_items\".\"project_kl\", \"pr_items\".\"project_lc\", \"pr_items\".\"project_dl\", \"pr_items\".\"remark\", \"procurement_rfqs\".\"rfq_code\", \"procurement_rfqs\".\"item_code\", \"procurement_rfqs\".\"item_name\" from \"pr_items\" left join \"procurement_rfqs\" on \"pr_items\".\"procurement_rfqs_id\" = \"procurement_rfqs\".\"id\"", + "name": "pr_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfq_details_view": { + "columns": {}, + "definition": "select \"rfq_details\".\"id\" as \"detail_id\", \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfqs\".\"item_code\" as \"item_code\", \"rfqs\".\"item_name\" as \"item_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"country\" as \"vendor_country\", \"rfq_details\".\"currency\" as \"currency\", \"payment_terms\".\"code\" as \"payment_terms_code\", \"payment_terms\".\"description\" as \"payment_terms_description\", \"incoterms\".\"code\" as \"incoterms_code\", \"incoterms\".\"description\" as \"incoterms_description\", \"rfq_details\".\"incoterms_detail\" as \"incoterms_detail\", \"rfq_details\".\"delivery_date\" as \"delivery_date\", \"rfq_details\".\"tax_code\" as \"tax_code\", \"rfq_details\".\"place_of_shipping\" as \"place_of_shipping\", \"rfq_details\".\"place_of_destination\" as \"place_of_destination\", \"rfq_details\".\"material_price_related_yn\" as \"material_price_related_yn\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"rfq_details\".\"updated_at\" as \"updated_at\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\"\n ) as \"pr_items_count\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\" \n AND major_yn = true\n ) as \"major_items_count\", (\n SELECT COUNT(*) \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"comment_count\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_comment_date\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\" AND is_vendor_comment = true\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_vendor_comment_date\", (\n SELECT COUNT(*) \n FROM procurement_rfq_attachments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) > 0\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"has_quotation\", (\n SELECT status\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_status\", (\n SELECT total_price\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_total_price\", (\n SELECT quotation_version\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"quotation_version\", (\n SELECT COUNT(DISTINCT quotation_version)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"quotation_version_count\", (\n SELECT created_at\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"last_quotation_date\" from \"procurement_rfq_details\" \"rfq_details\" left join \"procurement_rfqs\" \"rfqs\" on \"rfq_details\".\"procurement_rfqs_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"rfq_details\".\"vendors_id\" = \"vendors\".\"id\" left join \"payment_terms\" on \"rfq_details\".\"payment_terms_code\" = \"payment_terms\".\"code\" left join \"incoterms\" on \"rfq_details\".\"incoterms_code\" = \"incoterms\".\"code\" left join \"users\" \"updated_by_user\" on \"rfq_details\".\"updated_by\" = \"updated_by_user\".\"id\"", + "name": "procurement_rfq_details_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfqs_view": { + "columns": {}, + "definition": "select \"procurement_rfqs\".\"id\" as \"id\", \"procurement_rfqs\".\"rfq_code\" as \"rfq_code\", \"procurement_rfqs\".\"series\" as \"series\", \"procurement_rfqs\".\"rfq_sealed_yn\" as \"rfq_sealed_yn\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"procurement_rfqs\".\"item_code\" as \"item_code\", \"procurement_rfqs\".\"item_name\" as \"item_name\", \"procurement_rfqs\".\"status\" as \"status\", \"procurement_rfqs\".\"pic_code\" as \"pic_code\", \"procurement_rfqs\".\"rfq_send_date\" as \"rfq_send_date\", \"procurement_rfqs\".\"due_date\" as \"due_date\", (\n SELECT MIN(submitted_at)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"procurement_rfqs\".\"id\"\n AND submitted_at IS NOT NULL\n ) as \"earliest_quotation_submitted_at\", \"created_by_user\".\"name\" as \"created_by_user_name\", \"sent_by_user\".\"name\" as \"sent_by_user_name\", \"procurement_rfqs\".\"updated_at\" as \"updated_at\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"procurement_rfqs\".\"remark\" as \"remark\", (\n SELECT material_code \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"major_item_material_code\", (\n SELECT pr_no \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"po_no\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n ) as \"pr_items_count\" from \"procurement_rfqs\" left join \"projects\" on \"procurement_rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" \"created_by_user\" on \"procurement_rfqs\".\"created_by\" = \"created_by_user\".\"id\" left join \"users\" \"updated_by_user\" on \"procurement_rfqs\".\"updated_by\" = \"updated_by_user\".\"id\" left join \"users\" \"sent_by_user\" on \"procurement_rfqs\".\"sent_by\" = \"sent_by_user\".\"id\"", + "name": "procurement_rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + } + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db/migrations/meta/0114_snapshot.json b/db/migrations/meta/0114_snapshot.json new file mode 100644 index 00000000..bd6a3032 --- /dev/null +++ b/db/migrations/meta/0114_snapshot.json @@ -0,0 +1,12004 @@ +{ + "id": "75dd3e4f-96c9-43fb-a234-df05c1b14fdc", + "prevId": "2cf5716b-3f28-458e-b0d2-52ab7aea3c75", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.companies": { + "name": "companies", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "companies_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "taxID": { + "name": "taxID", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_envelopes": { + "name": "contract_envelopes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_envelopes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "envelope_id": { + "name": "envelope_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": true + }, + "document_id": { + "name": "document_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": false + }, + "envelope_status": { + "name": "envelope_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_envelopes_contract_id_contracts_id_fk": { + "name": "contract_envelopes_contract_id_contracts_id_fk", + "tableFrom": "contract_envelopes", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_items": { + "name": "contract_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_items_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_id": { + "name": "item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "unit_price": { + "name": "unit_price", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "total_line_amount": { + "name": "total_line_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_items_contract_item_idx": { + "name": "contract_items_contract_item_idx", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "contract_items_contract_id_contracts_id_fk": { + "name": "contract_items_contract_id_contracts_id_fk", + "tableFrom": "contract_items", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_items_item_id_items_id_fk": { + "name": "contract_items_item_id_items_id_fk", + "tableFrom": "contract_items", + "tableTo": "items", + "columnsFrom": [ + "item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_items_contract_id_item_id_unique": { + "name": "contract_items_contract_id_item_id_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_id", + "item_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_signers": { + "name": "contract_signers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_signers_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "envelope_id": { + "name": "envelope_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_contact_id": { + "name": "vendor_contact_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "signer_type": { + "name": "signer_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'VENDOR'" + }, + "signer_email": { + "name": "signer_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "signer_name": { + "name": "signer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "signer_position": { + "name": "signer_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "signer_status": { + "name": "signer_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "signed_at": { + "name": "signed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_signers_envelope_id_contract_envelopes_id_fk": { + "name": "contract_signers_envelope_id_contract_envelopes_id_fk", + "tableFrom": "contract_signers", + "tableTo": "contract_envelopes", + "columnsFrom": [ + "envelope_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_signers_vendor_contact_id_vendor_contacts_id_fk": { + "name": "contract_signers_vendor_contact_id_vendor_contacts_id_fk", + "tableFrom": "contract_signers", + "tableTo": "vendor_contacts", + "columnsFrom": [ + "vendor_contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contracts": { + "name": "contracts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contracts_project_id_projects_id_fk": { + "name": "contracts_project_id_projects_id_fk", + "tableFrom": "contracts", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contracts_vendor_id_vendors_id_fk": { + "name": "contracts_vendor_id_vendors_id_fk", + "tableFrom": "contracts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contracts_contract_no_unique": { + "name": "contracts_contract_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.poa": { + "name": "poa", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "original_contract_no": { + "name": "original_contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "original_contract_name": { + "name": "original_contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_status": { + "name": "original_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "poa_original_contract_no_contracts_contract_no_fk": { + "name": "poa_original_contract_no_contracts_contract_no_fk", + "tableFrom": "poa", + "tableTo": "contracts", + "columnsFrom": [ + "original_contract_no" + ], + "columnsTo": [ + "contract_no" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_project_id_projects_id_fk": { + "name": "poa_project_id_projects_id_fk", + "tableFrom": "poa", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_vendor_id_vendors_id_fk": { + "name": "poa_vendor_id_vendors_id_fk", + "tableFrom": "poa", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_hull": { + "name": "item_offshore_hull", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_hull_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_hull_item_code_items_item_code_fk": { + "name": "item_offshore_hull_item_code_items_item_code_fk", + "tableFrom": "item_offshore_hull", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_top": { + "name": "item_offshore_top", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_top_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_top_item_code_items_item_code_fk": { + "name": "item_offshore_top_item_code_items_item_code_fk", + "tableFrom": "item_offshore_top", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_shipbuilding": { + "name": "item_shipbuilding", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ship_types": { + "name": "ship_types", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'OPTION'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_shipbuilding_item_code_items_item_code_fk": { + "name": "item_shipbuilding_item_code_items_item_code_fk", + "tableFrom": "item_shipbuilding", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.items": { + "name": "items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_no": { + "name": "project_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "package_code": { + "name": "package_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "sm_code": { + "name": "sm_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "items_item_code_unique": { + "name": "items_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.materials": { + "name": "materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "materials_item_code_unique": { + "name": "materials_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias": { + "name": "pq_criterias", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "check_point": { + "name": "check_point", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "group_name": { + "name": "group_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias_extension": { + "name": "pq_criterias_extension", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_criteria_id": { + "name": "pq_criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_info": { + "name": "contract_info", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "additional_requirement": { + "name": "additional_requirement", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk": { + "name": "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "pq_criterias", + "columnsFrom": [ + "pq_criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "pq_criterias_extension_project_id_projects_id_fk": { + "name": "pq_criterias_extension_project_id_projects_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_criteria_attachments": { + "name": "vendor_criteria_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_criteria_answer_id": { + "name": "vendor_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_criteria_attachments", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigation_attachments": { + "name": "vendor_investigation_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "investigation_id": { + "name": "investigation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'REPORT'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { + "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", + "tableFrom": "vendor_investigation_attachments", + "tableTo": "vendor_investigations", + "columnsFrom": [ + "investigation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigations": { + "name": "vendor_investigations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigations_vendor_id_vendors_id_fk": { + "name": "vendor_investigations_vendor_id_vendors_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk": { + "name": "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendor_pq_submissions", + "columnsFrom": [ + "pq_submission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "vendor_investigations_requester_id_users_id_fk": { + "name": "vendor_investigations_requester_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_qm_manager_id_users_id_fk": { + "name": "vendor_investigations_qm_manager_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "qm_manager_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_submissions": { + "name": "vendor_pq_submissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_number": { + "name": "pq_number", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_pq_submission": { + "name": "unique_pq_submission", + "columns": [ + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_pq_submissions_requester_id_users_id_fk": { + "name": "vendor_pq_submissions_requester_id_users_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_pq_submissions_vendor_id_vendors_id_fk": { + "name": "vendor_pq_submissions_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_submissions_project_id_projects_id_fk": { + "name": "vendor_pq_submissions_project_id_projects_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_pq_submissions_pq_number_unique": { + "name": "vendor_pq_submissions_pq_number_unique", + "nullsNotDistinct": false, + "columns": [ + "pq_number" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_criteria_answers": { + "name": "vendor_pq_criteria_answers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "criteria_id": { + "name": "criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "answer": { + "name": "answer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_criteria_answers_vendor_id_vendors_id_fk": { + "name": "vendor_pq_criteria_answers_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": { + "name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "pq_criterias", + "columnsFrom": [ + "criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_project_id_projects_id_fk": { + "name": "vendor_pq_criteria_answers_project_id_projects_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_review_logs": { + "name": "vendor_pq_review_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_pq_criteria_answer_id": { + "name": "vendor_pq_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "reviewer_comment": { + "name": "reviewer_comment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_pq_review_logs", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_pq_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_project_pqs": { + "name": "vendor_project_pqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_project_pqs_vendor_id_vendors_id_fk": { + "name": "vendor_project_pqs_vendor_id_vendors_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_project_pqs_project_id_projects_id_fk": { + "name": "vendor_project_pqs_project_id_projects_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bidding_projects": { + "name": "bidding_projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "proj_nm": { + "name": "proj_nm", + "type": "varchar(90)", + "primaryKey": false, + "notNull": false + }, + "sector": { + "name": "sector", + "type": "char(1)", + "primaryKey": false, + "notNull": false + }, + "proj_msrm": { + "name": "proj_msrm", + "type": "numeric(3, 0)", + "primaryKey": false, + "notNull": false + }, + "kunnr": { + "name": "kunnr", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "kunnr_nm": { + "name": "kunnr_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "cls_1": { + "name": "cls_1", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "cls1_nm": { + "name": "cls1_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "ptype": { + "name": "ptype", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "ptype_nm": { + "name": "ptype_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_cd": { + "name": "pmodel_cd", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "pmodel_nm": { + "name": "pmodel_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_sz": { + "name": "pmodel_sz", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "pmodel_uom": { + "name": "pmodel_uom", + "type": "char(5)", + "primaryKey": false, + "notNull": false + }, + "txt04": { + "name": "txt04", + "type": "char(4)", + "primaryKey": false, + "notNull": false + }, + "txt30": { + "name": "txt30", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "estm_pm": { + "name": "estm_pm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "bidding_projects_pspid_unique": { + "name": "bidding_projects_pspid_unique", + "nullsNotDistinct": false, + "columns": [ + "pspid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_series": { + "name": "project_series", + "schema": "", + "columns": { + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "sers_no": { + "name": "sers_no", + "type": "char(3)", + "primaryKey": false, + "notNull": true + }, + "sc_dt": { + "name": "sc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "kl_dt": { + "name": "kl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "lc_dt": { + "name": "lc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dl_dt": { + "name": "dl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dock_no": { + "name": "dock_no", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "dock_nm": { + "name": "dock_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "proj_no": { + "name": "proj_no", + "type": "char(24)", + "primaryKey": false, + "notNull": false + }, + "post1": { + "name": "post1", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "project_sersNo_unique": { + "name": "project_sersNo_unique", + "columns": [ + { + "expression": "pspid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sers_no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "project_series_pspid_bidding_projects_pspid_fk": { + "name": "project_series_pspid_bidding_projects_pspid_fk", + "tableFrom": "project_series", + "tableTo": "bidding_projects", + "columnsFrom": [ + "pspid" + ], + "columnsTo": [ + "pspid" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projects": { + "name": "projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cbe_evaluations": { + "name": "cbe_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluated_by": { + "name": "evaluated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluated_at": { + "name": "evaluated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "result": { + "name": "result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "total_cost": { + "name": "total_cost", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_schedule": { + "name": "delivery_schedule", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "cbe_evaluations_rfq_id_rfqs_id_fk": { + "name": "cbe_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_vendor_id_vendors_id_fk": { + "name": "cbe_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_evaluated_by_users_id_fk": { + "name": "cbe_evaluations_evaluated_by_users_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "users", + "columnsFrom": [ + "evaluated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_attachments": { + "name": "rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_attachments_rfq_id_rfqs_id_fk": { + "name": "rfq_attachments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_vendor_id_vendors_id_fk": { + "name": "rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_attachments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_cbe_id_cbe_evaluations_id_fk": { + "name": "rfq_attachments_cbe_id_cbe_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "cbe_evaluations", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_comment_id_rfq_comments_id_fk": { + "name": "rfq_attachments_comment_id_rfq_comments_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_comments": { + "name": "rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "comment_text": { + "name": "comment_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "commented_by": { + "name": "commented_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_comments_rfq_id_rfqs_id_fk": { + "name": "rfq_comments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_vendor_id_vendors_id_fk": { + "name": "rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_commented_by_users_id_fk": { + "name": "rfq_comments_commented_by_users_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "commented_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_comments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_cbe_id_vendor_responses_id_fk": { + "name": "rfq_comments_cbe_id_vendor_responses_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_evaluations": { + "name": "rfq_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "eval_type": { + "name": "eval_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "result": { + "name": "result", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_evaluations_rfq_id_rfqs_id_fk": { + "name": "rfq_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_evaluations_vendor_id_vendors_id_fk": { + "name": "rfq_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_items": { + "name": "rfq_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_items_rfq_id_rfqs_id_fk": { + "name": "rfq_items_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_items", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "rfq_items_item_code_items_item_code_fk": { + "name": "rfq_items_item_code_items_item_code_fk", + "tableFrom": "rfq_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfqs": { + "name": "rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "bid_project_id": { + "name": "bid_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false, + "default": "'PURCHASE'" + }, + "parent_rfq_id": { + "name": "parent_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfqs_project_id_projects_id_fk": { + "name": "rfqs_project_id_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_bid_project_id_bidding_projects_id_fk": { + "name": "rfqs_bid_project_id_bidding_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bid_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_created_by_users_id_fk": { + "name": "rfqs_created_by_users_id_fk", + "tableFrom": "rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_parent_rfq_id_rfqs_id_fk": { + "name": "rfqs_parent_rfq_id_rfqs_id_fk", + "tableFrom": "rfqs", + "tableTo": "rfqs", + "columnsFrom": [ + "parent_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "rfqs_rfq_code_unique": { + "name": "rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_commercial_responses": { + "name": "vendor_commercial_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "total_price": { + "name": "total_price", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_period": { + "name": "delivery_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "warranty_period": { + "name": "warranty_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "validity_period": { + "name": "validity_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "price_breakdown": { + "name": "price_breakdown", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "commercial_notes": { + "name": "commercial_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_commercial_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_commercial_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_commercial_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_attachments": { + "name": "vendor_response_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "technical_response_id": { + "name": "technical_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "commercial_response_id": { + "name": "commercial_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_attachments_response_id_vendor_responses_id_fk": { + "name": "vendor_response_attachments_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk": { + "name": "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_technical_responses", + "columnsFrom": [ + "technical_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk": { + "name": "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_commercial_responses", + "columnsFrom": [ + "commercial_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_responses": { + "name": "vendor_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'REVIEWING'" + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "responded_by": { + "name": "responded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "responded_at": { + "name": "responded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "vendor_response_unique": { + "name": "vendor_response_unique", + "columns": [ + { + "expression": "rfq_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_responses_rfq_id_rfqs_id_fk": { + "name": "vendor_responses_rfq_id_rfqs_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_responses_vendor_id_vendors_id_fk": { + "name": "vendor_responses_vendor_id_vendors_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_technical_responses": { + "name": "vendor_technical_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_technical_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_technical_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_technical_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.otps": { + "name": "otps", + "schema": "", + "columns": { + "email": { + "name": "email", + "type": "varchar(256)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(6)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "otpToken": { + "name": "otpToken", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "otp_expires": { + "name": "otp_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permissions": { + "name": "permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "permissions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "permission_key": { + "name": "permission_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.role_permissions": { + "name": "role_permissions", + "schema": "", + "columns": { + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "permission_id": { + "name": "permission_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "role_permissions_role_id_roles_id_fk": { + "name": "role_permissions_role_id_roles_id_fk", + "tableFrom": "role_permissions", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "role_permissions_permission_id_permissions_id_fk": { + "name": "role_permissions_permission_id_permissions_id_fk", + "tableFrom": "role_permissions", + "tableTo": "permissions", + "columnsFrom": [ + "permission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.roles": { + "name": "roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "roles_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "roles_company_id_vendors_id_fk": { + "name": "roles_company_id_vendors_id_fk", + "tableFrom": "roles", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_roles": { + "name": "user_roles", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_roles_user_id_users_id_fk": { + "name": "user_roles_user_id_users_id_fk", + "tableFrom": "user_roles", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_roles_role_id_roles_id_fk": { + "name": "user_roles_role_id_roles_id_fk", + "tableFrom": "user_roles", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "users_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'partners'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "image_url": { + "name": "image_url", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "language": { + "name": "language", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'en'" + } + }, + "indexes": {}, + "foreignKeys": { + "users_company_id_vendors_id_fk": { + "name": "users_company_id_vendors_id_fk", + "tableFrom": "users", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_entries": { + "name": "form_entries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_entries_contract_item_id_contract_items_id_fk": { + "name": "form_entries_contract_item_id_contract_items_id_fk", + "tableFrom": "form_entries", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_metas": { + "name": "form_metas", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "columns": { + "name": "columns", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_metas_project_id_projects_id_fk": { + "name": "form_metas_project_id_projects_id_fk", + "tableFrom": "form_metas", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "form_code_project_unique": { + "name": "form_code_project_unique", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.forms": { + "name": "forms", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "forms_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "eng": { + "name": "eng", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "im": { + "name": "im", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_item_form_code_unique": { + "name": "contract_item_form_code_unique", + "columns": [ + { + "expression": "contract_item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "form_code", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "forms_contract_item_id_contract_items_id_fk": { + "name": "forms_contract_item_id_contract_items_id_fk", + "tableFrom": "forms", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_class_attributes": { + "name": "tag_class_attributes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_class_attributes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "tag_class_id": { + "name": "tag_class_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "att_id": { + "name": "att_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "def_val": { + "name": "def_val", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uom_id": { + "name": "uom_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "seq": { + "name": "seq", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "tag_class_attributes_seq_idx": { + "name": "tag_class_attributes_seq_idx", + "columns": [ + { + "expression": "seq", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "tag_class_attributes_tag_class_id_tag_classes_id_fk": { + "name": "tag_class_attributes_tag_class_id_tag_classes_id_fk", + "tableFrom": "tag_class_attributes", + "tableTo": "tag_classes", + "columnsFrom": [ + "tag_class_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_att_id_in_tag_class": { + "name": "uniq_att_id_in_tag_class", + "nullsNotDistinct": false, + "columns": [ + "tag_class_id", + "att_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_classes": { + "name": "tag_classes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_classes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_classes_project_id_projects_id_fk": { + "name": "tag_classes_project_id_projects_id_fk", + "tableFrom": "tag_classes", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk": { + "name": "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk", + "tableFrom": "tag_classes", + "tableTo": "tag_types", + "columnsFrom": [ + "tag_type_code", + "project_id" + ], + "columnsTo": [ + "code", + "project_id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_code_in_project": { + "name": "uniq_code_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfield_options": { + "name": "tag_subfield_options", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfield_options_project_id_projects_id_fk": { + "name": "tag_subfield_options_project_id_projects_id_fk", + "tableFrom": "tag_subfield_options", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_attribute_project_code": { + "name": "uniq_attribute_project_code", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "attributes_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfields": { + "name": "tag_subfields", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfields_project_id_projects_id_fk": { + "name": "tag_subfields_project_id_projects_id_fk", + "tableFrom": "tag_subfields", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_tag_type_attribute": { + "name": "uniq_tag_type_attribute", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_code", + "attributes_id" + ] + }, + "uniq_attribute_id_project": { + "name": "uniq_attribute_id_project", + "nullsNotDistinct": false, + "columns": [ + "attributes_id", + "project_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_type_class_form_mappings": { + "name": "tag_type_class_form_mappings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_label": { + "name": "tag_type_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "class_label": { + "name": "class_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "ep": { + "name": "ep", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_mapping_in_project": { + "name": "uniq_mapping_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_label", + "class_label", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_types": { + "name": "tag_types", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_types_project_id_projects_id_fk": { + "name": "tag_types_project_id_projects_id_fk", + "tableFrom": "tag_types", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "tag_types_code_project_id_pk": { + "name": "tag_types_code_project_id_pk", + "columns": [ + "code", + "project_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tags": { + "name": "tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tags_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "tag_type": { + "name": "tag_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "class": { + "name": "class", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tags_contract_item_id_contract_items_id_fk": { + "name": "tags_contract_item_id_contract_items_id_fk", + "tableFrom": "tags", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_form_id_forms_id_fk": { + "name": "tags_form_id_forms_id_fk", + "tableFrom": "tags", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_item_tag_no_unique": { + "name": "contract_item_tag_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_item_id", + "tag_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_data_report_temps": { + "name": "vendor_data_report_temps", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_data_report_temps_contract_item_id_contract_items_id_fk": { + "name": "vendor_data_report_temps_contract_item_id_contract_items_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_data_report_temps_form_id_forms_id_fk": { + "name": "vendor_data_report_temps_form_id_forms_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.change_logs": { + "name": "change_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "changed_fields": { + "name": "changed_fields", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "old_values": { + "name": "old_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "new_values": { + "name": "new_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_name": { + "name": "user_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_synced": { + "name": "is_synced", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "sync_attempts": { + "name": "sync_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_sync_error": { + "name": "last_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "synced_at": { + "name": "synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "target_systems": { + "name": "target_systems", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + } + }, + "indexes": { + "idx_change_logs_contract_synced": { + "name": "idx_change_logs_contract_synced", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_synced", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_created_at": { + "name": "idx_change_logs_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_entity": { + "name": "idx_change_logs_entity", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_sync_attempts": { + "name": "idx_change_logs_sync_attempts", + "columns": [ + { + "expression": "sync_attempts", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.document_attachments": { + "name": "document_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "document_attachments_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "revision_id": { + "name": "revision_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "document_attachments_revision_id_revisions_id_fk": { + "name": "document_attachments_revision_id_revisions_id_fk", + "tableFrom": "document_attachments", + "tableTo": "revisions", + "columnsFrom": [ + "revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.documents": { + "name": "documents", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "documents_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "drawing_move_gbn": { + "name": "drawing_move_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "discipline": { + "name": "discipline", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "external_document_id": { + "name": "external_document_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "external_system_type": { + "name": "external_system_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "external_synced_at": { + "name": "external_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "shi_drawing_no": { + "name": "shi_drawing_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager": { + "name": "manager", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_enm": { + "name": "manager_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_no": { + "name": "manager_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "register_group": { + "name": "register_group", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "register_group_id": { + "name": "register_group_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "create_user_no": { + "name": "create_user_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "create_user_id": { + "name": "create_user_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "create_user_enm": { + "name": "create_user_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_contract_doc_status": { + "name": "unique_contract_doc_status", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_contract_vendor_doc": { + "name": "unique_contract_vendor_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"vendor_doc_number\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_external_doc": { + "name": "unique_external_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_system_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"external_document_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "drawing_kind_idx": { + "name": "drawing_kind_idx", + "columns": [ + { + "expression": "drawing_kind", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "documents_contract_id_contracts_id_fk": { + "name": "documents_contract_id_contracts_id_fk", + "tableFrom": "documents", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.issue_stages": { + "name": "issue_stages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "issue_stages_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_name": { + "name": "stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "plan_date": { + "name": "plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "actual_date": { + "name": "actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "stage_status": { + "name": "stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "stage_order": { + "name": "stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "priority": { + "name": "priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'MEDIUM'" + }, + "assignee_id": { + "name": "assignee_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "assignee_name": { + "name": "assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "reminder_days": { + "name": "reminder_days", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_document_stage": { + "name": "unique_document_stage", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_stage_order": { + "name": "document_stage_order", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "issue_stages_document_id_documents_id_fk": { + "name": "issue_stages_document_id_documents_id_fk", + "tableFrom": "issue_stages", + "tableTo": "documents", + "columnsFrom": [ + "document_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.revisions": { + "name": "revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "revisions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "issue_stage_id": { + "name": "issue_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "revision": { + "name": "revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "uploader_type": { + "name": "uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'vendor'" + }, + "uploader_id": { + "name": "uploader_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploader_name": { + "name": "uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "usage": { + "name": "usage", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "revision_status": { + "name": "revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'SUBMITTED'" + }, + "submitted_date": { + "name": "submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "review_start_date": { + "name": "review_start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "approved_date": { + "name": "approved_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "rejected_date": { + "name": "rejected_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "reviewer_id": { + "name": "reviewer_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "review_comments": { + "name": "review_comments", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "external_upload_id": { + "name": "external_upload_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_stage_rev": { + "name": "unique_stage_rev", + "columns": [ + { + "expression": "issue_stage_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "revision", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_batches": { + "name": "sync_batches", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "batch_size": { + "name": "batch_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "retry_count": { + "name": "retry_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "change_log_ids": { + "name": "change_log_ids", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "success_count": { + "name": "success_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "failure_count": { + "name": "failure_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sync_metadata": { + "name": "sync_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_batches_contract_system": { + "name": "idx_sync_batches_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_status": { + "name": "idx_sync_batches_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_created_at": { + "name": "idx_sync_batches_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_configs": { + "name": "sync_configs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "sync_interval_minutes": { + "name": "sync_interval_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 30 + }, + "last_successful_sync": { + "name": "last_successful_sync", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_sync_attempt": { + "name": "last_sync_attempt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "endpoint_url": { + "name": "endpoint_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "auth_token": { + "name": "auth_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "api_version": { + "name": "api_version", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'v1'" + }, + "max_batch_size": { + "name": "max_batch_size", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 100 + }, + "retry_max_attempts": { + "name": "retry_max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_configs_contract_system": { + "name": "idx_sync_configs_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sync_configs_contract_id_contracts_id_fk": { + "name": "sync_configs_contract_id_contracts_id_fk", + "tableFrom": "sync_configs", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_attachments": { + "name": "vendor_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'GENERAL'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_attachments_vendor_id_vendors_id_fk": { + "name": "vendor_attachments_vendor_id_vendors_id_fk", + "tableFrom": "vendor_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidates": { + "name": "vendor_candidates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidates_vendor_id_vendors_id_fk": { + "name": "vendor_candidates_vendor_id_vendors_id_fk", + "tableFrom": "vendor_candidates", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_contacts": { + "name": "vendor_contacts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contact_name": { + "name": "contact_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_position": { + "name": "contact_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "is_primary": { + "name": "is_primary", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_contacts_vendor_id_vendors_id_fk": { + "name": "vendor_contacts_vendor_id_vendors_id_fk", + "tableFrom": "vendor_contacts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_items": { + "name": "vendor_possible_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_items_vendor_id_vendors_id_fk": { + "name": "vendor_possible_items_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_items_item_code_items_item_code_fk": { + "name": "vendor_possible_items_item_code_items_item_code_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_materials": { + "name": "vendor_possible_materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_materials_vendor_id_vendors_id_fk": { + "name": "vendor_possible_materials_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_materials_item_code_materials_item_code_fk": { + "name": "vendor_possible_materials_item_code_materials_item_code_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "materials", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_types": { + "name": "vendor_types", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_types_code_unique": { + "name": "vendor_types_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors": { + "name": "vendors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "vendor_type_id": { + "name": "vendor_type_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_vendor_type_id_vendor_types_id_fk": { + "name": "vendors_vendor_type_id_vendor_types_id_fk", + "tableFrom": "vendors", + "tableTo": "vendor_types", + "columnsFrom": [ + "vendor_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tasks": { + "name": "tasks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'todo'" + }, + "label": { + "name": "label", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'bug'" + }, + "priority": { + "name": "priority", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'low'" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "current_timestamp" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tasks_code_unique": { + "name": "tasks_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidate_logs": { + "name": "vendor_candidate_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_candidate_id": { + "name": "vendor_candidate_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk": { + "name": "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "vendor_candidates", + "columnsFrom": [ + "vendor_candidate_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_candidate_logs_user_id_users_id_fk": { + "name": "vendor_candidate_logs_user_id_users_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors_logs": { + "name": "vendors_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_logs_vendor_id_vendors_id_fk": { + "name": "vendors_logs_vendor_id_vendors_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendors_logs_user_id_users_id_fk": { + "name": "vendors_logs_user_id_users_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract": { + "name": "basic_contract", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_id": { + "name": "template_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requested_by": { + "name": "requested_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "basic_contract_template_id_basic_contract_templates_id_fk": { + "name": "basic_contract_template_id_basic_contract_templates_id_fk", + "tableFrom": "basic_contract", + "tableTo": "basic_contract_templates", + "columnsFrom": [ + "template_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_vendor_id_vendors_id_fk": { + "name": "basic_contract_vendor_id_vendors_id_fk", + "tableFrom": "basic_contract", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_requested_by_users_id_fk": { + "name": "basic_contract_requested_by_users_id_fk", + "tableFrom": "basic_contract", + "tableTo": "users", + "columnsFrom": [ + "requested_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract_templates": { + "name": "basic_contract_templates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_templates_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_name": { + "name": "template_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "validity_period": { + "name": "validity_period", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.incoterms": { + "name": "incoterms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(20)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "incoterms_created_by_users_id_fk": { + "name": "incoterms_created_by_users_id_fk", + "tableFrom": "incoterms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payment_terms": { + "name": "payment_terms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "payment_terms_created_by_users_id_fk": { + "name": "payment_terms_created_by_users_id_fk", + "tableFrom": "payment_terms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pr_items": { + "name": "pr_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "pr_items", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_attachments": { + "name": "procurement_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "procurement_rfq_details_id": { + "name": "procurement_rfq_details_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk": { + "name": "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfq_details", + "columnsFrom": [ + "procurement_rfq_details_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_created_by_users_id_fk": { + "name": "procurement_attachments_created_by_users_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "attachment_type_check": { + "name": "attachment_type_check", + "value": "\"procurement_attachments\".\"procurement_rfqs_id\" IS NOT NULL OR \"procurement_attachments\".\"procurement_rfq_details_id\" IS NOT NULL" + } + }, + "isRLSEnabled": false + }, + "public.procurement_quotation_items": { + "name": "procurement_quotation_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pr_item_id": { + "name": "pr_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "material_code": { + "name": "material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "uom": { + "name": "uom", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "unit_price": { + "name": "unit_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "vendor_material_code": { + "name": "vendor_material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_material_description": { + "name": "vendor_material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "lead_time_in_days": { + "name": "lead_time_in_days", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_rate": { + "name": "discount_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_amount": { + "name": "discount_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_alternative": { + "name": "is_alternative", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_recommended": { + "name": "is_recommended", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_quotation_items_pr_item_id_pr_items_id_fk": { + "name": "procurement_quotation_items_pr_item_id_pr_items_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "pr_items", + "columnsFrom": [ + "pr_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_attachments": { + "name": "procurement_rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_uploaded_by_users_id_fk": { + "name": "procurement_rfq_attachments_uploaded_by_users_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_comments": { + "name": "procurement_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_comments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_user_id_users_id_fk": { + "name": "procurement_rfq_comments_user_id_users_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_details": { + "name": "procurement_rfq_details", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendors_id": { + "name": "vendors_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'VV'" + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_vendors_id_vendors_id_fk": { + "name": "procurement_rfq_details_vendors_id_vendors_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "vendors", + "columnsFrom": [ + "vendors_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_rfq_details_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_incoterms_code_incoterms_code_fk": { + "name": "procurement_rfq_details_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_updated_by_users_id_fk": { + "name": "procurement_rfq_details_updated_by_users_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfqs": { + "name": "procurement_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "series": { + "name": "series", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "rfq_sealed_yn": { + "name": "rfq_sealed_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfqs_project_id_projects_id_fk": { + "name": "procurement_rfqs_project_id_projects_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_sent_by_users_id_fk": { + "name": "procurement_rfqs_sent_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_created_by_users_id_fk": { + "name": "procurement_rfqs_created_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_updated_by_users_id_fk": { + "name": "procurement_rfqs_updated_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "procurement_rfqs_rfq_code_unique": { + "name": "procurement_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_vendor_quotations": { + "name": "procurement_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_items_count": { + "name": "total_items_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sub_total": { + "name": "sub_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "tax_total": { + "name": "tax_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "discount_total": { + "name": "discount_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "estimated_delivery_date": { + "name": "estimated_delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "procurement_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_incoterms_code_incoterms_code_fk": { + "name": "procurement_vendor_quotations_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.preset_shares": { + "name": "preset_shares", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "preset_id": { + "name": "preset_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "shared_with_user_id": { + "name": "shared_with_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'read'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "preset_shares_preset_id_table_presets_id_fk": { + "name": "preset_shares_preset_id_table_presets_id_fk", + "tableFrom": "preset_shares", + "tableTo": "table_presets", + "columnsFrom": [ + "preset_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_presets": { + "name": "table_presets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_shared": { + "name": "is_shared", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_attachments": { + "name": "tech_sales_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "tech_sales_rfq_id": { + "name": "tech_sales_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "tech_sales_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_attachments_created_by_users_id_fk": { + "name": "tech_sales_attachments_created_by_users_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comment_attachments": { + "name": "tech_sales_rfq_comment_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk": { + "name": "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk": { + "name": "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comments": { + "name": "tech_sales_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_user_id_users_id_fk": { + "name": "tech_sales_rfq_comments_user_id_users_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfqs": { + "name": "tech_sales_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_shipbuilding_id": { + "name": "item_shipbuilding_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "bidding_project_id": { + "name": "bidding_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_snapshot": { + "name": "project_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "series_snapshot": { + "name": "series_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk": { + "name": "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "item_shipbuilding", + "columnsFrom": [ + "item_shipbuilding_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk": { + "name": "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bidding_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_sent_by_users_id_fk": { + "name": "tech_sales_rfqs_sent_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_created_by_users_id_fk": { + "name": "tech_sales_rfqs_created_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_updated_by_users_id_fk": { + "name": "tech_sales_rfqs_updated_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tech_sales_rfqs_rfq_code_unique": { + "name": "tech_sales_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_vendor_quotations": { + "name": "tech_sales_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "tech_sales_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rotation_attempts": { + "name": "ocr_rotation_attempts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "rotation": { + "name": "rotation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "tables_found": { + "name": "tables_found", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "text_quality": { + "name": "text_quality", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "keyword_count": { + "name": "keyword_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "score": { + "name": "score", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "extracted_rows_count": { + "name": "extracted_rows_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_rotation_attempts_session_id_ocr_sessions_id_fk": { + "name": "ocr_rotation_attempts_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rotation_attempts", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rows": { + "name": "ocr_rows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "table_id": { + "name": "table_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "row_index": { + "name": "row_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "report_no": { + "name": "report_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "no": { + "name": "no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "identification_no": { + "name": "identification_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_no": { + "name": "joint_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_type": { + "name": "joint_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "welding_date": { + "name": "welding_date", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "source_table": { + "name": "source_table", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "source_row": { + "name": "source_row", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_ocr_row_unique": { + "name": "idx_ocr_row_unique", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "report_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "ocr_rows_table_id_ocr_tables_id_fk": { + "name": "ocr_rows_table_id_ocr_tables_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_tables", + "columnsFrom": [ + "table_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_session_id_ocr_sessions_id_fk": { + "name": "ocr_rows_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_user_id_users_id_fk": { + "name": "ocr_rows_user_id_users_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_sessions": { + "name": "ocr_sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "processing_time": { + "name": "processing_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "best_rotation": { + "name": "best_rotation", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_tables": { + "name": "total_tables", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_rows": { + "name": "total_rows", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "image_enhanced": { + "name": "image_enhanced", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pdf_converted": { + "name": "pdf_converted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "success": { + "name": "success", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "warnings": { + "name": "warnings", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_tables": { + "name": "ocr_tables", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "table_index": { + "name": "table_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "row_count": { + "name": "row_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_tables_session_id_ocr_sessions_id_fk": { + "name": "ocr_tables_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_tables", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.offshore_hull_work_type": { + "name": "offshore_hull_work_type", + "schema": "public", + "values": [ + "HA", + "HE", + "HH", + "HM", + "NC" + ] + }, + "public.offshore_top_work_type": { + "name": "offshore_top_work_type", + "schema": "public", + "values": [ + "TM", + "TS", + "TE", + "TP" + ] + }, + "public.work_type": { + "name": "work_type", + "schema": "public", + "values": [ + "기장", + "전장", + "선실", + "배관", + "철의" + ] + }, + "public.user_domain": { + "name": "user_domain", + "schema": "public", + "values": [ + "evcp", + "partners" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": { + "public.contracts_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"contracts\".\"id\", \"contracts\".\"contract_no\", \"contracts\".\"contract_name\", \"contracts\".\"status\", \"contracts\".\"start_date\", \"contracts\".\"end_date\", \"contracts\".\"project_id\", \"projects\".\"code\", \"projects\".\"name\", \"contracts\".\"vendor_id\", \"vendors\".\"vendor_name\", \"contracts\".\"payment_terms\", \"contracts\".\"delivery_terms\", \"contracts\".\"delivery_date\", \"contracts\".\"delivery_location\", \"contracts\".\"currency\", \"contracts\".\"total_amount\", \"contracts\".\"discount\", \"contracts\".\"tax\", \"contracts\".\"shipping_fee\", \"contracts\".\"net_total\", \"contracts\".\"partial_shipping_allowed\", \"contracts\".\"partial_payment_allowed\", \"contracts\".\"remarks\", \"contracts\".\"version\", \"contracts\".\"created_at\", \"contracts\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"contracts\".\"id\"\n ) as \"has_signature\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "contracts_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.poa_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", + "name": "poa_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.project_approved_vendors": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"status\", \"vendor_types\".\"name_ko\", \"vendor_types\".\"name_en\", \"projects\".\"code\", \"projects\".\"name\", \"projects\".\"type\", \"vendor_pq_submissions\".\"submitted_at\", \"vendor_pq_submissions\".\"approved_at\" from \"vendors\" inner join \"vendor_pq_submissions\" on \"vendor_pq_submissions\".\"vendor_id\" = \"vendors\".\"id\" inner join \"projects\" on \"vendor_pq_submissions\".\"project_id\" = \"projects\".\"id\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\" where \"vendor_pq_submissions\".\"status\" = 'APPROVED'", + "name": "project_approved_vendors", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_investigations_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"vendor_id\", \"vendor_investigations\".\"pq_submission_id\", \"vendor_investigations\".\"requester_id\", \"vendor_investigations\".\"qm_manager_id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"evaluation_type\", \"vendor_investigations\".\"investigation_address\", \"vendor_investigations\".\"investigation_method\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"forecasted_at\", \"vendor_investigations\".\"requested_at\", \"vendor_investigations\".\"confirmed_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"evaluation_score\", \"vendor_investigations\".\"evaluation_result\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", requester.name as \"requesterName\", requester.email as \"requesterEmail\", qm_manager.name as \"qmManagerName\", qm_manager.email as \"qmManagerEmail\", (\n CASE \n WHEN EXISTS (\n SELECT 1 FROM vendor_investigation_attachments via \n WHERE via.investigation_id = \"vendor_investigations\".\"id\"\n ) \n THEN true \n ELSE false \n END\n ) as \"hasAttachments\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\" left join users AS requester on \"vendor_investigations\".\"requester_id\" = requester.id left join users AS qm_manager on \"vendor_investigations\".\"qm_manager_id\" = qm_manager.id", + "name": "vendor_investigations_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.cbe_view": { + "columns": {}, + "definition": "select \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"rfq_id\" as \"rfq_id\", \"cbe_evaluations\".\"vendor_id\" as \"vendor_id\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"result\" as \"result\", \"cbe_evaluations\".\"notes\" as \"notes\", \"cbe_evaluations\".\"evaluated_by\" as \"evaluated_by\", \"cbe_evaluations\".\"evaluated_at\" as \"evaluated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"name\" as \"evaluator_name\", \"users\".\"email\" as \"evaluator_email\" from \"cbe_evaluations\" inner join \"rfqs\" on \"cbe_evaluations\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"cbe_evaluations\".\"evaluated_by\" = \"users\".\"id\"", + "name": "cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.rfqs_view": { + "columns": {}, + "definition": "select \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"rfqs\".\"parent_rfq_id\" as \"parent_rfq_id\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"email\" as \"user_email\", \"users\".\"name\" as \"user_name\", (\n SELECT COUNT(*) \n FROM \"rfq_items\" \n WHERE \"rfq_items\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"item_count\", (\n SELECT COUNT(*) \n FROM \"rfq_attachments\" \n WHERE \"rfq_attachments\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"attachment_count\" from \"rfqs\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"rfqs\".\"created_by\" = \"users\".\"id\"", + "name": "rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_cbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", \"cbe_evaluations\".\"notes\" as \"cbe_note\", \"cbe_evaluations\".\"updated_at\" as \"cbe_updated\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"delivery_schedule\" as \"delivery_schedule\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_response_cbe_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"notes\" as \"response_notes\", \"vendor_responses\".\"responded_by\" as \"responded_by\", \"vendor_responses\".\"responded_at\" as \"responded_at\", \"vendor_responses\".\"updated_at\" as \"response_updated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"status\" as \"vendor_status\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"response_status\" as \"commercial_response_status\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"vendor_commercial_responses\".\"payment_terms\" as \"payment_terms\", \"vendor_commercial_responses\".\"incoterms\" as \"incoterms\", \"vendor_commercial_responses\".\"delivery_period\" as \"delivery_period\", \"vendor_commercial_responses\".\"warranty_period\" as \"warranty_period\", \"vendor_commercial_responses\".\"validity_period\" as \"validity_period\", \"vendor_commercial_responses\".\"price_breakdown\" as \"price_breakdown\", \"vendor_commercial_responses\".\"commercial_notes\" as \"commercial_notes\", \"vendor_commercial_responses\".\"created_at\" as \"commercial_created_at\", \"vendor_commercial_responses\".\"updated_at\" as \"commercial_updated_at\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"commercial_response_id\" = \"vendor_commercial_responses\".\"id\"\n ) as \"commercial_attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n AND \"vendor_response_attachments\".\"attachment_type\" = 'TECHNICAL_SPEC'\n ) as \"technical_attachment_count\", (\n SELECT MAX(\"uploaded_at\") \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"latest_attachment_date\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\"", + "name": "vendor_response_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_responses_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"created_at\" as \"rfq_created_at\", \"rfqs\".\"updated_at\" as \"rfq_updated_at\", \"rfqs\".\"created_by\" as \"rfq_created_by\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"responded_at\" as \"responded_at\", CASE WHEN \"vendor_technical_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_technical_response\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", CASE WHEN \"vendor_commercial_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_commercial_response\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"rfq_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE') left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"cbe_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\")", + "name": "vendor_responses_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_rfq_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", + "name": "vendor_rfq_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_tbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", \"vendor_technical_responses\".\"response_status\" as \"technical_response_status\", \"vendor_technical_responses\".\"summary\" as \"technical_summary\", \"vendor_technical_responses\".\"notes\" as \"technical_notes\", \"vendor_technical_responses\".\"updated_at\" as \"technical_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"rfq_evaluations\".\"notes\" as \"tbe_note\", \"rfq_evaluations\".\"updated_at\" as \"tbe_updated\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_tbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.role_view": { + "columns": {}, + "definition": "select \"roles\".\"id\" as \"id\", \"roles\".\"name\" as \"name\", \"roles\".\"description\" as \"description\", \"roles\".\"domain\" as \"domain\", \"roles\".\"created_at\" as \"created_at\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", COUNT(\"users\".\"id\") as \"user_count\" from \"roles\" left join \"user_roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" left join \"users\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"vendors\" on \"roles\".\"company_id\" = \"vendors\".\"id\" group by \"roles\".\"id\", \"vendors\".\"id\"", + "name": "role_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.user_view": { + "columns": {}, + "definition": "select \"users\".\"id\" as \"user_id\", \"users\".\"name\" as \"user_name\", \"users\".\"email\" as \"user_email\", \"users\".\"domain\" as \"user_domain\", \"users\".\"image_url\" as \"user_image\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"vendors\" on \"users\".\"company_id\" = \"vendors\".\"id\" left join \"user_roles\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" group by \"users\".\"id\", \"vendors\".\"id\"", + "name": "user_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.form_lists_view": { + "columns": {}, + "definition": "select \"tag_type_class_form_mappings\".\"id\" as \"id\", \"tag_type_class_form_mappings\".\"project_id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"tag_type_class_form_mappings\".\"tag_type_label\" as \"tag_type_label\", \"tag_type_class_form_mappings\".\"class_label\" as \"class_label\", \"tag_type_class_form_mappings\".\"form_code\" as \"form_code\", \"tag_type_class_form_mappings\".\"form_name\" as \"form_name\", \"tag_type_class_form_mappings\".\"ep\" as \"ep\", \"tag_type_class_form_mappings\".\"remark\" as \"remark\", \"tag_type_class_form_mappings\".\"created_at\" as \"created_at\", \"tag_type_class_form_mappings\".\"updated_at\" as \"updated_at\" from \"tag_type_class_form_mappings\" inner join \"projects\" on \"tag_type_class_form_mappings\".\"project_id\" = \"projects\".\"id\"", + "name": "form_lists_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.view_tag_subfields": { + "columns": { + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "definition": "select \"tag_subfields\".\"id\" as \"id\", \"tag_subfields\".\"tag_type_code\", \"tag_types\".\"description\", \"tag_subfields\".\"attributes_id\", \"tag_subfields\".\"attributes_description\", \"tag_subfields\".\"expression\", \"tag_subfields\".\"delimiter\", \"tag_subfields\".\"sort_order\", \"tag_subfields\".\"created_at\", \"tag_subfields\".\"updated_at\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\", \"projects\".\"name\" from \"tag_subfields\" inner join \"tag_types\" on (\"tag_subfields\".\"tag_type_code\" = \"tag_types\".\"code\" and \"tag_subfields\".\"project_id\" = \"tag_types\".\"project_id\") inner join \"projects\" on \"tag_subfields\".\"project_id\" = \"projects\".\"id\"", + "name": "view_tag_subfields", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.document_stages_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_count": { + "name": "stage_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_list": { + "name": "stage_list", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT\n d.id AS document_id,\n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n d.contract_id,\n (SELECT COUNT(*) FROM issue_stages WHERE document_id = d.id) AS stage_count,\n COALESCE( \n (SELECT json_agg(i.stage_name) FROM issue_stages i WHERE i.document_id = d.id), \n '[]'\n ) AS stage_list,\n d.created_at,\n d.updated_at\n FROM documents d\n", + "name": "document_stages_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.enhanced_documents_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_id": { + "name": "current_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_name": { + "name": "current_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_status": { + "name": "current_stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_order": { + "name": "current_stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_plan_date": { + "name": "current_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_actual_date": { + "name": "current_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_assignee_name": { + "name": "current_stage_assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_priority": { + "name": "current_stage_priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "days_until_due": { + "name": "days_until_due", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_overdue": { + "name": "is_overdue", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "days_difference": { + "name": "days_difference", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "total_stages": { + "name": "total_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "completed_stages": { + "name": "completed_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "progress_percentage": { + "name": "progress_percentage", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_status": { + "name": "latest_revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_submitted_date": { + "name": "latest_submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "all_stages": { + "name": "all_stages", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n WITH document_stats AS (\n SELECT \n d.id as document_id,\n COUNT(ist.id) as total_stages,\n COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) as completed_stages,\n CASE \n WHEN COUNT(ist.id) > 0 \n THEN ROUND((COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) * 100.0) / COUNT(ist.id))\n ELSE 0 \n END as progress_percentage\n FROM documents d\n LEFT JOIN issue_stages ist ON d.id = ist.document_id\n GROUP BY d.id\n ),\n current_stage_info AS (\n SELECT DISTINCT ON (document_id)\n document_id,\n id as current_stage_id,\n stage_name as current_stage_name,\n stage_status as current_stage_status,\n stage_order as current_stage_order,\n plan_date as current_stage_plan_date,\n actual_date as current_stage_actual_date,\n assignee_name as current_stage_assignee_name,\n priority as current_stage_priority,\n CASE \n WHEN actual_date IS NULL AND plan_date IS NOT NULL \n THEN plan_date - CURRENT_DATE\n ELSE NULL \n END as days_until_due,\n CASE \n WHEN actual_date IS NULL AND plan_date < CURRENT_DATE \n THEN true\n WHEN actual_date IS NOT NULL AND actual_date > plan_date \n THEN true\n ELSE false \n END as is_overdue,\n CASE \n WHEN actual_date IS NOT NULL AND plan_date IS NOT NULL \n THEN actual_date - plan_date\n ELSE NULL \n END as days_difference\n FROM issue_stages\n WHERE stage_status NOT IN ('COMPLETED', 'APPROVED')\n ORDER BY document_id, stage_order ASC, priority DESC\n ),\n latest_revision_info AS (\n SELECT DISTINCT ON (ist.document_id)\n ist.document_id,\n r.id as latest_revision_id,\n r.revision as latest_revision,\n r.revision_status as latest_revision_status,\n r.uploader_name as latest_revision_uploader_name,\n r.submitted_date as latest_submitted_date\n FROM revisions r\n JOIN issue_stages ist ON r.issue_stage_id = ist.id\n ORDER BY ist.document_id, r.created_at DESC\n ),\n -- 리비전별 첨부파일 집계\n revision_attachments AS (\n SELECT \n r.id as revision_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', da.id,\n 'revisionId', da.revision_id,\n 'fileName', da.file_name,\n 'filePath', da.file_path,\n 'fileSize', da.file_size,\n 'fileType', da.file_type,\n 'createdAt', da.created_at,\n 'updatedAt', da.updated_at\n ) ORDER BY da.created_at\n ) FILTER (WHERE da.id IS NOT NULL),\n '[]'::json\n ) as attachments\n FROM revisions r\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY r.id\n ),\n -- 스테이지별 리비전 집계 (첨부파일 포함)\n stage_revisions AS (\n SELECT \n ist.id as stage_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', r.id,\n 'issueStageId', r.issue_stage_id,\n 'revision', r.revision,\n 'uploaderType', r.uploader_type,\n 'uploaderId', r.uploader_id,\n 'uploaderName', r.uploader_name,\n 'comment', r.comment,\n 'revisionStatus', r.revision_status,\n 'submittedDate', r.submitted_date,\n 'uploadedAt', r.uploaded_at,\n 'approvedDate', r.approved_date,\n 'reviewStartDate', r.review_start_date,\n 'rejectedDate', r.rejected_date,\n 'reviewerId', r.reviewer_id,\n 'reviewerName', r.reviewer_name,\n 'reviewComments', r.review_comments,\n 'createdAt', r.created_at,\n 'updatedAt', r.updated_at,\n 'attachments', ra.attachments\n ) ORDER BY r.created_at\n ) FILTER (WHERE r.id IS NOT NULL),\n '[]'::json\n ) as revisions\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN revision_attachments ra ON r.id = ra.revision_id\n GROUP BY ist.id\n ),\n -- 문서별 스테이지 집계 (리비전 포함)\n stage_aggregation AS (\n SELECT \n ist.document_id,\n json_agg(\n json_build_object(\n 'id', ist.id,\n 'stageName', ist.stage_name,\n 'stageStatus', ist.stage_status,\n 'stageOrder', ist.stage_order,\n 'planDate', ist.plan_date,\n 'actualDate', ist.actual_date,\n 'assigneeName', ist.assignee_name,\n 'priority', ist.priority,\n 'revisions', sr.revisions\n ) ORDER BY ist.stage_order\n ) as all_stages\n FROM issue_stages ist\n LEFT JOIN stage_revisions sr ON ist.id = sr.stage_id\n GROUP BY ist.document_id\n ),\n attachment_counts AS (\n SELECT \n ist.document_id,\n COUNT(da.id) as attachment_count\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY ist.document_id\n )\n \n SELECT \n d.id as document_id,\n d.doc_number,\n d.vendor_doc_number, -- ✅ 벤더 문서 번호 추가\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n -- ✅ 프로젝트 및 벤더 정보 추가\n p.code as project_code,\n v.vendor_name as vendor_name,\n v.vendor_code as vendor_code,\n \n -- 현재 스테이지 정보\n csi.current_stage_id,\n csi.current_stage_name,\n csi.current_stage_status,\n csi.current_stage_order,\n csi.current_stage_plan_date,\n csi.current_stage_actual_date,\n csi.current_stage_assignee_name,\n csi.current_stage_priority,\n \n -- 계산 필드\n csi.days_until_due,\n csi.is_overdue,\n csi.days_difference,\n \n -- 진행률 정보\n ds.total_stages,\n ds.completed_stages,\n ds.progress_percentage,\n \n -- 최신 리비전 정보\n lri.latest_revision_id,\n lri.latest_revision,\n lri.latest_revision_status,\n lri.latest_revision_uploader_name,\n lri.latest_submitted_date,\n \n -- 전체 스테이지 (리비전 및 첨부파일 포함)\n COALESCE(sa.all_stages, '[]'::json) as all_stages,\n \n -- 기타\n COALESCE(ac.attachment_count, 0) as attachment_count,\n d.created_at,\n d.updated_at\n \n FROM documents d\n -- ✅ contracts, projects, vendors 테이블 JOIN 추가\n LEFT JOIN contracts c ON d.contract_id = c.id\n LEFT JOIN projects p ON c.project_id = p.id\n LEFT JOIN vendors v ON c.vendor_id = v.id\n \n LEFT JOIN document_stats ds ON d.id = ds.document_id\n LEFT JOIN current_stage_info csi ON d.id = csi.document_id\n LEFT JOIN latest_revision_info lri ON d.id = lri.document_id\n LEFT JOIN stage_aggregation sa ON d.id = sa.document_id\n LEFT JOIN attachment_counts ac ON d.id = ac.document_id\n \n ORDER BY d.created_at DESC\n", + "name": "enhanced_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.sync_status_view": { + "columns": { + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "total_changes": { + "name": "total_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pending_changes": { + "name": "pending_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "synced_changes": { + "name": "synced_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "failed_changes": { + "name": "failed_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "last_sync_at": { + "name": "last_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_sync_at": { + "name": "next_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n WITH change_stats AS (\n SELECT \n cl.contract_id,\n sc.target_system,\n COUNT(*) as total_changes,\n COUNT(CASE WHEN cl.is_synced = false AND cl.sync_attempts < sc.retry_max_attempts THEN 1 END) as pending_changes,\n COUNT(CASE WHEN cl.is_synced = true THEN 1 END) as synced_changes,\n COUNT(CASE WHEN cl.sync_attempts >= sc.retry_max_attempts AND cl.is_synced = false THEN 1 END) as failed_changes,\n MAX(cl.synced_at) as last_sync_at\n FROM change_logs cl\n CROSS JOIN sync_configs sc \n WHERE cl.contract_id = sc.contract_id\n AND (cl.target_systems IS NULL OR cl.target_systems @> to_jsonb(sc.target_system))\n GROUP BY cl.contract_id, sc.target_system\n )\n SELECT \n cs.contract_id,\n cs.target_system,\n COALESCE(cs.total_changes, 0) as total_changes,\n COALESCE(cs.pending_changes, 0) as pending_changes,\n COALESCE(cs.synced_changes, 0) as synced_changes,\n COALESCE(cs.failed_changes, 0) as failed_changes,\n cs.last_sync_at,\n CASE \n WHEN sc.sync_enabled = true AND sc.last_successful_sync IS NOT NULL \n THEN sc.last_successful_sync + (sc.sync_interval_minutes || ' minutes')::interval\n ELSE NULL\n END as next_sync_at,\n sc.sync_enabled\n FROM sync_configs sc\n LEFT JOIN change_stats cs ON sc.contract_id = cs.contract_id AND sc.target_system = cs.target_system\n", + "name": "sync_status_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_documents_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "latest_stage_id": { + "name": "latest_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_stage_name": { + "name": "latest_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_stage_plan_date": { + "name": "latest_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_stage_actual_date": { + "name": "latest_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_type": { + "name": "latest_revision_uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT \n d.id, \n d.doc_number,\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n (SELECT id FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_id,\n (SELECT stage_name FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_name,\n (SELECT plan_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_plan_date,\n (SELECT actual_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_actual_date,\n \n (SELECT r.id FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_id,\n (SELECT r.revision FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision,\n (SELECT r.uploader_type FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_type,\n (SELECT r.uploader_name FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_name,\n \n (SELECT COUNT(*) FROM document_attachments a JOIN revisions r ON a.revision_id = r.id JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id) AS attachment_count,\n \n d.created_at,\n d.updated_at\n FROM documents d\n JOIN contracts c ON d.contract_id = c.id\n ", + "name": "vendor_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_candidates_with_vendor_info": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_candidates\".\"id\", \"vendor_candidates\".\"company_name\", \"vendor_candidates\".\"contact_email\", \"vendor_candidates\".\"contact_phone\", \"vendor_candidates\".\"tax_id\", \"vendor_candidates\".\"address\", \"vendor_candidates\".\"country\", \"vendor_candidates\".\"source\", \"vendor_candidates\".\"status\", \"vendor_candidates\".\"items\", \"vendor_candidates\".\"remark\", \"vendor_candidates\".\"created_at\", \"vendor_candidates\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"created_at\" as \"vendor_created_at\", (\n SELECT l2.\"created_at\"\n FROM \"vendor_candidate_logs\" l2\n WHERE l2.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l2.\"action\" = 'status_change'\n ORDER BY l2.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_at\", (\n SELECT u.\"name\"\n FROM \"users\" u\n JOIN \"vendor_candidate_logs\" l3\n ON l3.\"user_id\" = u.\"id\"\n WHERE l3.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l3.\"action\" = 'status_change'\n ORDER BY l3.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_by\", (\n SELECT l4.\"created_at\"\n FROM \"vendor_candidate_logs\" l4\n WHERE l4.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l4.\"action\" = 'invite_sent'\n ORDER BY l4.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_at\", (\n SELECT u2.\"name\"\n FROM \"users\" u2\n JOIN \"vendor_candidate_logs\" l5\n ON l5.\"user_id\" = u2.\"id\"\n WHERE l5.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l5.\"action\" = 'invite_sent'\n ORDER BY l5.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_by\" from \"vendor_candidates\" left join \"vendors\" on \"vendor_candidates\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "vendor_candidates_with_vendor_info", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"business_size\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"", + "name": "vendor_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", + "name": "vendor_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_materials_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_materials\".\"id\", \"vendor_possible_materials\".\"vendor_id\", \"materials\".\"item_name\", \"materials\".\"item_code\", \"materials\".\"description\", \"materials\".\"unit_of_measure\", \"materials\".\"steel_type\", \"materials\".\"grade_material\", \"vendor_possible_materials\".\"created_at\", \"vendor_possible_materials\".\"updated_at\" from \"vendor_possible_materials\" left join \"materials\" on \"vendor_possible_materials\".\"item_code\" = \"materials\".\"item_code\"", + "name": "vendor_materials_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendors_with_types": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"tax_id\" as \"tax_id\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"phone\" as \"phone\", \"vendors\".\"email\" as \"email\", \"vendors\".\"business_size\" as \"business_size\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"status\", \"vendors\".\"vendor_type_id\" as \"vendor_type_id\", \"vendors\".\"representative_name\" as \"representative_name\", \"vendors\".\"representative_birth\" as \"representative_birth\", \"vendors\".\"representative_email\" as \"representative_email\", \"vendors\".\"representative_phone\" as \"representative_phone\", \"vendors\".\"corporate_registration_number\" as \"corporate_registration_number\", \"vendors\".\"items\" as \"items\", \"vendors\".\"credit_agency\" as \"credit_agency\", \"vendors\".\"credit_rating\" as \"credit_rating\", \"vendors\".\"cash_flow_rating\" as \"cash_flow_rating\", \"vendors\".\"created_at\" as \"created_at\", \"vendors\".\"updated_at\" as \"updated_at\", \"vendor_types\".\"name_ko\" as \"vendor_type_name\", \"vendor_types\".\"name_en\" as \"vendor_type_name_en\", \"vendor_types\".\"code\" as \"vendor_type_code\", \n CASE\n WHEN \"vendors\".\"status\" = 'ACTIVE' THEN '정규업체'\n WHEN \"vendors\".\"status\" IN ('INACTIVE', 'BLACKLISTED', 'REJECTED') THEN ''\n ELSE '잠재업체'\n END\n as \"vendor_category\" from \"vendors\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\"", + "name": "vendors_with_types", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.basic_contract_view": { + "columns": {}, + "definition": "select \"basic_contract\".\"id\" as \"id\", \"basic_contract\".\"template_id\" as \"template_id\", \"basic_contract\".\"vendor_id\" as \"vendor_id\", \"basic_contract\".\"requested_by\" as \"requested_by\", \"basic_contract\".\"status\" as \"basic_contract_status\", \"basic_contract\".\"created_at\" as \"created_at\", \"basic_contract\".\"updated_at\" as \"updated_at\", \"basic_contract\".\"updated_at\" as \"completed_at\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"email\" as \"vendor_email\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"users\".\"name\" as \"user_name\", \"basic_contract_templates\".\"template_name\" as \"template_name\", \"basic_contract_templates\".\"validity_period\" as \"validityPeriod\", \"basic_contract_templates\".\"file_path\" as \"file_path\", \"basic_contract_templates\".\"file_name\" as \"file_name\", \"basic_contract\".\"file_path\" as \"signed_file_path\" from \"basic_contract\" left join \"vendors\" on \"basic_contract\".\"vendor_id\" = \"vendors\".\"id\" left join \"users\" on \"basic_contract\".\"requested_by\" = \"users\".\"id\" left join \"basic_contract_templates\" on \"basic_contract\".\"template_id\" = \"basic_contract_templates\".\"id\"", + "name": "basic_contract_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.pr_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"pr_items\".\"id\", \"pr_items\".\"procurement_rfqs_id\", \"pr_items\".\"rfq_item\", \"pr_items\".\"pr_item\", \"pr_items\".\"pr_no\", \"pr_items\".\"material_code\", \"pr_items\".\"material_category\", \"pr_items\".\"acc\", \"pr_items\".\"material_description\", \"pr_items\".\"size\", \"pr_items\".\"delivery_date\", \"pr_items\".\"quantity\", \"pr_items\".\"uom\", \"pr_items\".\"gross_weight\", \"pr_items\".\"gw_uom\", \"pr_items\".\"spec_no\", \"pr_items\".\"spec_url\", \"pr_items\".\"tracking_no\", \"pr_items\".\"major_yn\", \"pr_items\".\"project_def\", \"pr_items\".\"project_sc\", \"pr_items\".\"project_kl\", \"pr_items\".\"project_lc\", \"pr_items\".\"project_dl\", \"pr_items\".\"remark\", \"procurement_rfqs\".\"rfq_code\", \"procurement_rfqs\".\"item_code\", \"procurement_rfqs\".\"item_name\" from \"pr_items\" left join \"procurement_rfqs\" on \"pr_items\".\"procurement_rfqs_id\" = \"procurement_rfqs\".\"id\"", + "name": "pr_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfq_details_view": { + "columns": {}, + "definition": "select \"rfq_details\".\"id\" as \"detail_id\", \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfqs\".\"item_code\" as \"item_code\", \"rfqs\".\"item_name\" as \"item_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"country\" as \"vendor_country\", \"rfq_details\".\"currency\" as \"currency\", \"payment_terms\".\"code\" as \"payment_terms_code\", \"payment_terms\".\"description\" as \"payment_terms_description\", \"incoterms\".\"code\" as \"incoterms_code\", \"incoterms\".\"description\" as \"incoterms_description\", \"rfq_details\".\"incoterms_detail\" as \"incoterms_detail\", \"rfq_details\".\"delivery_date\" as \"delivery_date\", \"rfq_details\".\"tax_code\" as \"tax_code\", \"rfq_details\".\"place_of_shipping\" as \"place_of_shipping\", \"rfq_details\".\"place_of_destination\" as \"place_of_destination\", \"rfq_details\".\"material_price_related_yn\" as \"material_price_related_yn\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"rfq_details\".\"updated_at\" as \"updated_at\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\"\n ) as \"pr_items_count\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\" \n AND major_yn = true\n ) as \"major_items_count\", (\n SELECT COUNT(*) \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"comment_count\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_comment_date\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\" AND is_vendor_comment = true\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_vendor_comment_date\", (\n SELECT COUNT(*) \n FROM procurement_rfq_attachments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) > 0\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"has_quotation\", (\n SELECT status\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_status\", (\n SELECT total_price\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_total_price\", (\n SELECT quotation_version\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"quotation_version\", (\n SELECT COUNT(DISTINCT quotation_version)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"quotation_version_count\", (\n SELECT created_at\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"last_quotation_date\" from \"procurement_rfq_details\" \"rfq_details\" left join \"procurement_rfqs\" \"rfqs\" on \"rfq_details\".\"procurement_rfqs_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"rfq_details\".\"vendors_id\" = \"vendors\".\"id\" left join \"payment_terms\" on \"rfq_details\".\"payment_terms_code\" = \"payment_terms\".\"code\" left join \"incoterms\" on \"rfq_details\".\"incoterms_code\" = \"incoterms\".\"code\" left join \"users\" \"updated_by_user\" on \"rfq_details\".\"updated_by\" = \"updated_by_user\".\"id\"", + "name": "procurement_rfq_details_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfqs_view": { + "columns": {}, + "definition": "select \"procurement_rfqs\".\"id\" as \"id\", \"procurement_rfqs\".\"rfq_code\" as \"rfq_code\", \"procurement_rfqs\".\"series\" as \"series\", \"procurement_rfqs\".\"rfq_sealed_yn\" as \"rfq_sealed_yn\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"procurement_rfqs\".\"item_code\" as \"item_code\", \"procurement_rfqs\".\"item_name\" as \"item_name\", \"procurement_rfqs\".\"status\" as \"status\", \"procurement_rfqs\".\"pic_code\" as \"pic_code\", \"procurement_rfqs\".\"rfq_send_date\" as \"rfq_send_date\", \"procurement_rfqs\".\"due_date\" as \"due_date\", (\n SELECT MIN(submitted_at)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"procurement_rfqs\".\"id\"\n AND submitted_at IS NOT NULL\n ) as \"earliest_quotation_submitted_at\", \"created_by_user\".\"name\" as \"created_by_user_name\", \"sent_by_user\".\"name\" as \"sent_by_user_name\", \"procurement_rfqs\".\"updated_at\" as \"updated_at\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"procurement_rfqs\".\"remark\" as \"remark\", (\n SELECT material_code \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"major_item_material_code\", (\n SELECT pr_no \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"po_no\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n ) as \"pr_items_count\" from \"procurement_rfqs\" left join \"projects\" on \"procurement_rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" \"created_by_user\" on \"procurement_rfqs\".\"created_by\" = \"created_by_user\".\"id\" left join \"users\" \"updated_by_user\" on \"procurement_rfqs\".\"updated_by\" = \"updated_by_user\".\"id\" left join \"users\" \"sent_by_user\" on \"procurement_rfqs\".\"sent_by\" = \"sent_by_user\".\"id\"", + "name": "procurement_rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + } + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db/migrations/meta/0115_snapshot.json b/db/migrations/meta/0115_snapshot.json new file mode 100644 index 00000000..61e17c94 --- /dev/null +++ b/db/migrations/meta/0115_snapshot.json @@ -0,0 +1,12010 @@ +{ + "id": "fbe1061d-290d-4476-b43a-1927e17a8c51", + "prevId": "75dd3e4f-96c9-43fb-a234-df05c1b14fdc", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.companies": { + "name": "companies", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "companies_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "taxID": { + "name": "taxID", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_envelopes": { + "name": "contract_envelopes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_envelopes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "envelope_id": { + "name": "envelope_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": true + }, + "document_id": { + "name": "document_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": false + }, + "envelope_status": { + "name": "envelope_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_envelopes_contract_id_contracts_id_fk": { + "name": "contract_envelopes_contract_id_contracts_id_fk", + "tableFrom": "contract_envelopes", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_items": { + "name": "contract_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_items_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_id": { + "name": "item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "unit_price": { + "name": "unit_price", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "total_line_amount": { + "name": "total_line_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_items_contract_item_idx": { + "name": "contract_items_contract_item_idx", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "contract_items_contract_id_contracts_id_fk": { + "name": "contract_items_contract_id_contracts_id_fk", + "tableFrom": "contract_items", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_items_item_id_items_id_fk": { + "name": "contract_items_item_id_items_id_fk", + "tableFrom": "contract_items", + "tableTo": "items", + "columnsFrom": [ + "item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_items_contract_id_item_id_unique": { + "name": "contract_items_contract_id_item_id_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_id", + "item_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_signers": { + "name": "contract_signers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_signers_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "envelope_id": { + "name": "envelope_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_contact_id": { + "name": "vendor_contact_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "signer_type": { + "name": "signer_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'VENDOR'" + }, + "signer_email": { + "name": "signer_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "signer_name": { + "name": "signer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "signer_position": { + "name": "signer_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "signer_status": { + "name": "signer_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "signed_at": { + "name": "signed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_signers_envelope_id_contract_envelopes_id_fk": { + "name": "contract_signers_envelope_id_contract_envelopes_id_fk", + "tableFrom": "contract_signers", + "tableTo": "contract_envelopes", + "columnsFrom": [ + "envelope_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_signers_vendor_contact_id_vendor_contacts_id_fk": { + "name": "contract_signers_vendor_contact_id_vendor_contacts_id_fk", + "tableFrom": "contract_signers", + "tableTo": "vendor_contacts", + "columnsFrom": [ + "vendor_contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contracts": { + "name": "contracts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contracts_project_id_projects_id_fk": { + "name": "contracts_project_id_projects_id_fk", + "tableFrom": "contracts", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contracts_vendor_id_vendors_id_fk": { + "name": "contracts_vendor_id_vendors_id_fk", + "tableFrom": "contracts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contracts_contract_no_unique": { + "name": "contracts_contract_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.poa": { + "name": "poa", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "original_contract_no": { + "name": "original_contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "original_contract_name": { + "name": "original_contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_status": { + "name": "original_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "poa_original_contract_no_contracts_contract_no_fk": { + "name": "poa_original_contract_no_contracts_contract_no_fk", + "tableFrom": "poa", + "tableTo": "contracts", + "columnsFrom": [ + "original_contract_no" + ], + "columnsTo": [ + "contract_no" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_project_id_projects_id_fk": { + "name": "poa_project_id_projects_id_fk", + "tableFrom": "poa", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_vendor_id_vendors_id_fk": { + "name": "poa_vendor_id_vendors_id_fk", + "tableFrom": "poa", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_hull": { + "name": "item_offshore_hull", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_hull_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_hull_item_code_items_item_code_fk": { + "name": "item_offshore_hull_item_code_items_item_code_fk", + "tableFrom": "item_offshore_hull", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_top": { + "name": "item_offshore_top", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_top_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_top_item_code_items_item_code_fk": { + "name": "item_offshore_top_item_code_items_item_code_fk", + "tableFrom": "item_offshore_top", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_shipbuilding": { + "name": "item_shipbuilding", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ship_types": { + "name": "ship_types", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'OPTION'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_shipbuilding_item_code_items_item_code_fk": { + "name": "item_shipbuilding_item_code_items_item_code_fk", + "tableFrom": "item_shipbuilding", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.items": { + "name": "items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_no": { + "name": "project_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "package_code": { + "name": "package_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "sm_code": { + "name": "sm_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "items_item_code_unique": { + "name": "items_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.materials": { + "name": "materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "materials_item_code_unique": { + "name": "materials_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias": { + "name": "pq_criterias", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "check_point": { + "name": "check_point", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "group_name": { + "name": "group_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias_extension": { + "name": "pq_criterias_extension", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_criteria_id": { + "name": "pq_criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_info": { + "name": "contract_info", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "additional_requirement": { + "name": "additional_requirement", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk": { + "name": "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "pq_criterias", + "columnsFrom": [ + "pq_criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "pq_criterias_extension_project_id_projects_id_fk": { + "name": "pq_criterias_extension_project_id_projects_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_criteria_attachments": { + "name": "vendor_criteria_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_criteria_answer_id": { + "name": "vendor_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_criteria_attachments", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigation_attachments": { + "name": "vendor_investigation_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "investigation_id": { + "name": "investigation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'REPORT'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { + "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", + "tableFrom": "vendor_investigation_attachments", + "tableTo": "vendor_investigations", + "columnsFrom": [ + "investigation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigations": { + "name": "vendor_investigations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigations_vendor_id_vendors_id_fk": { + "name": "vendor_investigations_vendor_id_vendors_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk": { + "name": "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendor_pq_submissions", + "columnsFrom": [ + "pq_submission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "vendor_investigations_requester_id_users_id_fk": { + "name": "vendor_investigations_requester_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_qm_manager_id_users_id_fk": { + "name": "vendor_investigations_qm_manager_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "qm_manager_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_submissions": { + "name": "vendor_pq_submissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_number": { + "name": "pq_number", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_pq_submission": { + "name": "unique_pq_submission", + "columns": [ + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_pq_submissions_requester_id_users_id_fk": { + "name": "vendor_pq_submissions_requester_id_users_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_pq_submissions_vendor_id_vendors_id_fk": { + "name": "vendor_pq_submissions_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_submissions_project_id_projects_id_fk": { + "name": "vendor_pq_submissions_project_id_projects_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_pq_submissions_pq_number_unique": { + "name": "vendor_pq_submissions_pq_number_unique", + "nullsNotDistinct": false, + "columns": [ + "pq_number" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_criteria_answers": { + "name": "vendor_pq_criteria_answers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "criteria_id": { + "name": "criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "answer": { + "name": "answer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_criteria_answers_vendor_id_vendors_id_fk": { + "name": "vendor_pq_criteria_answers_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": { + "name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "pq_criterias", + "columnsFrom": [ + "criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_project_id_projects_id_fk": { + "name": "vendor_pq_criteria_answers_project_id_projects_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_review_logs": { + "name": "vendor_pq_review_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_pq_criteria_answer_id": { + "name": "vendor_pq_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "reviewer_comment": { + "name": "reviewer_comment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_pq_review_logs", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_pq_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_project_pqs": { + "name": "vendor_project_pqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_project_pqs_vendor_id_vendors_id_fk": { + "name": "vendor_project_pqs_vendor_id_vendors_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_project_pqs_project_id_projects_id_fk": { + "name": "vendor_project_pqs_project_id_projects_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bidding_projects": { + "name": "bidding_projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "proj_nm": { + "name": "proj_nm", + "type": "varchar(90)", + "primaryKey": false, + "notNull": false + }, + "sector": { + "name": "sector", + "type": "char(1)", + "primaryKey": false, + "notNull": false + }, + "proj_msrm": { + "name": "proj_msrm", + "type": "numeric(3, 0)", + "primaryKey": false, + "notNull": false + }, + "kunnr": { + "name": "kunnr", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "kunnr_nm": { + "name": "kunnr_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "cls_1": { + "name": "cls_1", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "cls1_nm": { + "name": "cls1_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "ptype": { + "name": "ptype", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "ptype_nm": { + "name": "ptype_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_cd": { + "name": "pmodel_cd", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "pmodel_nm": { + "name": "pmodel_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_sz": { + "name": "pmodel_sz", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "pmodel_uom": { + "name": "pmodel_uom", + "type": "char(5)", + "primaryKey": false, + "notNull": false + }, + "txt04": { + "name": "txt04", + "type": "char(4)", + "primaryKey": false, + "notNull": false + }, + "txt30": { + "name": "txt30", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "estm_pm": { + "name": "estm_pm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "bidding_projects_pspid_unique": { + "name": "bidding_projects_pspid_unique", + "nullsNotDistinct": false, + "columns": [ + "pspid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_series": { + "name": "project_series", + "schema": "", + "columns": { + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "sers_no": { + "name": "sers_no", + "type": "char(3)", + "primaryKey": false, + "notNull": true + }, + "sc_dt": { + "name": "sc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "kl_dt": { + "name": "kl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "lc_dt": { + "name": "lc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dl_dt": { + "name": "dl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dock_no": { + "name": "dock_no", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "dock_nm": { + "name": "dock_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "proj_no": { + "name": "proj_no", + "type": "char(24)", + "primaryKey": false, + "notNull": false + }, + "post1": { + "name": "post1", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "project_sersNo_unique": { + "name": "project_sersNo_unique", + "columns": [ + { + "expression": "pspid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sers_no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "project_series_pspid_bidding_projects_pspid_fk": { + "name": "project_series_pspid_bidding_projects_pspid_fk", + "tableFrom": "project_series", + "tableTo": "bidding_projects", + "columnsFrom": [ + "pspid" + ], + "columnsTo": [ + "pspid" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projects": { + "name": "projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cbe_evaluations": { + "name": "cbe_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluated_by": { + "name": "evaluated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluated_at": { + "name": "evaluated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "result": { + "name": "result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "total_cost": { + "name": "total_cost", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_schedule": { + "name": "delivery_schedule", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "cbe_evaluations_rfq_id_rfqs_id_fk": { + "name": "cbe_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_vendor_id_vendors_id_fk": { + "name": "cbe_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_evaluated_by_users_id_fk": { + "name": "cbe_evaluations_evaluated_by_users_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "users", + "columnsFrom": [ + "evaluated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_attachments": { + "name": "rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_attachments_rfq_id_rfqs_id_fk": { + "name": "rfq_attachments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_vendor_id_vendors_id_fk": { + "name": "rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_attachments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_cbe_id_cbe_evaluations_id_fk": { + "name": "rfq_attachments_cbe_id_cbe_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "cbe_evaluations", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_comment_id_rfq_comments_id_fk": { + "name": "rfq_attachments_comment_id_rfq_comments_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_comments": { + "name": "rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "comment_text": { + "name": "comment_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "commented_by": { + "name": "commented_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_comments_rfq_id_rfqs_id_fk": { + "name": "rfq_comments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_vendor_id_vendors_id_fk": { + "name": "rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_commented_by_users_id_fk": { + "name": "rfq_comments_commented_by_users_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "commented_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_comments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_cbe_id_vendor_responses_id_fk": { + "name": "rfq_comments_cbe_id_vendor_responses_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_evaluations": { + "name": "rfq_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "eval_type": { + "name": "eval_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "result": { + "name": "result", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_evaluations_rfq_id_rfqs_id_fk": { + "name": "rfq_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_evaluations_vendor_id_vendors_id_fk": { + "name": "rfq_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_items": { + "name": "rfq_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_items_rfq_id_rfqs_id_fk": { + "name": "rfq_items_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_items", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "rfq_items_item_code_items_item_code_fk": { + "name": "rfq_items_item_code_items_item_code_fk", + "tableFrom": "rfq_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfqs": { + "name": "rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "bid_project_id": { + "name": "bid_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false, + "default": "'PURCHASE'" + }, + "parent_rfq_id": { + "name": "parent_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfqs_project_id_projects_id_fk": { + "name": "rfqs_project_id_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_bid_project_id_bidding_projects_id_fk": { + "name": "rfqs_bid_project_id_bidding_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bid_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_created_by_users_id_fk": { + "name": "rfqs_created_by_users_id_fk", + "tableFrom": "rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_parent_rfq_id_rfqs_id_fk": { + "name": "rfqs_parent_rfq_id_rfqs_id_fk", + "tableFrom": "rfqs", + "tableTo": "rfqs", + "columnsFrom": [ + "parent_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "rfqs_rfq_code_unique": { + "name": "rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_commercial_responses": { + "name": "vendor_commercial_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "total_price": { + "name": "total_price", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_period": { + "name": "delivery_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "warranty_period": { + "name": "warranty_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "validity_period": { + "name": "validity_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "price_breakdown": { + "name": "price_breakdown", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "commercial_notes": { + "name": "commercial_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_commercial_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_commercial_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_commercial_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_attachments": { + "name": "vendor_response_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "technical_response_id": { + "name": "technical_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "commercial_response_id": { + "name": "commercial_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_attachments_response_id_vendor_responses_id_fk": { + "name": "vendor_response_attachments_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk": { + "name": "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_technical_responses", + "columnsFrom": [ + "technical_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk": { + "name": "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_commercial_responses", + "columnsFrom": [ + "commercial_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_responses": { + "name": "vendor_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'REVIEWING'" + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "responded_by": { + "name": "responded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "responded_at": { + "name": "responded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "vendor_response_unique": { + "name": "vendor_response_unique", + "columns": [ + { + "expression": "rfq_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_responses_rfq_id_rfqs_id_fk": { + "name": "vendor_responses_rfq_id_rfqs_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_responses_vendor_id_vendors_id_fk": { + "name": "vendor_responses_vendor_id_vendors_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_technical_responses": { + "name": "vendor_technical_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_technical_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_technical_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_technical_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.otps": { + "name": "otps", + "schema": "", + "columns": { + "email": { + "name": "email", + "type": "varchar(256)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(6)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "otpToken": { + "name": "otpToken", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "otp_expires": { + "name": "otp_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permissions": { + "name": "permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "permissions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "permission_key": { + "name": "permission_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.role_permissions": { + "name": "role_permissions", + "schema": "", + "columns": { + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "permission_id": { + "name": "permission_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "role_permissions_role_id_roles_id_fk": { + "name": "role_permissions_role_id_roles_id_fk", + "tableFrom": "role_permissions", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "role_permissions_permission_id_permissions_id_fk": { + "name": "role_permissions_permission_id_permissions_id_fk", + "tableFrom": "role_permissions", + "tableTo": "permissions", + "columnsFrom": [ + "permission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.roles": { + "name": "roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "roles_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "roles_company_id_vendors_id_fk": { + "name": "roles_company_id_vendors_id_fk", + "tableFrom": "roles", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_roles": { + "name": "user_roles", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_roles_user_id_users_id_fk": { + "name": "user_roles_user_id_users_id_fk", + "tableFrom": "user_roles", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_roles_role_id_roles_id_fk": { + "name": "user_roles_role_id_roles_id_fk", + "tableFrom": "user_roles", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "users_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'partners'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "image_url": { + "name": "image_url", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "language": { + "name": "language", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'en'" + } + }, + "indexes": {}, + "foreignKeys": { + "users_company_id_vendors_id_fk": { + "name": "users_company_id_vendors_id_fk", + "tableFrom": "users", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_entries": { + "name": "form_entries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_entries_contract_item_id_contract_items_id_fk": { + "name": "form_entries_contract_item_id_contract_items_id_fk", + "tableFrom": "form_entries", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_metas": { + "name": "form_metas", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "columns": { + "name": "columns", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_metas_project_id_projects_id_fk": { + "name": "form_metas_project_id_projects_id_fk", + "tableFrom": "form_metas", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "form_code_project_unique": { + "name": "form_code_project_unique", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.forms": { + "name": "forms", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "forms_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "eng": { + "name": "eng", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "im": { + "name": "im", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_item_form_code_unique": { + "name": "contract_item_form_code_unique", + "columns": [ + { + "expression": "contract_item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "form_code", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "forms_contract_item_id_contract_items_id_fk": { + "name": "forms_contract_item_id_contract_items_id_fk", + "tableFrom": "forms", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_class_attributes": { + "name": "tag_class_attributes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_class_attributes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "tag_class_id": { + "name": "tag_class_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "att_id": { + "name": "att_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "def_val": { + "name": "def_val", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uom_id": { + "name": "uom_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "seq": { + "name": "seq", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "tag_class_attributes_seq_idx": { + "name": "tag_class_attributes_seq_idx", + "columns": [ + { + "expression": "seq", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "tag_class_attributes_tag_class_id_tag_classes_id_fk": { + "name": "tag_class_attributes_tag_class_id_tag_classes_id_fk", + "tableFrom": "tag_class_attributes", + "tableTo": "tag_classes", + "columnsFrom": [ + "tag_class_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_att_id_in_tag_class": { + "name": "uniq_att_id_in_tag_class", + "nullsNotDistinct": false, + "columns": [ + "tag_class_id", + "att_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_classes": { + "name": "tag_classes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_classes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_classes_project_id_projects_id_fk": { + "name": "tag_classes_project_id_projects_id_fk", + "tableFrom": "tag_classes", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk": { + "name": "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk", + "tableFrom": "tag_classes", + "tableTo": "tag_types", + "columnsFrom": [ + "tag_type_code", + "project_id" + ], + "columnsTo": [ + "code", + "project_id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_code_in_project": { + "name": "uniq_code_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfield_options": { + "name": "tag_subfield_options", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfield_options_project_id_projects_id_fk": { + "name": "tag_subfield_options_project_id_projects_id_fk", + "tableFrom": "tag_subfield_options", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_attribute_project_code": { + "name": "uniq_attribute_project_code", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "attributes_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfields": { + "name": "tag_subfields", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfields_project_id_projects_id_fk": { + "name": "tag_subfields_project_id_projects_id_fk", + "tableFrom": "tag_subfields", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_tag_type_attribute": { + "name": "uniq_tag_type_attribute", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_code", + "attributes_id" + ] + }, + "uniq_attribute_id_project": { + "name": "uniq_attribute_id_project", + "nullsNotDistinct": false, + "columns": [ + "attributes_id", + "project_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_type_class_form_mappings": { + "name": "tag_type_class_form_mappings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_label": { + "name": "tag_type_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "class_label": { + "name": "class_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "ep": { + "name": "ep", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_mapping_in_project": { + "name": "uniq_mapping_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_label", + "class_label", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_types": { + "name": "tag_types", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_types_project_id_projects_id_fk": { + "name": "tag_types_project_id_projects_id_fk", + "tableFrom": "tag_types", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "tag_types_code_project_id_pk": { + "name": "tag_types_code_project_id_pk", + "columns": [ + "code", + "project_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tags": { + "name": "tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tags_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "tag_type": { + "name": "tag_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "class": { + "name": "class", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tags_contract_item_id_contract_items_id_fk": { + "name": "tags_contract_item_id_contract_items_id_fk", + "tableFrom": "tags", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_form_id_forms_id_fk": { + "name": "tags_form_id_forms_id_fk", + "tableFrom": "tags", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_item_tag_no_unique": { + "name": "contract_item_tag_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_item_id", + "tag_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_data_report_temps": { + "name": "vendor_data_report_temps", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_data_report_temps_contract_item_id_contract_items_id_fk": { + "name": "vendor_data_report_temps_contract_item_id_contract_items_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_data_report_temps_form_id_forms_id_fk": { + "name": "vendor_data_report_temps_form_id_forms_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.change_logs": { + "name": "change_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "changed_fields": { + "name": "changed_fields", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "old_values": { + "name": "old_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "new_values": { + "name": "new_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_name": { + "name": "user_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_synced": { + "name": "is_synced", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "sync_attempts": { + "name": "sync_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_sync_error": { + "name": "last_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "synced_at": { + "name": "synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "target_systems": { + "name": "target_systems", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + } + }, + "indexes": { + "idx_change_logs_contract_synced": { + "name": "idx_change_logs_contract_synced", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_synced", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_created_at": { + "name": "idx_change_logs_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_entity": { + "name": "idx_change_logs_entity", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_sync_attempts": { + "name": "idx_change_logs_sync_attempts", + "columns": [ + { + "expression": "sync_attempts", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.document_attachments": { + "name": "document_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "document_attachments_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "revision_id": { + "name": "revision_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "document_attachments_revision_id_revisions_id_fk": { + "name": "document_attachments_revision_id_revisions_id_fk", + "tableFrom": "document_attachments", + "tableTo": "revisions", + "columnsFrom": [ + "revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.documents": { + "name": "documents", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "documents_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "drawing_move_gbn": { + "name": "drawing_move_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "discipline": { + "name": "discipline", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "external_document_id": { + "name": "external_document_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "external_system_type": { + "name": "external_system_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "external_synced_at": { + "name": "external_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "shi_drawing_no": { + "name": "shi_drawing_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager": { + "name": "manager", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_enm": { + "name": "manager_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_no": { + "name": "manager_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "register_group": { + "name": "register_group", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "register_group_id": { + "name": "register_group_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "create_user_no": { + "name": "create_user_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "create_user_id": { + "name": "create_user_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "create_user_enm": { + "name": "create_user_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_contract_doc_status": { + "name": "unique_contract_doc_status", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_contract_vendor_doc": { + "name": "unique_contract_vendor_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"vendor_doc_number\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_external_doc": { + "name": "unique_external_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_system_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"external_document_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "drawing_kind_idx": { + "name": "drawing_kind_idx", + "columns": [ + { + "expression": "drawing_kind", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "documents_contract_id_contracts_id_fk": { + "name": "documents_contract_id_contracts_id_fk", + "tableFrom": "documents", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.issue_stages": { + "name": "issue_stages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "issue_stages_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_name": { + "name": "stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "plan_date": { + "name": "plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "actual_date": { + "name": "actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "stage_status": { + "name": "stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "stage_order": { + "name": "stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "priority": { + "name": "priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'MEDIUM'" + }, + "assignee_id": { + "name": "assignee_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "assignee_name": { + "name": "assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "reminder_days": { + "name": "reminder_days", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_document_stage": { + "name": "unique_document_stage", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_stage_order": { + "name": "document_stage_order", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "issue_stages_document_id_documents_id_fk": { + "name": "issue_stages_document_id_documents_id_fk", + "tableFrom": "issue_stages", + "tableTo": "documents", + "columnsFrom": [ + "document_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.revisions": { + "name": "revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "revisions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "issue_stage_id": { + "name": "issue_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "revision": { + "name": "revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "uploader_type": { + "name": "uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'vendor'" + }, + "uploader_id": { + "name": "uploader_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploader_name": { + "name": "uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "usage": { + "name": "usage", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "revision_status": { + "name": "revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'SUBMITTED'" + }, + "submitted_date": { + "name": "submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "review_start_date": { + "name": "review_start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "approved_date": { + "name": "approved_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "rejected_date": { + "name": "rejected_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "reviewer_id": { + "name": "reviewer_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "review_comments": { + "name": "review_comments", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "external_upload_id": { + "name": "external_upload_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_stage_rev": { + "name": "unique_stage_rev", + "columns": [ + { + "expression": "issue_stage_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "revision", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_batches": { + "name": "sync_batches", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "batch_size": { + "name": "batch_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "retry_count": { + "name": "retry_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "change_log_ids": { + "name": "change_log_ids", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "success_count": { + "name": "success_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "failure_count": { + "name": "failure_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sync_metadata": { + "name": "sync_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_batches_contract_system": { + "name": "idx_sync_batches_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_status": { + "name": "idx_sync_batches_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_created_at": { + "name": "idx_sync_batches_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_configs": { + "name": "sync_configs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "sync_interval_minutes": { + "name": "sync_interval_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 30 + }, + "last_successful_sync": { + "name": "last_successful_sync", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_sync_attempt": { + "name": "last_sync_attempt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "endpoint_url": { + "name": "endpoint_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "auth_token": { + "name": "auth_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "api_version": { + "name": "api_version", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'v1'" + }, + "max_batch_size": { + "name": "max_batch_size", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 100 + }, + "retry_max_attempts": { + "name": "retry_max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_configs_contract_system": { + "name": "idx_sync_configs_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sync_configs_contract_id_contracts_id_fk": { + "name": "sync_configs_contract_id_contracts_id_fk", + "tableFrom": "sync_configs", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_attachments": { + "name": "vendor_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'GENERAL'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_attachments_vendor_id_vendors_id_fk": { + "name": "vendor_attachments_vendor_id_vendors_id_fk", + "tableFrom": "vendor_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidates": { + "name": "vendor_candidates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidates_vendor_id_vendors_id_fk": { + "name": "vendor_candidates_vendor_id_vendors_id_fk", + "tableFrom": "vendor_candidates", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_contacts": { + "name": "vendor_contacts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contact_name": { + "name": "contact_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_position": { + "name": "contact_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "is_primary": { + "name": "is_primary", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_contacts_vendor_id_vendors_id_fk": { + "name": "vendor_contacts_vendor_id_vendors_id_fk", + "tableFrom": "vendor_contacts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_items": { + "name": "vendor_possible_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_items_vendor_id_vendors_id_fk": { + "name": "vendor_possible_items_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_items_item_code_items_item_code_fk": { + "name": "vendor_possible_items_item_code_items_item_code_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_materials": { + "name": "vendor_possible_materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_materials_vendor_id_vendors_id_fk": { + "name": "vendor_possible_materials_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_materials_item_code_materials_item_code_fk": { + "name": "vendor_possible_materials_item_code_materials_item_code_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "materials", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_types": { + "name": "vendor_types", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_types_code_unique": { + "name": "vendor_types_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors": { + "name": "vendors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "vendor_type_id": { + "name": "vendor_type_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_vendor_type_id_vendor_types_id_fk": { + "name": "vendors_vendor_type_id_vendor_types_id_fk", + "tableFrom": "vendors", + "tableTo": "vendor_types", + "columnsFrom": [ + "vendor_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tasks": { + "name": "tasks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'todo'" + }, + "label": { + "name": "label", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'bug'" + }, + "priority": { + "name": "priority", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'low'" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "current_timestamp" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tasks_code_unique": { + "name": "tasks_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidate_logs": { + "name": "vendor_candidate_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_candidate_id": { + "name": "vendor_candidate_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk": { + "name": "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "vendor_candidates", + "columnsFrom": [ + "vendor_candidate_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_candidate_logs_user_id_users_id_fk": { + "name": "vendor_candidate_logs_user_id_users_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors_logs": { + "name": "vendors_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_logs_vendor_id_vendors_id_fk": { + "name": "vendors_logs_vendor_id_vendors_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendors_logs_user_id_users_id_fk": { + "name": "vendors_logs_user_id_users_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract": { + "name": "basic_contract", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_id": { + "name": "template_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requested_by": { + "name": "requested_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "basic_contract_template_id_basic_contract_templates_id_fk": { + "name": "basic_contract_template_id_basic_contract_templates_id_fk", + "tableFrom": "basic_contract", + "tableTo": "basic_contract_templates", + "columnsFrom": [ + "template_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_vendor_id_vendors_id_fk": { + "name": "basic_contract_vendor_id_vendors_id_fk", + "tableFrom": "basic_contract", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_requested_by_users_id_fk": { + "name": "basic_contract_requested_by_users_id_fk", + "tableFrom": "basic_contract", + "tableTo": "users", + "columnsFrom": [ + "requested_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract_templates": { + "name": "basic_contract_templates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_templates_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_name": { + "name": "template_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "validity_period": { + "name": "validity_period", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.incoterms": { + "name": "incoterms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(20)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "incoterms_created_by_users_id_fk": { + "name": "incoterms_created_by_users_id_fk", + "tableFrom": "incoterms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payment_terms": { + "name": "payment_terms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "payment_terms_created_by_users_id_fk": { + "name": "payment_terms_created_by_users_id_fk", + "tableFrom": "payment_terms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pr_items": { + "name": "pr_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "pr_items", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_attachments": { + "name": "procurement_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "procurement_rfq_details_id": { + "name": "procurement_rfq_details_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk": { + "name": "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfq_details", + "columnsFrom": [ + "procurement_rfq_details_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_created_by_users_id_fk": { + "name": "procurement_attachments_created_by_users_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "attachment_type_check": { + "name": "attachment_type_check", + "value": "\"procurement_attachments\".\"procurement_rfqs_id\" IS NOT NULL OR \"procurement_attachments\".\"procurement_rfq_details_id\" IS NOT NULL" + } + }, + "isRLSEnabled": false + }, + "public.procurement_quotation_items": { + "name": "procurement_quotation_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pr_item_id": { + "name": "pr_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "material_code": { + "name": "material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "uom": { + "name": "uom", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "unit_price": { + "name": "unit_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "vendor_material_code": { + "name": "vendor_material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_material_description": { + "name": "vendor_material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "lead_time_in_days": { + "name": "lead_time_in_days", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_rate": { + "name": "discount_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_amount": { + "name": "discount_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_alternative": { + "name": "is_alternative", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_recommended": { + "name": "is_recommended", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_quotation_items_pr_item_id_pr_items_id_fk": { + "name": "procurement_quotation_items_pr_item_id_pr_items_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "pr_items", + "columnsFrom": [ + "pr_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_attachments": { + "name": "procurement_rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_uploaded_by_users_id_fk": { + "name": "procurement_rfq_attachments_uploaded_by_users_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_comments": { + "name": "procurement_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_comments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_user_id_users_id_fk": { + "name": "procurement_rfq_comments_user_id_users_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_details": { + "name": "procurement_rfq_details", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendors_id": { + "name": "vendors_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'VV'" + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_vendors_id_vendors_id_fk": { + "name": "procurement_rfq_details_vendors_id_vendors_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "vendors", + "columnsFrom": [ + "vendors_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_rfq_details_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_incoterms_code_incoterms_code_fk": { + "name": "procurement_rfq_details_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_updated_by_users_id_fk": { + "name": "procurement_rfq_details_updated_by_users_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfqs": { + "name": "procurement_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "series": { + "name": "series", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "rfq_sealed_yn": { + "name": "rfq_sealed_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfqs_project_id_projects_id_fk": { + "name": "procurement_rfqs_project_id_projects_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_sent_by_users_id_fk": { + "name": "procurement_rfqs_sent_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_created_by_users_id_fk": { + "name": "procurement_rfqs_created_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_updated_by_users_id_fk": { + "name": "procurement_rfqs_updated_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "procurement_rfqs_rfq_code_unique": { + "name": "procurement_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_vendor_quotations": { + "name": "procurement_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_items_count": { + "name": "total_items_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sub_total": { + "name": "sub_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "tax_total": { + "name": "tax_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "discount_total": { + "name": "discount_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "estimated_delivery_date": { + "name": "estimated_delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "procurement_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_incoterms_code_incoterms_code_fk": { + "name": "procurement_vendor_quotations_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.preset_shares": { + "name": "preset_shares", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "preset_id": { + "name": "preset_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "shared_with_user_id": { + "name": "shared_with_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'read'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "preset_shares_preset_id_table_presets_id_fk": { + "name": "preset_shares_preset_id_table_presets_id_fk", + "tableFrom": "preset_shares", + "tableTo": "table_presets", + "columnsFrom": [ + "preset_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_presets": { + "name": "table_presets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_shared": { + "name": "is_shared", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_attachments": { + "name": "tech_sales_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "tech_sales_rfq_id": { + "name": "tech_sales_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "tech_sales_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_attachments_created_by_users_id_fk": { + "name": "tech_sales_attachments_created_by_users_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comment_attachments": { + "name": "tech_sales_rfq_comment_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk": { + "name": "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk": { + "name": "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comments": { + "name": "tech_sales_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_user_id_users_id_fk": { + "name": "tech_sales_rfq_comments_user_id_users_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfqs": { + "name": "tech_sales_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_shipbuilding_id": { + "name": "item_shipbuilding_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "bidding_project_id": { + "name": "bidding_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_snapshot": { + "name": "project_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "series_snapshot": { + "name": "series_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk": { + "name": "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "item_shipbuilding", + "columnsFrom": [ + "item_shipbuilding_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk": { + "name": "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bidding_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_sent_by_users_id_fk": { + "name": "tech_sales_rfqs_sent_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_created_by_users_id_fk": { + "name": "tech_sales_rfqs_created_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_updated_by_users_id_fk": { + "name": "tech_sales_rfqs_updated_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tech_sales_rfqs_rfq_code_unique": { + "name": "tech_sales_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_vendor_quotations": { + "name": "tech_sales_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "tech_sales_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rotation_attempts": { + "name": "ocr_rotation_attempts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "rotation": { + "name": "rotation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "tables_found": { + "name": "tables_found", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "text_quality": { + "name": "text_quality", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "keyword_count": { + "name": "keyword_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "score": { + "name": "score", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "extracted_rows_count": { + "name": "extracted_rows_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_rotation_attempts_session_id_ocr_sessions_id_fk": { + "name": "ocr_rotation_attempts_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rotation_attempts", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rows": { + "name": "ocr_rows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "table_id": { + "name": "table_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "row_index": { + "name": "row_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "report_no": { + "name": "report_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "no": { + "name": "no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "identification_no": { + "name": "identification_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_no": { + "name": "joint_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_type": { + "name": "joint_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "welding_date": { + "name": "welding_date", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "source_table": { + "name": "source_table", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "source_row": { + "name": "source_row", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_ocr_row_unique": { + "name": "idx_ocr_row_unique", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "report_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "ocr_rows_table_id_ocr_tables_id_fk": { + "name": "ocr_rows_table_id_ocr_tables_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_tables", + "columnsFrom": [ + "table_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_session_id_ocr_sessions_id_fk": { + "name": "ocr_rows_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_user_id_users_id_fk": { + "name": "ocr_rows_user_id_users_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_sessions": { + "name": "ocr_sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "processing_time": { + "name": "processing_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "best_rotation": { + "name": "best_rotation", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_tables": { + "name": "total_tables", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_rows": { + "name": "total_rows", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "image_enhanced": { + "name": "image_enhanced", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pdf_converted": { + "name": "pdf_converted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "success": { + "name": "success", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "warnings": { + "name": "warnings", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_tables": { + "name": "ocr_tables", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "table_index": { + "name": "table_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "row_count": { + "name": "row_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_tables_session_id_ocr_sessions_id_fk": { + "name": "ocr_tables_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_tables", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.offshore_hull_work_type": { + "name": "offshore_hull_work_type", + "schema": "public", + "values": [ + "HA", + "HE", + "HH", + "HM", + "NC" + ] + }, + "public.offshore_top_work_type": { + "name": "offshore_top_work_type", + "schema": "public", + "values": [ + "TM", + "TS", + "TE", + "TP" + ] + }, + "public.work_type": { + "name": "work_type", + "schema": "public", + "values": [ + "기장", + "전장", + "선실", + "배관", + "철의" + ] + }, + "public.user_domain": { + "name": "user_domain", + "schema": "public", + "values": [ + "evcp", + "partners" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": { + "public.contracts_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"contracts\".\"id\", \"contracts\".\"contract_no\", \"contracts\".\"contract_name\", \"contracts\".\"status\", \"contracts\".\"start_date\", \"contracts\".\"end_date\", \"contracts\".\"project_id\", \"projects\".\"code\", \"projects\".\"name\", \"contracts\".\"vendor_id\", \"vendors\".\"vendor_name\", \"contracts\".\"payment_terms\", \"contracts\".\"delivery_terms\", \"contracts\".\"delivery_date\", \"contracts\".\"delivery_location\", \"contracts\".\"currency\", \"contracts\".\"total_amount\", \"contracts\".\"discount\", \"contracts\".\"tax\", \"contracts\".\"shipping_fee\", \"contracts\".\"net_total\", \"contracts\".\"partial_shipping_allowed\", \"contracts\".\"partial_payment_allowed\", \"contracts\".\"remarks\", \"contracts\".\"version\", \"contracts\".\"created_at\", \"contracts\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"contracts\".\"id\"\n ) as \"has_signature\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "contracts_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.poa_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", + "name": "poa_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.project_approved_vendors": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"status\", \"vendor_types\".\"name_ko\", \"vendor_types\".\"name_en\", \"projects\".\"code\", \"projects\".\"name\", \"projects\".\"type\", \"vendor_pq_submissions\".\"submitted_at\", \"vendor_pq_submissions\".\"approved_at\" from \"vendors\" inner join \"vendor_pq_submissions\" on \"vendor_pq_submissions\".\"vendor_id\" = \"vendors\".\"id\" inner join \"projects\" on \"vendor_pq_submissions\".\"project_id\" = \"projects\".\"id\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\" where \"vendor_pq_submissions\".\"status\" = 'APPROVED'", + "name": "project_approved_vendors", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_investigations_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"vendor_id\", \"vendor_investigations\".\"pq_submission_id\", \"vendor_investigations\".\"requester_id\", \"vendor_investigations\".\"qm_manager_id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"evaluation_type\", \"vendor_investigations\".\"investigation_address\", \"vendor_investigations\".\"investigation_method\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"forecasted_at\", \"vendor_investigations\".\"requested_at\", \"vendor_investigations\".\"confirmed_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"evaluation_score\", \"vendor_investigations\".\"evaluation_result\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", requester.name as \"requesterName\", requester.email as \"requesterEmail\", qm_manager.name as \"qmManagerName\", qm_manager.email as \"qmManagerEmail\", (\n CASE \n WHEN EXISTS (\n SELECT 1 FROM vendor_investigation_attachments via \n WHERE via.investigation_id = \"vendor_investigations\".\"id\"\n ) \n THEN true \n ELSE false \n END\n ) as \"hasAttachments\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\" left join users AS requester on \"vendor_investigations\".\"requester_id\" = requester.id left join users AS qm_manager on \"vendor_investigations\".\"qm_manager_id\" = qm_manager.id", + "name": "vendor_investigations_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.cbe_view": { + "columns": {}, + "definition": "select \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"rfq_id\" as \"rfq_id\", \"cbe_evaluations\".\"vendor_id\" as \"vendor_id\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"result\" as \"result\", \"cbe_evaluations\".\"notes\" as \"notes\", \"cbe_evaluations\".\"evaluated_by\" as \"evaluated_by\", \"cbe_evaluations\".\"evaluated_at\" as \"evaluated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"name\" as \"evaluator_name\", \"users\".\"email\" as \"evaluator_email\" from \"cbe_evaluations\" inner join \"rfqs\" on \"cbe_evaluations\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"cbe_evaluations\".\"evaluated_by\" = \"users\".\"id\"", + "name": "cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.rfqs_view": { + "columns": {}, + "definition": "select \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"rfqs\".\"parent_rfq_id\" as \"parent_rfq_id\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"email\" as \"user_email\", \"users\".\"name\" as \"user_name\", (\n SELECT COUNT(*) \n FROM \"rfq_items\" \n WHERE \"rfq_items\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"item_count\", (\n SELECT COUNT(*) \n FROM \"rfq_attachments\" \n WHERE \"rfq_attachments\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"attachment_count\" from \"rfqs\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"rfqs\".\"created_by\" = \"users\".\"id\"", + "name": "rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_cbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", \"cbe_evaluations\".\"notes\" as \"cbe_note\", \"cbe_evaluations\".\"updated_at\" as \"cbe_updated\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"delivery_schedule\" as \"delivery_schedule\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_response_cbe_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"notes\" as \"response_notes\", \"vendor_responses\".\"responded_by\" as \"responded_by\", \"vendor_responses\".\"responded_at\" as \"responded_at\", \"vendor_responses\".\"updated_at\" as \"response_updated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"status\" as \"vendor_status\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"response_status\" as \"commercial_response_status\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"vendor_commercial_responses\".\"payment_terms\" as \"payment_terms\", \"vendor_commercial_responses\".\"incoterms\" as \"incoterms\", \"vendor_commercial_responses\".\"delivery_period\" as \"delivery_period\", \"vendor_commercial_responses\".\"warranty_period\" as \"warranty_period\", \"vendor_commercial_responses\".\"validity_period\" as \"validity_period\", \"vendor_commercial_responses\".\"price_breakdown\" as \"price_breakdown\", \"vendor_commercial_responses\".\"commercial_notes\" as \"commercial_notes\", \"vendor_commercial_responses\".\"created_at\" as \"commercial_created_at\", \"vendor_commercial_responses\".\"updated_at\" as \"commercial_updated_at\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"commercial_response_id\" = \"vendor_commercial_responses\".\"id\"\n ) as \"commercial_attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n AND \"vendor_response_attachments\".\"attachment_type\" = 'TECHNICAL_SPEC'\n ) as \"technical_attachment_count\", (\n SELECT MAX(\"uploaded_at\") \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"latest_attachment_date\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\"", + "name": "vendor_response_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_responses_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"created_at\" as \"rfq_created_at\", \"rfqs\".\"updated_at\" as \"rfq_updated_at\", \"rfqs\".\"created_by\" as \"rfq_created_by\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"responded_at\" as \"responded_at\", CASE WHEN \"vendor_technical_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_technical_response\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", CASE WHEN \"vendor_commercial_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_commercial_response\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"rfq_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE') left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"cbe_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\")", + "name": "vendor_responses_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_rfq_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", + "name": "vendor_rfq_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_tbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", \"vendor_technical_responses\".\"response_status\" as \"technical_response_status\", \"vendor_technical_responses\".\"summary\" as \"technical_summary\", \"vendor_technical_responses\".\"notes\" as \"technical_notes\", \"vendor_technical_responses\".\"updated_at\" as \"technical_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"rfq_evaluations\".\"notes\" as \"tbe_note\", \"rfq_evaluations\".\"updated_at\" as \"tbe_updated\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_tbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.role_view": { + "columns": {}, + "definition": "select \"roles\".\"id\" as \"id\", \"roles\".\"name\" as \"name\", \"roles\".\"description\" as \"description\", \"roles\".\"domain\" as \"domain\", \"roles\".\"created_at\" as \"created_at\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", COUNT(\"users\".\"id\") as \"user_count\" from \"roles\" left join \"user_roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" left join \"users\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"vendors\" on \"roles\".\"company_id\" = \"vendors\".\"id\" group by \"roles\".\"id\", \"vendors\".\"id\"", + "name": "role_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.user_view": { + "columns": {}, + "definition": "select \"users\".\"id\" as \"user_id\", \"users\".\"name\" as \"user_name\", \"users\".\"email\" as \"user_email\", \"users\".\"domain\" as \"user_domain\", \"users\".\"image_url\" as \"user_image\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"vendors\" on \"users\".\"company_id\" = \"vendors\".\"id\" left join \"user_roles\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" group by \"users\".\"id\", \"vendors\".\"id\"", + "name": "user_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.form_lists_view": { + "columns": {}, + "definition": "select \"tag_type_class_form_mappings\".\"id\" as \"id\", \"tag_type_class_form_mappings\".\"project_id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"tag_type_class_form_mappings\".\"tag_type_label\" as \"tag_type_label\", \"tag_type_class_form_mappings\".\"class_label\" as \"class_label\", \"tag_type_class_form_mappings\".\"form_code\" as \"form_code\", \"tag_type_class_form_mappings\".\"form_name\" as \"form_name\", \"tag_type_class_form_mappings\".\"ep\" as \"ep\", \"tag_type_class_form_mappings\".\"remark\" as \"remark\", \"tag_type_class_form_mappings\".\"created_at\" as \"created_at\", \"tag_type_class_form_mappings\".\"updated_at\" as \"updated_at\" from \"tag_type_class_form_mappings\" inner join \"projects\" on \"tag_type_class_form_mappings\".\"project_id\" = \"projects\".\"id\"", + "name": "form_lists_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.view_tag_subfields": { + "columns": { + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "definition": "select \"tag_subfields\".\"id\" as \"id\", \"tag_subfields\".\"tag_type_code\", \"tag_types\".\"description\", \"tag_subfields\".\"attributes_id\", \"tag_subfields\".\"attributes_description\", \"tag_subfields\".\"expression\", \"tag_subfields\".\"delimiter\", \"tag_subfields\".\"sort_order\", \"tag_subfields\".\"created_at\", \"tag_subfields\".\"updated_at\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\", \"projects\".\"name\" from \"tag_subfields\" inner join \"tag_types\" on (\"tag_subfields\".\"tag_type_code\" = \"tag_types\".\"code\" and \"tag_subfields\".\"project_id\" = \"tag_types\".\"project_id\") inner join \"projects\" on \"tag_subfields\".\"project_id\" = \"projects\".\"id\"", + "name": "view_tag_subfields", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.document_stages_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_count": { + "name": "stage_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_list": { + "name": "stage_list", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT\n d.id AS document_id,\n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n d.contract_id,\n (SELECT COUNT(*) FROM issue_stages WHERE document_id = d.id) AS stage_count,\n COALESCE( \n (SELECT json_agg(i.stage_name) FROM issue_stages i WHERE i.document_id = d.id), \n '[]'\n ) AS stage_list,\n d.created_at,\n d.updated_at\n FROM documents d\n", + "name": "document_stages_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.enhanced_documents_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_id": { + "name": "current_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_name": { + "name": "current_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_status": { + "name": "current_stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_order": { + "name": "current_stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_plan_date": { + "name": "current_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_actual_date": { + "name": "current_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_assignee_name": { + "name": "current_stage_assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_priority": { + "name": "current_stage_priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "days_until_due": { + "name": "days_until_due", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_overdue": { + "name": "is_overdue", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "days_difference": { + "name": "days_difference", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "total_stages": { + "name": "total_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "completed_stages": { + "name": "completed_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "progress_percentage": { + "name": "progress_percentage", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_status": { + "name": "latest_revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_submitted_date": { + "name": "latest_submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "all_stages": { + "name": "all_stages", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n WITH document_stats AS (\n SELECT \n d.id as document_id,\n COUNT(ist.id) as total_stages,\n COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) as completed_stages,\n CASE \n WHEN COUNT(ist.id) > 0 \n THEN ROUND((COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) * 100.0) / COUNT(ist.id))\n ELSE 0 \n END as progress_percentage\n FROM documents d\n LEFT JOIN issue_stages ist ON d.id = ist.document_id\n GROUP BY d.id\n ),\n current_stage_info AS (\n SELECT DISTINCT ON (document_id)\n document_id,\n id as current_stage_id,\n stage_name as current_stage_name,\n stage_status as current_stage_status,\n stage_order as current_stage_order,\n plan_date as current_stage_plan_date,\n actual_date as current_stage_actual_date,\n assignee_name as current_stage_assignee_name,\n priority as current_stage_priority,\n CASE \n WHEN actual_date IS NULL AND plan_date IS NOT NULL \n THEN plan_date - CURRENT_DATE\n ELSE NULL \n END as days_until_due,\n CASE \n WHEN actual_date IS NULL AND plan_date < CURRENT_DATE \n THEN true\n WHEN actual_date IS NOT NULL AND actual_date > plan_date \n THEN true\n ELSE false \n END as is_overdue,\n CASE \n WHEN actual_date IS NOT NULL AND plan_date IS NOT NULL \n THEN actual_date - plan_date\n ELSE NULL \n END as days_difference\n FROM issue_stages\n WHERE stage_status NOT IN ('COMPLETED', 'APPROVED')\n ORDER BY document_id, stage_order ASC, priority DESC\n ),\n latest_revision_info AS (\n SELECT DISTINCT ON (ist.document_id)\n ist.document_id,\n r.id as latest_revision_id,\n r.revision as latest_revision,\n r.revision_status as latest_revision_status,\n r.uploader_name as latest_revision_uploader_name,\n r.submitted_date as latest_submitted_date\n FROM revisions r\n JOIN issue_stages ist ON r.issue_stage_id = ist.id\n ORDER BY ist.document_id, r.created_at DESC\n ),\n -- 리비전별 첨부파일 집계\n revision_attachments AS (\n SELECT \n r.id as revision_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', da.id,\n 'revisionId', da.revision_id,\n 'fileName', da.file_name,\n 'filePath', da.file_path,\n 'fileSize', da.file_size,\n 'fileType', da.file_type,\n 'createdAt', da.created_at,\n 'updatedAt', da.updated_at\n ) ORDER BY da.created_at\n ) FILTER (WHERE da.id IS NOT NULL),\n '[]'::json\n ) as attachments\n FROM revisions r\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY r.id\n ),\n -- 스테이지별 리비전 집계 (첨부파일 포함)\n stage_revisions AS (\n SELECT \n ist.id as stage_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', r.id,\n 'issueStageId', r.issue_stage_id,\n 'revision', r.revision,\n 'uploaderType', r.uploader_type,\n 'uploaderId', r.uploader_id,\n 'uploaderName', r.uploader_name,\n 'comment', r.comment,\n 'usage', r.usage,\n 'revisionStatus', r.revision_status,\n 'submittedDate', r.submitted_date,\n 'uploadedAt', r.uploaded_at,\n 'approvedDate', r.approved_date,\n 'reviewStartDate', r.review_start_date,\n 'rejectedDate', r.rejected_date,\n 'reviewerId', r.reviewer_id,\n 'reviewerName', r.reviewer_name,\n 'reviewComments', r.review_comments,\n 'createdAt', r.created_at,\n 'updatedAt', r.updated_at,\n 'attachments', ra.attachments\n ) ORDER BY r.created_at\n ) FILTER (WHERE r.id IS NOT NULL),\n '[]'::json\n ) as revisions\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN revision_attachments ra ON r.id = ra.revision_id\n GROUP BY ist.id\n ),\n -- 문서별 스테이지 집계 (리비전 포함)\n stage_aggregation AS (\n SELECT \n ist.document_id,\n json_agg(\n json_build_object(\n 'id', ist.id,\n 'stageName', ist.stage_name,\n 'stageStatus', ist.stage_status,\n 'stageOrder', ist.stage_order,\n 'planDate', ist.plan_date,\n 'actualDate', ist.actual_date,\n 'assigneeName', ist.assignee_name,\n 'priority', ist.priority,\n 'revisions', sr.revisions\n ) ORDER BY ist.stage_order\n ) as all_stages\n FROM issue_stages ist\n LEFT JOIN stage_revisions sr ON ist.id = sr.stage_id\n GROUP BY ist.document_id\n ),\n attachment_counts AS (\n SELECT \n ist.document_id,\n COUNT(da.id) as attachment_count\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY ist.document_id\n )\n \n SELECT \n d.id as document_id,\n d.doc_number,\n d.drawing_kind,\n d.vendor_doc_number, -- ✅ 벤더 문서 번호 추가\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n -- ✅ 프로젝트 및 벤더 정보 추가\n p.code as project_code,\n v.vendor_name as vendor_name,\n v.vendor_code as vendor_code,\n \n -- 현재 스테이지 정보\n csi.current_stage_id,\n csi.current_stage_name,\n csi.current_stage_status,\n csi.current_stage_order,\n csi.current_stage_plan_date,\n csi.current_stage_actual_date,\n csi.current_stage_assignee_name,\n csi.current_stage_priority,\n \n -- 계산 필드\n csi.days_until_due,\n csi.is_overdue,\n csi.days_difference,\n \n -- 진행률 정보\n ds.total_stages,\n ds.completed_stages,\n ds.progress_percentage,\n \n -- 최신 리비전 정보\n lri.latest_revision_id,\n lri.latest_revision,\n lri.latest_revision_status,\n lri.latest_revision_uploader_name,\n lri.latest_submitted_date,\n \n -- 전체 스테이지 (리비전 및 첨부파일 포함)\n COALESCE(sa.all_stages, '[]'::json) as all_stages,\n \n -- 기타\n COALESCE(ac.attachment_count, 0) as attachment_count,\n d.created_at,\n d.updated_at\n \n FROM documents d\n -- ✅ contracts, projects, vendors 테이블 JOIN 추가\n LEFT JOIN contracts c ON d.contract_id = c.id\n LEFT JOIN projects p ON c.project_id = p.id\n LEFT JOIN vendors v ON c.vendor_id = v.id\n \n LEFT JOIN document_stats ds ON d.id = ds.document_id\n LEFT JOIN current_stage_info csi ON d.id = csi.document_id\n LEFT JOIN latest_revision_info lri ON d.id = lri.document_id\n LEFT JOIN stage_aggregation sa ON d.id = sa.document_id\n LEFT JOIN attachment_counts ac ON d.id = ac.document_id\n \n ORDER BY d.created_at DESC\n", + "name": "enhanced_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.sync_status_view": { + "columns": { + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "total_changes": { + "name": "total_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pending_changes": { + "name": "pending_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "synced_changes": { + "name": "synced_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "failed_changes": { + "name": "failed_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "last_sync_at": { + "name": "last_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_sync_at": { + "name": "next_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n WITH change_stats AS (\n SELECT \n cl.contract_id,\n sc.target_system,\n COUNT(*) as total_changes,\n COUNT(CASE WHEN cl.is_synced = false AND cl.sync_attempts < sc.retry_max_attempts THEN 1 END) as pending_changes,\n COUNT(CASE WHEN cl.is_synced = true THEN 1 END) as synced_changes,\n COUNT(CASE WHEN cl.sync_attempts >= sc.retry_max_attempts AND cl.is_synced = false THEN 1 END) as failed_changes,\n MAX(cl.synced_at) as last_sync_at\n FROM change_logs cl\n CROSS JOIN sync_configs sc \n WHERE cl.contract_id = sc.contract_id\n AND (cl.target_systems IS NULL OR cl.target_systems @> to_jsonb(sc.target_system))\n GROUP BY cl.contract_id, sc.target_system\n )\n SELECT \n cs.contract_id,\n cs.target_system,\n COALESCE(cs.total_changes, 0) as total_changes,\n COALESCE(cs.pending_changes, 0) as pending_changes,\n COALESCE(cs.synced_changes, 0) as synced_changes,\n COALESCE(cs.failed_changes, 0) as failed_changes,\n cs.last_sync_at,\n CASE \n WHEN sc.sync_enabled = true AND sc.last_successful_sync IS NOT NULL \n THEN sc.last_successful_sync + (sc.sync_interval_minutes || ' minutes')::interval\n ELSE NULL\n END as next_sync_at,\n sc.sync_enabled\n FROM sync_configs sc\n LEFT JOIN change_stats cs ON sc.contract_id = cs.contract_id AND sc.target_system = cs.target_system\n", + "name": "sync_status_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_documents_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "latest_stage_id": { + "name": "latest_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_stage_name": { + "name": "latest_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_stage_plan_date": { + "name": "latest_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_stage_actual_date": { + "name": "latest_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_type": { + "name": "latest_revision_uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT \n d.id, \n d.doc_number,\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n (SELECT id FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_id,\n (SELECT stage_name FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_name,\n (SELECT plan_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_plan_date,\n (SELECT actual_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_actual_date,\n \n (SELECT r.id FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_id,\n (SELECT r.revision FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision,\n (SELECT r.uploader_type FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_type,\n (SELECT r.uploader_name FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_name,\n \n (SELECT COUNT(*) FROM document_attachments a JOIN revisions r ON a.revision_id = r.id JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id) AS attachment_count,\n \n d.created_at,\n d.updated_at\n FROM documents d\n JOIN contracts c ON d.contract_id = c.id\n ", + "name": "vendor_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_candidates_with_vendor_info": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_candidates\".\"id\", \"vendor_candidates\".\"company_name\", \"vendor_candidates\".\"contact_email\", \"vendor_candidates\".\"contact_phone\", \"vendor_candidates\".\"tax_id\", \"vendor_candidates\".\"address\", \"vendor_candidates\".\"country\", \"vendor_candidates\".\"source\", \"vendor_candidates\".\"status\", \"vendor_candidates\".\"items\", \"vendor_candidates\".\"remark\", \"vendor_candidates\".\"created_at\", \"vendor_candidates\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"created_at\" as \"vendor_created_at\", (\n SELECT l2.\"created_at\"\n FROM \"vendor_candidate_logs\" l2\n WHERE l2.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l2.\"action\" = 'status_change'\n ORDER BY l2.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_at\", (\n SELECT u.\"name\"\n FROM \"users\" u\n JOIN \"vendor_candidate_logs\" l3\n ON l3.\"user_id\" = u.\"id\"\n WHERE l3.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l3.\"action\" = 'status_change'\n ORDER BY l3.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_by\", (\n SELECT l4.\"created_at\"\n FROM \"vendor_candidate_logs\" l4\n WHERE l4.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l4.\"action\" = 'invite_sent'\n ORDER BY l4.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_at\", (\n SELECT u2.\"name\"\n FROM \"users\" u2\n JOIN \"vendor_candidate_logs\" l5\n ON l5.\"user_id\" = u2.\"id\"\n WHERE l5.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l5.\"action\" = 'invite_sent'\n ORDER BY l5.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_by\" from \"vendor_candidates\" left join \"vendors\" on \"vendor_candidates\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "vendor_candidates_with_vendor_info", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"business_size\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"", + "name": "vendor_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", + "name": "vendor_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_materials_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_materials\".\"id\", \"vendor_possible_materials\".\"vendor_id\", \"materials\".\"item_name\", \"materials\".\"item_code\", \"materials\".\"description\", \"materials\".\"unit_of_measure\", \"materials\".\"steel_type\", \"materials\".\"grade_material\", \"vendor_possible_materials\".\"created_at\", \"vendor_possible_materials\".\"updated_at\" from \"vendor_possible_materials\" left join \"materials\" on \"vendor_possible_materials\".\"item_code\" = \"materials\".\"item_code\"", + "name": "vendor_materials_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendors_with_types": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"tax_id\" as \"tax_id\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"phone\" as \"phone\", \"vendors\".\"email\" as \"email\", \"vendors\".\"business_size\" as \"business_size\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"status\", \"vendors\".\"vendor_type_id\" as \"vendor_type_id\", \"vendors\".\"representative_name\" as \"representative_name\", \"vendors\".\"representative_birth\" as \"representative_birth\", \"vendors\".\"representative_email\" as \"representative_email\", \"vendors\".\"representative_phone\" as \"representative_phone\", \"vendors\".\"corporate_registration_number\" as \"corporate_registration_number\", \"vendors\".\"items\" as \"items\", \"vendors\".\"credit_agency\" as \"credit_agency\", \"vendors\".\"credit_rating\" as \"credit_rating\", \"vendors\".\"cash_flow_rating\" as \"cash_flow_rating\", \"vendors\".\"created_at\" as \"created_at\", \"vendors\".\"updated_at\" as \"updated_at\", \"vendor_types\".\"name_ko\" as \"vendor_type_name\", \"vendor_types\".\"name_en\" as \"vendor_type_name_en\", \"vendor_types\".\"code\" as \"vendor_type_code\", \n CASE\n WHEN \"vendors\".\"status\" = 'ACTIVE' THEN '정규업체'\n WHEN \"vendors\".\"status\" IN ('INACTIVE', 'BLACKLISTED', 'REJECTED') THEN ''\n ELSE '잠재업체'\n END\n as \"vendor_category\" from \"vendors\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\"", + "name": "vendors_with_types", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.basic_contract_view": { + "columns": {}, + "definition": "select \"basic_contract\".\"id\" as \"id\", \"basic_contract\".\"template_id\" as \"template_id\", \"basic_contract\".\"vendor_id\" as \"vendor_id\", \"basic_contract\".\"requested_by\" as \"requested_by\", \"basic_contract\".\"status\" as \"basic_contract_status\", \"basic_contract\".\"created_at\" as \"created_at\", \"basic_contract\".\"updated_at\" as \"updated_at\", \"basic_contract\".\"updated_at\" as \"completed_at\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"email\" as \"vendor_email\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"users\".\"name\" as \"user_name\", \"basic_contract_templates\".\"template_name\" as \"template_name\", \"basic_contract_templates\".\"validity_period\" as \"validityPeriod\", \"basic_contract_templates\".\"file_path\" as \"file_path\", \"basic_contract_templates\".\"file_name\" as \"file_name\", \"basic_contract\".\"file_path\" as \"signed_file_path\" from \"basic_contract\" left join \"vendors\" on \"basic_contract\".\"vendor_id\" = \"vendors\".\"id\" left join \"users\" on \"basic_contract\".\"requested_by\" = \"users\".\"id\" left join \"basic_contract_templates\" on \"basic_contract\".\"template_id\" = \"basic_contract_templates\".\"id\"", + "name": "basic_contract_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.pr_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"pr_items\".\"id\", \"pr_items\".\"procurement_rfqs_id\", \"pr_items\".\"rfq_item\", \"pr_items\".\"pr_item\", \"pr_items\".\"pr_no\", \"pr_items\".\"material_code\", \"pr_items\".\"material_category\", \"pr_items\".\"acc\", \"pr_items\".\"material_description\", \"pr_items\".\"size\", \"pr_items\".\"delivery_date\", \"pr_items\".\"quantity\", \"pr_items\".\"uom\", \"pr_items\".\"gross_weight\", \"pr_items\".\"gw_uom\", \"pr_items\".\"spec_no\", \"pr_items\".\"spec_url\", \"pr_items\".\"tracking_no\", \"pr_items\".\"major_yn\", \"pr_items\".\"project_def\", \"pr_items\".\"project_sc\", \"pr_items\".\"project_kl\", \"pr_items\".\"project_lc\", \"pr_items\".\"project_dl\", \"pr_items\".\"remark\", \"procurement_rfqs\".\"rfq_code\", \"procurement_rfqs\".\"item_code\", \"procurement_rfqs\".\"item_name\" from \"pr_items\" left join \"procurement_rfqs\" on \"pr_items\".\"procurement_rfqs_id\" = \"procurement_rfqs\".\"id\"", + "name": "pr_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfq_details_view": { + "columns": {}, + "definition": "select \"rfq_details\".\"id\" as \"detail_id\", \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfqs\".\"item_code\" as \"item_code\", \"rfqs\".\"item_name\" as \"item_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"country\" as \"vendor_country\", \"rfq_details\".\"currency\" as \"currency\", \"payment_terms\".\"code\" as \"payment_terms_code\", \"payment_terms\".\"description\" as \"payment_terms_description\", \"incoterms\".\"code\" as \"incoterms_code\", \"incoterms\".\"description\" as \"incoterms_description\", \"rfq_details\".\"incoterms_detail\" as \"incoterms_detail\", \"rfq_details\".\"delivery_date\" as \"delivery_date\", \"rfq_details\".\"tax_code\" as \"tax_code\", \"rfq_details\".\"place_of_shipping\" as \"place_of_shipping\", \"rfq_details\".\"place_of_destination\" as \"place_of_destination\", \"rfq_details\".\"material_price_related_yn\" as \"material_price_related_yn\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"rfq_details\".\"updated_at\" as \"updated_at\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\"\n ) as \"pr_items_count\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\" \n AND major_yn = true\n ) as \"major_items_count\", (\n SELECT COUNT(*) \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"comment_count\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_comment_date\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\" AND is_vendor_comment = true\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_vendor_comment_date\", (\n SELECT COUNT(*) \n FROM procurement_rfq_attachments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) > 0\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"has_quotation\", (\n SELECT status\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_status\", (\n SELECT total_price\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_total_price\", (\n SELECT quotation_version\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"quotation_version\", (\n SELECT COUNT(DISTINCT quotation_version)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"quotation_version_count\", (\n SELECT created_at\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"last_quotation_date\" from \"procurement_rfq_details\" \"rfq_details\" left join \"procurement_rfqs\" \"rfqs\" on \"rfq_details\".\"procurement_rfqs_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"rfq_details\".\"vendors_id\" = \"vendors\".\"id\" left join \"payment_terms\" on \"rfq_details\".\"payment_terms_code\" = \"payment_terms\".\"code\" left join \"incoterms\" on \"rfq_details\".\"incoterms_code\" = \"incoterms\".\"code\" left join \"users\" \"updated_by_user\" on \"rfq_details\".\"updated_by\" = \"updated_by_user\".\"id\"", + "name": "procurement_rfq_details_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfqs_view": { + "columns": {}, + "definition": "select \"procurement_rfqs\".\"id\" as \"id\", \"procurement_rfqs\".\"rfq_code\" as \"rfq_code\", \"procurement_rfqs\".\"series\" as \"series\", \"procurement_rfqs\".\"rfq_sealed_yn\" as \"rfq_sealed_yn\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"procurement_rfqs\".\"item_code\" as \"item_code\", \"procurement_rfqs\".\"item_name\" as \"item_name\", \"procurement_rfqs\".\"status\" as \"status\", \"procurement_rfqs\".\"pic_code\" as \"pic_code\", \"procurement_rfqs\".\"rfq_send_date\" as \"rfq_send_date\", \"procurement_rfqs\".\"due_date\" as \"due_date\", (\n SELECT MIN(submitted_at)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"procurement_rfqs\".\"id\"\n AND submitted_at IS NOT NULL\n ) as \"earliest_quotation_submitted_at\", \"created_by_user\".\"name\" as \"created_by_user_name\", \"sent_by_user\".\"name\" as \"sent_by_user_name\", \"procurement_rfqs\".\"updated_at\" as \"updated_at\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"procurement_rfqs\".\"remark\" as \"remark\", (\n SELECT material_code \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"major_item_material_code\", (\n SELECT pr_no \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"po_no\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n ) as \"pr_items_count\" from \"procurement_rfqs\" left join \"projects\" on \"procurement_rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" \"created_by_user\" on \"procurement_rfqs\".\"created_by\" = \"created_by_user\".\"id\" left join \"users\" \"updated_by_user\" on \"procurement_rfqs\".\"updated_by\" = \"updated_by_user\".\"id\" left join \"users\" \"sent_by_user\" on \"procurement_rfqs\".\"sent_by\" = \"sent_by_user\".\"id\"", + "name": "procurement_rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + } + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db/migrations/meta/0116_snapshot.json b/db/migrations/meta/0116_snapshot.json new file mode 100644 index 00000000..a2239718 --- /dev/null +++ b/db/migrations/meta/0116_snapshot.json @@ -0,0 +1,12040 @@ +{ + "id": "9dfe8279-40e2-4c3f-8565-b8733860d0cd", + "prevId": "fbe1061d-290d-4476-b43a-1927e17a8c51", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.companies": { + "name": "companies", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "companies_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "taxID": { + "name": "taxID", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_envelopes": { + "name": "contract_envelopes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_envelopes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "envelope_id": { + "name": "envelope_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": true + }, + "document_id": { + "name": "document_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": false + }, + "envelope_status": { + "name": "envelope_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_envelopes_contract_id_contracts_id_fk": { + "name": "contract_envelopes_contract_id_contracts_id_fk", + "tableFrom": "contract_envelopes", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_items": { + "name": "contract_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_items_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_id": { + "name": "item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "unit_price": { + "name": "unit_price", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "total_line_amount": { + "name": "total_line_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_items_contract_item_idx": { + "name": "contract_items_contract_item_idx", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "contract_items_contract_id_contracts_id_fk": { + "name": "contract_items_contract_id_contracts_id_fk", + "tableFrom": "contract_items", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_items_item_id_items_id_fk": { + "name": "contract_items_item_id_items_id_fk", + "tableFrom": "contract_items", + "tableTo": "items", + "columnsFrom": [ + "item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_items_contract_id_item_id_unique": { + "name": "contract_items_contract_id_item_id_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_id", + "item_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_signers": { + "name": "contract_signers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_signers_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "envelope_id": { + "name": "envelope_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_contact_id": { + "name": "vendor_contact_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "signer_type": { + "name": "signer_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'VENDOR'" + }, + "signer_email": { + "name": "signer_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "signer_name": { + "name": "signer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "signer_position": { + "name": "signer_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "signer_status": { + "name": "signer_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "signed_at": { + "name": "signed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_signers_envelope_id_contract_envelopes_id_fk": { + "name": "contract_signers_envelope_id_contract_envelopes_id_fk", + "tableFrom": "contract_signers", + "tableTo": "contract_envelopes", + "columnsFrom": [ + "envelope_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_signers_vendor_contact_id_vendor_contacts_id_fk": { + "name": "contract_signers_vendor_contact_id_vendor_contacts_id_fk", + "tableFrom": "contract_signers", + "tableTo": "vendor_contacts", + "columnsFrom": [ + "vendor_contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contracts": { + "name": "contracts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contracts_project_id_projects_id_fk": { + "name": "contracts_project_id_projects_id_fk", + "tableFrom": "contracts", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contracts_vendor_id_vendors_id_fk": { + "name": "contracts_vendor_id_vendors_id_fk", + "tableFrom": "contracts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contracts_contract_no_unique": { + "name": "contracts_contract_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.poa": { + "name": "poa", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "original_contract_no": { + "name": "original_contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "original_contract_name": { + "name": "original_contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_status": { + "name": "original_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "poa_original_contract_no_contracts_contract_no_fk": { + "name": "poa_original_contract_no_contracts_contract_no_fk", + "tableFrom": "poa", + "tableTo": "contracts", + "columnsFrom": [ + "original_contract_no" + ], + "columnsTo": [ + "contract_no" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_project_id_projects_id_fk": { + "name": "poa_project_id_projects_id_fk", + "tableFrom": "poa", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_vendor_id_vendors_id_fk": { + "name": "poa_vendor_id_vendors_id_fk", + "tableFrom": "poa", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_hull": { + "name": "item_offshore_hull", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_hull_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_hull_item_code_items_item_code_fk": { + "name": "item_offshore_hull_item_code_items_item_code_fk", + "tableFrom": "item_offshore_hull", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_top": { + "name": "item_offshore_top", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_top_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_top_item_code_items_item_code_fk": { + "name": "item_offshore_top_item_code_items_item_code_fk", + "tableFrom": "item_offshore_top", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_shipbuilding": { + "name": "item_shipbuilding", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ship_types": { + "name": "ship_types", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'OPTION'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_shipbuilding_item_code_items_item_code_fk": { + "name": "item_shipbuilding_item_code_items_item_code_fk", + "tableFrom": "item_shipbuilding", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.items": { + "name": "items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_no": { + "name": "project_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "package_code": { + "name": "package_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "sm_code": { + "name": "sm_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "items_item_code_unique": { + "name": "items_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.materials": { + "name": "materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "materials_item_code_unique": { + "name": "materials_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias": { + "name": "pq_criterias", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "check_point": { + "name": "check_point", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "group_name": { + "name": "group_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias_extension": { + "name": "pq_criterias_extension", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_criteria_id": { + "name": "pq_criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_info": { + "name": "contract_info", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "additional_requirement": { + "name": "additional_requirement", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk": { + "name": "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "pq_criterias", + "columnsFrom": [ + "pq_criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "pq_criterias_extension_project_id_projects_id_fk": { + "name": "pq_criterias_extension_project_id_projects_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_criteria_attachments": { + "name": "vendor_criteria_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_criteria_answer_id": { + "name": "vendor_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_criteria_attachments", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigation_attachments": { + "name": "vendor_investigation_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "investigation_id": { + "name": "investigation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'REPORT'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { + "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", + "tableFrom": "vendor_investigation_attachments", + "tableTo": "vendor_investigations", + "columnsFrom": [ + "investigation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigations": { + "name": "vendor_investigations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigations_vendor_id_vendors_id_fk": { + "name": "vendor_investigations_vendor_id_vendors_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk": { + "name": "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendor_pq_submissions", + "columnsFrom": [ + "pq_submission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "vendor_investigations_requester_id_users_id_fk": { + "name": "vendor_investigations_requester_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_qm_manager_id_users_id_fk": { + "name": "vendor_investigations_qm_manager_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "qm_manager_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_submissions": { + "name": "vendor_pq_submissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_number": { + "name": "pq_number", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_pq_submission": { + "name": "unique_pq_submission", + "columns": [ + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_pq_submissions_requester_id_users_id_fk": { + "name": "vendor_pq_submissions_requester_id_users_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_pq_submissions_vendor_id_vendors_id_fk": { + "name": "vendor_pq_submissions_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_submissions_project_id_projects_id_fk": { + "name": "vendor_pq_submissions_project_id_projects_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_pq_submissions_pq_number_unique": { + "name": "vendor_pq_submissions_pq_number_unique", + "nullsNotDistinct": false, + "columns": [ + "pq_number" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_criteria_answers": { + "name": "vendor_pq_criteria_answers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "criteria_id": { + "name": "criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "answer": { + "name": "answer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_criteria_answers_vendor_id_vendors_id_fk": { + "name": "vendor_pq_criteria_answers_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": { + "name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "pq_criterias", + "columnsFrom": [ + "criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_project_id_projects_id_fk": { + "name": "vendor_pq_criteria_answers_project_id_projects_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_review_logs": { + "name": "vendor_pq_review_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_pq_criteria_answer_id": { + "name": "vendor_pq_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "reviewer_comment": { + "name": "reviewer_comment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_pq_review_logs", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_pq_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_project_pqs": { + "name": "vendor_project_pqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_project_pqs_vendor_id_vendors_id_fk": { + "name": "vendor_project_pqs_vendor_id_vendors_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_project_pqs_project_id_projects_id_fk": { + "name": "vendor_project_pqs_project_id_projects_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bidding_projects": { + "name": "bidding_projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "proj_nm": { + "name": "proj_nm", + "type": "varchar(90)", + "primaryKey": false, + "notNull": false + }, + "sector": { + "name": "sector", + "type": "char(1)", + "primaryKey": false, + "notNull": false + }, + "proj_msrm": { + "name": "proj_msrm", + "type": "numeric(3, 0)", + "primaryKey": false, + "notNull": false + }, + "kunnr": { + "name": "kunnr", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "kunnr_nm": { + "name": "kunnr_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "cls_1": { + "name": "cls_1", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "cls1_nm": { + "name": "cls1_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "ptype": { + "name": "ptype", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "ptype_nm": { + "name": "ptype_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_cd": { + "name": "pmodel_cd", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "pmodel_nm": { + "name": "pmodel_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_sz": { + "name": "pmodel_sz", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "pmodel_uom": { + "name": "pmodel_uom", + "type": "char(5)", + "primaryKey": false, + "notNull": false + }, + "txt04": { + "name": "txt04", + "type": "char(4)", + "primaryKey": false, + "notNull": false + }, + "txt30": { + "name": "txt30", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "estm_pm": { + "name": "estm_pm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "bidding_projects_pspid_unique": { + "name": "bidding_projects_pspid_unique", + "nullsNotDistinct": false, + "columns": [ + "pspid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_series": { + "name": "project_series", + "schema": "", + "columns": { + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "sers_no": { + "name": "sers_no", + "type": "char(3)", + "primaryKey": false, + "notNull": true + }, + "sc_dt": { + "name": "sc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "kl_dt": { + "name": "kl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "lc_dt": { + "name": "lc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dl_dt": { + "name": "dl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dock_no": { + "name": "dock_no", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "dock_nm": { + "name": "dock_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "proj_no": { + "name": "proj_no", + "type": "char(24)", + "primaryKey": false, + "notNull": false + }, + "post1": { + "name": "post1", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "project_sersNo_unique": { + "name": "project_sersNo_unique", + "columns": [ + { + "expression": "pspid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sers_no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "project_series_pspid_bidding_projects_pspid_fk": { + "name": "project_series_pspid_bidding_projects_pspid_fk", + "tableFrom": "project_series", + "tableTo": "bidding_projects", + "columnsFrom": [ + "pspid" + ], + "columnsTo": [ + "pspid" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projects": { + "name": "projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cbe_evaluations": { + "name": "cbe_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluated_by": { + "name": "evaluated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluated_at": { + "name": "evaluated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "result": { + "name": "result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "total_cost": { + "name": "total_cost", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_schedule": { + "name": "delivery_schedule", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "cbe_evaluations_rfq_id_rfqs_id_fk": { + "name": "cbe_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_vendor_id_vendors_id_fk": { + "name": "cbe_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_evaluated_by_users_id_fk": { + "name": "cbe_evaluations_evaluated_by_users_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "users", + "columnsFrom": [ + "evaluated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_attachments": { + "name": "rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_attachments_rfq_id_rfqs_id_fk": { + "name": "rfq_attachments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_vendor_id_vendors_id_fk": { + "name": "rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_attachments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_cbe_id_cbe_evaluations_id_fk": { + "name": "rfq_attachments_cbe_id_cbe_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "cbe_evaluations", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_comment_id_rfq_comments_id_fk": { + "name": "rfq_attachments_comment_id_rfq_comments_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_comments": { + "name": "rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "comment_text": { + "name": "comment_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "commented_by": { + "name": "commented_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_comments_rfq_id_rfqs_id_fk": { + "name": "rfq_comments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_vendor_id_vendors_id_fk": { + "name": "rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_commented_by_users_id_fk": { + "name": "rfq_comments_commented_by_users_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "commented_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_comments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_cbe_id_vendor_responses_id_fk": { + "name": "rfq_comments_cbe_id_vendor_responses_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_evaluations": { + "name": "rfq_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "eval_type": { + "name": "eval_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "result": { + "name": "result", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_evaluations_rfq_id_rfqs_id_fk": { + "name": "rfq_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_evaluations_vendor_id_vendors_id_fk": { + "name": "rfq_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_items": { + "name": "rfq_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_items_rfq_id_rfqs_id_fk": { + "name": "rfq_items_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_items", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "rfq_items_item_code_items_item_code_fk": { + "name": "rfq_items_item_code_items_item_code_fk", + "tableFrom": "rfq_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfqs": { + "name": "rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "bid_project_id": { + "name": "bid_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false, + "default": "'PURCHASE'" + }, + "parent_rfq_id": { + "name": "parent_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfqs_project_id_projects_id_fk": { + "name": "rfqs_project_id_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_bid_project_id_bidding_projects_id_fk": { + "name": "rfqs_bid_project_id_bidding_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bid_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_created_by_users_id_fk": { + "name": "rfqs_created_by_users_id_fk", + "tableFrom": "rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_parent_rfq_id_rfqs_id_fk": { + "name": "rfqs_parent_rfq_id_rfqs_id_fk", + "tableFrom": "rfqs", + "tableTo": "rfqs", + "columnsFrom": [ + "parent_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "rfqs_rfq_code_unique": { + "name": "rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_commercial_responses": { + "name": "vendor_commercial_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "total_price": { + "name": "total_price", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_period": { + "name": "delivery_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "warranty_period": { + "name": "warranty_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "validity_period": { + "name": "validity_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "price_breakdown": { + "name": "price_breakdown", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "commercial_notes": { + "name": "commercial_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_commercial_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_commercial_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_commercial_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_attachments": { + "name": "vendor_response_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "technical_response_id": { + "name": "technical_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "commercial_response_id": { + "name": "commercial_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_attachments_response_id_vendor_responses_id_fk": { + "name": "vendor_response_attachments_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk": { + "name": "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_technical_responses", + "columnsFrom": [ + "technical_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk": { + "name": "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_commercial_responses", + "columnsFrom": [ + "commercial_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_responses": { + "name": "vendor_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'REVIEWING'" + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "responded_by": { + "name": "responded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "responded_at": { + "name": "responded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "vendor_response_unique": { + "name": "vendor_response_unique", + "columns": [ + { + "expression": "rfq_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_responses_rfq_id_rfqs_id_fk": { + "name": "vendor_responses_rfq_id_rfqs_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_responses_vendor_id_vendors_id_fk": { + "name": "vendor_responses_vendor_id_vendors_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_technical_responses": { + "name": "vendor_technical_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_technical_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_technical_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_technical_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.otps": { + "name": "otps", + "schema": "", + "columns": { + "email": { + "name": "email", + "type": "varchar(256)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(6)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "otpToken": { + "name": "otpToken", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "otp_expires": { + "name": "otp_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permissions": { + "name": "permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "permissions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "permission_key": { + "name": "permission_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.role_permissions": { + "name": "role_permissions", + "schema": "", + "columns": { + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "permission_id": { + "name": "permission_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "role_permissions_role_id_roles_id_fk": { + "name": "role_permissions_role_id_roles_id_fk", + "tableFrom": "role_permissions", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "role_permissions_permission_id_permissions_id_fk": { + "name": "role_permissions_permission_id_permissions_id_fk", + "tableFrom": "role_permissions", + "tableTo": "permissions", + "columnsFrom": [ + "permission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.roles": { + "name": "roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "roles_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "roles_company_id_vendors_id_fk": { + "name": "roles_company_id_vendors_id_fk", + "tableFrom": "roles", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_roles": { + "name": "user_roles", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_roles_user_id_users_id_fk": { + "name": "user_roles_user_id_users_id_fk", + "tableFrom": "user_roles", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_roles_role_id_roles_id_fk": { + "name": "user_roles_role_id_roles_id_fk", + "tableFrom": "user_roles", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "users_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'partners'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "image_url": { + "name": "image_url", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "language": { + "name": "language", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'en'" + } + }, + "indexes": {}, + "foreignKeys": { + "users_company_id_vendors_id_fk": { + "name": "users_company_id_vendors_id_fk", + "tableFrom": "users", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_entries": { + "name": "form_entries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_entries_contract_item_id_contract_items_id_fk": { + "name": "form_entries_contract_item_id_contract_items_id_fk", + "tableFrom": "form_entries", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_metas": { + "name": "form_metas", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "columns": { + "name": "columns", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_metas_project_id_projects_id_fk": { + "name": "form_metas_project_id_projects_id_fk", + "tableFrom": "form_metas", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "form_code_project_unique": { + "name": "form_code_project_unique", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.forms": { + "name": "forms", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "forms_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "eng": { + "name": "eng", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "im": { + "name": "im", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_item_form_code_unique": { + "name": "contract_item_form_code_unique", + "columns": [ + { + "expression": "contract_item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "form_code", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "forms_contract_item_id_contract_items_id_fk": { + "name": "forms_contract_item_id_contract_items_id_fk", + "tableFrom": "forms", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_class_attributes": { + "name": "tag_class_attributes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_class_attributes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "tag_class_id": { + "name": "tag_class_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "att_id": { + "name": "att_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "def_val": { + "name": "def_val", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uom_id": { + "name": "uom_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "seq": { + "name": "seq", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "tag_class_attributes_seq_idx": { + "name": "tag_class_attributes_seq_idx", + "columns": [ + { + "expression": "seq", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "tag_class_attributes_tag_class_id_tag_classes_id_fk": { + "name": "tag_class_attributes_tag_class_id_tag_classes_id_fk", + "tableFrom": "tag_class_attributes", + "tableTo": "tag_classes", + "columnsFrom": [ + "tag_class_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_att_id_in_tag_class": { + "name": "uniq_att_id_in_tag_class", + "nullsNotDistinct": false, + "columns": [ + "tag_class_id", + "att_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_classes": { + "name": "tag_classes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_classes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_classes_project_id_projects_id_fk": { + "name": "tag_classes_project_id_projects_id_fk", + "tableFrom": "tag_classes", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk": { + "name": "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk", + "tableFrom": "tag_classes", + "tableTo": "tag_types", + "columnsFrom": [ + "tag_type_code", + "project_id" + ], + "columnsTo": [ + "code", + "project_id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_code_in_project": { + "name": "uniq_code_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfield_options": { + "name": "tag_subfield_options", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfield_options_project_id_projects_id_fk": { + "name": "tag_subfield_options_project_id_projects_id_fk", + "tableFrom": "tag_subfield_options", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_attribute_project_code": { + "name": "uniq_attribute_project_code", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "attributes_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfields": { + "name": "tag_subfields", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfields_project_id_projects_id_fk": { + "name": "tag_subfields_project_id_projects_id_fk", + "tableFrom": "tag_subfields", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_tag_type_attribute": { + "name": "uniq_tag_type_attribute", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_code", + "attributes_id" + ] + }, + "uniq_attribute_id_project": { + "name": "uniq_attribute_id_project", + "nullsNotDistinct": false, + "columns": [ + "attributes_id", + "project_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_type_class_form_mappings": { + "name": "tag_type_class_form_mappings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_label": { + "name": "tag_type_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "class_label": { + "name": "class_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "ep": { + "name": "ep", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_mapping_in_project": { + "name": "uniq_mapping_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_label", + "class_label", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_types": { + "name": "tag_types", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_types_project_id_projects_id_fk": { + "name": "tag_types_project_id_projects_id_fk", + "tableFrom": "tag_types", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "tag_types_code_project_id_pk": { + "name": "tag_types_code_project_id_pk", + "columns": [ + "code", + "project_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tags": { + "name": "tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tags_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "tag_type": { + "name": "tag_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "class": { + "name": "class", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tags_contract_item_id_contract_items_id_fk": { + "name": "tags_contract_item_id_contract_items_id_fk", + "tableFrom": "tags", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_form_id_forms_id_fk": { + "name": "tags_form_id_forms_id_fk", + "tableFrom": "tags", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_item_tag_no_unique": { + "name": "contract_item_tag_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_item_id", + "tag_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_data_report_temps": { + "name": "vendor_data_report_temps", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_data_report_temps_contract_item_id_contract_items_id_fk": { + "name": "vendor_data_report_temps_contract_item_id_contract_items_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_data_report_temps_form_id_forms_id_fk": { + "name": "vendor_data_report_temps_form_id_forms_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.change_logs": { + "name": "change_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "changed_fields": { + "name": "changed_fields", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "old_values": { + "name": "old_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "new_values": { + "name": "new_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_name": { + "name": "user_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_synced": { + "name": "is_synced", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "sync_attempts": { + "name": "sync_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_sync_error": { + "name": "last_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "synced_at": { + "name": "synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "target_systems": { + "name": "target_systems", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + } + }, + "indexes": { + "idx_change_logs_contract_synced": { + "name": "idx_change_logs_contract_synced", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_synced", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_created_at": { + "name": "idx_change_logs_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_entity": { + "name": "idx_change_logs_entity", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_sync_attempts": { + "name": "idx_change_logs_sync_attempts", + "columns": [ + { + "expression": "sync_attempts", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.document_attachments": { + "name": "document_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "document_attachments_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "revision_id": { + "name": "revision_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "upload_id": { + "name": "upload_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "file_id": { + "name": "file_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "dolce_file_path": { + "name": "dolce_file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "document_attachments_revision_id_revisions_id_fk": { + "name": "document_attachments_revision_id_revisions_id_fk", + "tableFrom": "document_attachments", + "tableTo": "revisions", + "columnsFrom": [ + "revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.documents": { + "name": "documents", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "documents_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "drawing_move_gbn": { + "name": "drawing_move_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "discipline": { + "name": "discipline", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "external_document_id": { + "name": "external_document_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "external_system_type": { + "name": "external_system_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "external_synced_at": { + "name": "external_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "shi_drawing_no": { + "name": "shi_drawing_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager": { + "name": "manager", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_enm": { + "name": "manager_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_no": { + "name": "manager_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "register_group": { + "name": "register_group", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "register_group_id": { + "name": "register_group_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "create_user_no": { + "name": "create_user_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "create_user_id": { + "name": "create_user_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "create_user_enm": { + "name": "create_user_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_contract_doc_status": { + "name": "unique_contract_doc_status", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_contract_vendor_doc": { + "name": "unique_contract_vendor_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"vendor_doc_number\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_external_doc": { + "name": "unique_external_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_system_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"external_document_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "drawing_kind_idx": { + "name": "drawing_kind_idx", + "columns": [ + { + "expression": "drawing_kind", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "documents_contract_id_contracts_id_fk": { + "name": "documents_contract_id_contracts_id_fk", + "tableFrom": "documents", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.issue_stages": { + "name": "issue_stages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "issue_stages_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_name": { + "name": "stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "plan_date": { + "name": "plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "actual_date": { + "name": "actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "stage_status": { + "name": "stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "stage_order": { + "name": "stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "priority": { + "name": "priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'MEDIUM'" + }, + "assignee_id": { + "name": "assignee_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "assignee_name": { + "name": "assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "reminder_days": { + "name": "reminder_days", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_document_stage": { + "name": "unique_document_stage", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_stage_order": { + "name": "document_stage_order", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "issue_stages_document_id_documents_id_fk": { + "name": "issue_stages_document_id_documents_id_fk", + "tableFrom": "issue_stages", + "tableTo": "documents", + "columnsFrom": [ + "document_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.revisions": { + "name": "revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "revisions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "issue_stage_id": { + "name": "issue_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "revision": { + "name": "revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "uploader_type": { + "name": "uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'vendor'" + }, + "uploader_id": { + "name": "uploader_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploader_name": { + "name": "uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "usage": { + "name": "usage", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "revision_status": { + "name": "revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'SUBMITTED'" + }, + "submitted_date": { + "name": "submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "review_start_date": { + "name": "review_start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "approved_date": { + "name": "approved_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "rejected_date": { + "name": "rejected_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "reviewer_id": { + "name": "reviewer_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "review_comments": { + "name": "review_comments", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "external_upload_id": { + "name": "external_upload_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_stage_rev": { + "name": "unique_stage_rev", + "columns": [ + { + "expression": "issue_stage_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "revision", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_batches": { + "name": "sync_batches", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "batch_size": { + "name": "batch_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "retry_count": { + "name": "retry_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "change_log_ids": { + "name": "change_log_ids", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "success_count": { + "name": "success_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "failure_count": { + "name": "failure_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sync_metadata": { + "name": "sync_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_batches_contract_system": { + "name": "idx_sync_batches_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_status": { + "name": "idx_sync_batches_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_created_at": { + "name": "idx_sync_batches_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_configs": { + "name": "sync_configs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "sync_interval_minutes": { + "name": "sync_interval_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 30 + }, + "last_successful_sync": { + "name": "last_successful_sync", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_sync_attempt": { + "name": "last_sync_attempt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "endpoint_url": { + "name": "endpoint_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "auth_token": { + "name": "auth_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "api_version": { + "name": "api_version", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'v1'" + }, + "max_batch_size": { + "name": "max_batch_size", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 100 + }, + "retry_max_attempts": { + "name": "retry_max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_configs_contract_system": { + "name": "idx_sync_configs_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sync_configs_contract_id_contracts_id_fk": { + "name": "sync_configs_contract_id_contracts_id_fk", + "tableFrom": "sync_configs", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_attachments": { + "name": "vendor_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'GENERAL'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_attachments_vendor_id_vendors_id_fk": { + "name": "vendor_attachments_vendor_id_vendors_id_fk", + "tableFrom": "vendor_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidates": { + "name": "vendor_candidates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidates_vendor_id_vendors_id_fk": { + "name": "vendor_candidates_vendor_id_vendors_id_fk", + "tableFrom": "vendor_candidates", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_contacts": { + "name": "vendor_contacts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contact_name": { + "name": "contact_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_position": { + "name": "contact_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "is_primary": { + "name": "is_primary", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_contacts_vendor_id_vendors_id_fk": { + "name": "vendor_contacts_vendor_id_vendors_id_fk", + "tableFrom": "vendor_contacts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_items": { + "name": "vendor_possible_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_items_vendor_id_vendors_id_fk": { + "name": "vendor_possible_items_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_items_item_code_items_item_code_fk": { + "name": "vendor_possible_items_item_code_items_item_code_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_materials": { + "name": "vendor_possible_materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_materials_vendor_id_vendors_id_fk": { + "name": "vendor_possible_materials_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_materials_item_code_materials_item_code_fk": { + "name": "vendor_possible_materials_item_code_materials_item_code_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "materials", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_types": { + "name": "vendor_types", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_types_code_unique": { + "name": "vendor_types_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors": { + "name": "vendors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "vendor_type_id": { + "name": "vendor_type_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_vendor_type_id_vendor_types_id_fk": { + "name": "vendors_vendor_type_id_vendor_types_id_fk", + "tableFrom": "vendors", + "tableTo": "vendor_types", + "columnsFrom": [ + "vendor_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tasks": { + "name": "tasks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'todo'" + }, + "label": { + "name": "label", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'bug'" + }, + "priority": { + "name": "priority", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'low'" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "current_timestamp" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tasks_code_unique": { + "name": "tasks_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidate_logs": { + "name": "vendor_candidate_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_candidate_id": { + "name": "vendor_candidate_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk": { + "name": "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "vendor_candidates", + "columnsFrom": [ + "vendor_candidate_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_candidate_logs_user_id_users_id_fk": { + "name": "vendor_candidate_logs_user_id_users_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors_logs": { + "name": "vendors_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_logs_vendor_id_vendors_id_fk": { + "name": "vendors_logs_vendor_id_vendors_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendors_logs_user_id_users_id_fk": { + "name": "vendors_logs_user_id_users_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract": { + "name": "basic_contract", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_id": { + "name": "template_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requested_by": { + "name": "requested_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "basic_contract_template_id_basic_contract_templates_id_fk": { + "name": "basic_contract_template_id_basic_contract_templates_id_fk", + "tableFrom": "basic_contract", + "tableTo": "basic_contract_templates", + "columnsFrom": [ + "template_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_vendor_id_vendors_id_fk": { + "name": "basic_contract_vendor_id_vendors_id_fk", + "tableFrom": "basic_contract", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_requested_by_users_id_fk": { + "name": "basic_contract_requested_by_users_id_fk", + "tableFrom": "basic_contract", + "tableTo": "users", + "columnsFrom": [ + "requested_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract_templates": { + "name": "basic_contract_templates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_templates_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_name": { + "name": "template_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "validity_period": { + "name": "validity_period", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.incoterms": { + "name": "incoterms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(20)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "incoterms_created_by_users_id_fk": { + "name": "incoterms_created_by_users_id_fk", + "tableFrom": "incoterms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payment_terms": { + "name": "payment_terms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "payment_terms_created_by_users_id_fk": { + "name": "payment_terms_created_by_users_id_fk", + "tableFrom": "payment_terms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pr_items": { + "name": "pr_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "pr_items", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_attachments": { + "name": "procurement_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "procurement_rfq_details_id": { + "name": "procurement_rfq_details_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk": { + "name": "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfq_details", + "columnsFrom": [ + "procurement_rfq_details_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_created_by_users_id_fk": { + "name": "procurement_attachments_created_by_users_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "attachment_type_check": { + "name": "attachment_type_check", + "value": "\"procurement_attachments\".\"procurement_rfqs_id\" IS NOT NULL OR \"procurement_attachments\".\"procurement_rfq_details_id\" IS NOT NULL" + } + }, + "isRLSEnabled": false + }, + "public.procurement_quotation_items": { + "name": "procurement_quotation_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pr_item_id": { + "name": "pr_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "material_code": { + "name": "material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "uom": { + "name": "uom", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "unit_price": { + "name": "unit_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "vendor_material_code": { + "name": "vendor_material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_material_description": { + "name": "vendor_material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "lead_time_in_days": { + "name": "lead_time_in_days", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_rate": { + "name": "discount_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_amount": { + "name": "discount_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_alternative": { + "name": "is_alternative", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_recommended": { + "name": "is_recommended", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_quotation_items_pr_item_id_pr_items_id_fk": { + "name": "procurement_quotation_items_pr_item_id_pr_items_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "pr_items", + "columnsFrom": [ + "pr_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_attachments": { + "name": "procurement_rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_uploaded_by_users_id_fk": { + "name": "procurement_rfq_attachments_uploaded_by_users_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_comments": { + "name": "procurement_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_comments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_user_id_users_id_fk": { + "name": "procurement_rfq_comments_user_id_users_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_details": { + "name": "procurement_rfq_details", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendors_id": { + "name": "vendors_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'VV'" + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_vendors_id_vendors_id_fk": { + "name": "procurement_rfq_details_vendors_id_vendors_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "vendors", + "columnsFrom": [ + "vendors_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_rfq_details_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_incoterms_code_incoterms_code_fk": { + "name": "procurement_rfq_details_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_updated_by_users_id_fk": { + "name": "procurement_rfq_details_updated_by_users_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfqs": { + "name": "procurement_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "series": { + "name": "series", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "rfq_sealed_yn": { + "name": "rfq_sealed_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfqs_project_id_projects_id_fk": { + "name": "procurement_rfqs_project_id_projects_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_sent_by_users_id_fk": { + "name": "procurement_rfqs_sent_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_created_by_users_id_fk": { + "name": "procurement_rfqs_created_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_updated_by_users_id_fk": { + "name": "procurement_rfqs_updated_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "procurement_rfqs_rfq_code_unique": { + "name": "procurement_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_vendor_quotations": { + "name": "procurement_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_items_count": { + "name": "total_items_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sub_total": { + "name": "sub_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "tax_total": { + "name": "tax_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "discount_total": { + "name": "discount_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "estimated_delivery_date": { + "name": "estimated_delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "procurement_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_incoterms_code_incoterms_code_fk": { + "name": "procurement_vendor_quotations_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.preset_shares": { + "name": "preset_shares", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "preset_id": { + "name": "preset_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "shared_with_user_id": { + "name": "shared_with_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'read'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "preset_shares_preset_id_table_presets_id_fk": { + "name": "preset_shares_preset_id_table_presets_id_fk", + "tableFrom": "preset_shares", + "tableTo": "table_presets", + "columnsFrom": [ + "preset_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_presets": { + "name": "table_presets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_shared": { + "name": "is_shared", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_attachments": { + "name": "tech_sales_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "tech_sales_rfq_id": { + "name": "tech_sales_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "tech_sales_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_attachments_created_by_users_id_fk": { + "name": "tech_sales_attachments_created_by_users_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comment_attachments": { + "name": "tech_sales_rfq_comment_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk": { + "name": "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk": { + "name": "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comments": { + "name": "tech_sales_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_user_id_users_id_fk": { + "name": "tech_sales_rfq_comments_user_id_users_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfqs": { + "name": "tech_sales_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_shipbuilding_id": { + "name": "item_shipbuilding_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "bidding_project_id": { + "name": "bidding_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_snapshot": { + "name": "project_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "series_snapshot": { + "name": "series_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk": { + "name": "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "item_shipbuilding", + "columnsFrom": [ + "item_shipbuilding_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk": { + "name": "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bidding_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_sent_by_users_id_fk": { + "name": "tech_sales_rfqs_sent_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_created_by_users_id_fk": { + "name": "tech_sales_rfqs_created_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_updated_by_users_id_fk": { + "name": "tech_sales_rfqs_updated_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tech_sales_rfqs_rfq_code_unique": { + "name": "tech_sales_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_vendor_quotations": { + "name": "tech_sales_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "tech_sales_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rotation_attempts": { + "name": "ocr_rotation_attempts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "rotation": { + "name": "rotation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "tables_found": { + "name": "tables_found", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "text_quality": { + "name": "text_quality", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "keyword_count": { + "name": "keyword_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "score": { + "name": "score", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "extracted_rows_count": { + "name": "extracted_rows_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_rotation_attempts_session_id_ocr_sessions_id_fk": { + "name": "ocr_rotation_attempts_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rotation_attempts", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rows": { + "name": "ocr_rows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "table_id": { + "name": "table_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "row_index": { + "name": "row_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "report_no": { + "name": "report_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "no": { + "name": "no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "identification_no": { + "name": "identification_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_no": { + "name": "joint_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_type": { + "name": "joint_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "welding_date": { + "name": "welding_date", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "source_table": { + "name": "source_table", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "source_row": { + "name": "source_row", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_ocr_row_unique": { + "name": "idx_ocr_row_unique", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "report_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "ocr_rows_table_id_ocr_tables_id_fk": { + "name": "ocr_rows_table_id_ocr_tables_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_tables", + "columnsFrom": [ + "table_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_session_id_ocr_sessions_id_fk": { + "name": "ocr_rows_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_user_id_users_id_fk": { + "name": "ocr_rows_user_id_users_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_sessions": { + "name": "ocr_sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "processing_time": { + "name": "processing_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "best_rotation": { + "name": "best_rotation", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_tables": { + "name": "total_tables", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_rows": { + "name": "total_rows", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "image_enhanced": { + "name": "image_enhanced", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pdf_converted": { + "name": "pdf_converted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "success": { + "name": "success", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "warnings": { + "name": "warnings", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_tables": { + "name": "ocr_tables", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "table_index": { + "name": "table_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "row_count": { + "name": "row_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_tables_session_id_ocr_sessions_id_fk": { + "name": "ocr_tables_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_tables", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.offshore_hull_work_type": { + "name": "offshore_hull_work_type", + "schema": "public", + "values": [ + "HA", + "HE", + "HH", + "HM", + "NC" + ] + }, + "public.offshore_top_work_type": { + "name": "offshore_top_work_type", + "schema": "public", + "values": [ + "TM", + "TS", + "TE", + "TP" + ] + }, + "public.work_type": { + "name": "work_type", + "schema": "public", + "values": [ + "기장", + "전장", + "선실", + "배관", + "철의" + ] + }, + "public.user_domain": { + "name": "user_domain", + "schema": "public", + "values": [ + "evcp", + "partners" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": { + "public.contracts_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"contracts\".\"id\", \"contracts\".\"contract_no\", \"contracts\".\"contract_name\", \"contracts\".\"status\", \"contracts\".\"start_date\", \"contracts\".\"end_date\", \"contracts\".\"project_id\", \"projects\".\"code\", \"projects\".\"name\", \"contracts\".\"vendor_id\", \"vendors\".\"vendor_name\", \"contracts\".\"payment_terms\", \"contracts\".\"delivery_terms\", \"contracts\".\"delivery_date\", \"contracts\".\"delivery_location\", \"contracts\".\"currency\", \"contracts\".\"total_amount\", \"contracts\".\"discount\", \"contracts\".\"tax\", \"contracts\".\"shipping_fee\", \"contracts\".\"net_total\", \"contracts\".\"partial_shipping_allowed\", \"contracts\".\"partial_payment_allowed\", \"contracts\".\"remarks\", \"contracts\".\"version\", \"contracts\".\"created_at\", \"contracts\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"contracts\".\"id\"\n ) as \"has_signature\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "contracts_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.poa_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", + "name": "poa_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.project_approved_vendors": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"status\", \"vendor_types\".\"name_ko\", \"vendor_types\".\"name_en\", \"projects\".\"code\", \"projects\".\"name\", \"projects\".\"type\", \"vendor_pq_submissions\".\"submitted_at\", \"vendor_pq_submissions\".\"approved_at\" from \"vendors\" inner join \"vendor_pq_submissions\" on \"vendor_pq_submissions\".\"vendor_id\" = \"vendors\".\"id\" inner join \"projects\" on \"vendor_pq_submissions\".\"project_id\" = \"projects\".\"id\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\" where \"vendor_pq_submissions\".\"status\" = 'APPROVED'", + "name": "project_approved_vendors", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_investigations_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"vendor_id\", \"vendor_investigations\".\"pq_submission_id\", \"vendor_investigations\".\"requester_id\", \"vendor_investigations\".\"qm_manager_id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"evaluation_type\", \"vendor_investigations\".\"investigation_address\", \"vendor_investigations\".\"investigation_method\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"forecasted_at\", \"vendor_investigations\".\"requested_at\", \"vendor_investigations\".\"confirmed_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"evaluation_score\", \"vendor_investigations\".\"evaluation_result\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", requester.name as \"requesterName\", requester.email as \"requesterEmail\", qm_manager.name as \"qmManagerName\", qm_manager.email as \"qmManagerEmail\", (\n CASE \n WHEN EXISTS (\n SELECT 1 FROM vendor_investigation_attachments via \n WHERE via.investigation_id = \"vendor_investigations\".\"id\"\n ) \n THEN true \n ELSE false \n END\n ) as \"hasAttachments\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\" left join users AS requester on \"vendor_investigations\".\"requester_id\" = requester.id left join users AS qm_manager on \"vendor_investigations\".\"qm_manager_id\" = qm_manager.id", + "name": "vendor_investigations_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.cbe_view": { + "columns": {}, + "definition": "select \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"rfq_id\" as \"rfq_id\", \"cbe_evaluations\".\"vendor_id\" as \"vendor_id\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"result\" as \"result\", \"cbe_evaluations\".\"notes\" as \"notes\", \"cbe_evaluations\".\"evaluated_by\" as \"evaluated_by\", \"cbe_evaluations\".\"evaluated_at\" as \"evaluated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"name\" as \"evaluator_name\", \"users\".\"email\" as \"evaluator_email\" from \"cbe_evaluations\" inner join \"rfqs\" on \"cbe_evaluations\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"cbe_evaluations\".\"evaluated_by\" = \"users\".\"id\"", + "name": "cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.rfqs_view": { + "columns": {}, + "definition": "select \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"rfqs\".\"parent_rfq_id\" as \"parent_rfq_id\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"email\" as \"user_email\", \"users\".\"name\" as \"user_name\", (\n SELECT COUNT(*) \n FROM \"rfq_items\" \n WHERE \"rfq_items\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"item_count\", (\n SELECT COUNT(*) \n FROM \"rfq_attachments\" \n WHERE \"rfq_attachments\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"attachment_count\" from \"rfqs\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"rfqs\".\"created_by\" = \"users\".\"id\"", + "name": "rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_cbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", \"cbe_evaluations\".\"notes\" as \"cbe_note\", \"cbe_evaluations\".\"updated_at\" as \"cbe_updated\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"delivery_schedule\" as \"delivery_schedule\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_response_cbe_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"notes\" as \"response_notes\", \"vendor_responses\".\"responded_by\" as \"responded_by\", \"vendor_responses\".\"responded_at\" as \"responded_at\", \"vendor_responses\".\"updated_at\" as \"response_updated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"status\" as \"vendor_status\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"response_status\" as \"commercial_response_status\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"vendor_commercial_responses\".\"payment_terms\" as \"payment_terms\", \"vendor_commercial_responses\".\"incoterms\" as \"incoterms\", \"vendor_commercial_responses\".\"delivery_period\" as \"delivery_period\", \"vendor_commercial_responses\".\"warranty_period\" as \"warranty_period\", \"vendor_commercial_responses\".\"validity_period\" as \"validity_period\", \"vendor_commercial_responses\".\"price_breakdown\" as \"price_breakdown\", \"vendor_commercial_responses\".\"commercial_notes\" as \"commercial_notes\", \"vendor_commercial_responses\".\"created_at\" as \"commercial_created_at\", \"vendor_commercial_responses\".\"updated_at\" as \"commercial_updated_at\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"commercial_response_id\" = \"vendor_commercial_responses\".\"id\"\n ) as \"commercial_attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n AND \"vendor_response_attachments\".\"attachment_type\" = 'TECHNICAL_SPEC'\n ) as \"technical_attachment_count\", (\n SELECT MAX(\"uploaded_at\") \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"latest_attachment_date\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\"", + "name": "vendor_response_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_responses_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"created_at\" as \"rfq_created_at\", \"rfqs\".\"updated_at\" as \"rfq_updated_at\", \"rfqs\".\"created_by\" as \"rfq_created_by\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"responded_at\" as \"responded_at\", CASE WHEN \"vendor_technical_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_technical_response\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", CASE WHEN \"vendor_commercial_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_commercial_response\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"rfq_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE') left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"cbe_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\")", + "name": "vendor_responses_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_rfq_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", + "name": "vendor_rfq_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_tbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", \"vendor_technical_responses\".\"response_status\" as \"technical_response_status\", \"vendor_technical_responses\".\"summary\" as \"technical_summary\", \"vendor_technical_responses\".\"notes\" as \"technical_notes\", \"vendor_technical_responses\".\"updated_at\" as \"technical_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"rfq_evaluations\".\"notes\" as \"tbe_note\", \"rfq_evaluations\".\"updated_at\" as \"tbe_updated\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_tbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.role_view": { + "columns": {}, + "definition": "select \"roles\".\"id\" as \"id\", \"roles\".\"name\" as \"name\", \"roles\".\"description\" as \"description\", \"roles\".\"domain\" as \"domain\", \"roles\".\"created_at\" as \"created_at\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", COUNT(\"users\".\"id\") as \"user_count\" from \"roles\" left join \"user_roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" left join \"users\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"vendors\" on \"roles\".\"company_id\" = \"vendors\".\"id\" group by \"roles\".\"id\", \"vendors\".\"id\"", + "name": "role_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.user_view": { + "columns": {}, + "definition": "select \"users\".\"id\" as \"user_id\", \"users\".\"name\" as \"user_name\", \"users\".\"email\" as \"user_email\", \"users\".\"domain\" as \"user_domain\", \"users\".\"image_url\" as \"user_image\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"vendors\" on \"users\".\"company_id\" = \"vendors\".\"id\" left join \"user_roles\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" group by \"users\".\"id\", \"vendors\".\"id\"", + "name": "user_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.form_lists_view": { + "columns": {}, + "definition": "select \"tag_type_class_form_mappings\".\"id\" as \"id\", \"tag_type_class_form_mappings\".\"project_id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"tag_type_class_form_mappings\".\"tag_type_label\" as \"tag_type_label\", \"tag_type_class_form_mappings\".\"class_label\" as \"class_label\", \"tag_type_class_form_mappings\".\"form_code\" as \"form_code\", \"tag_type_class_form_mappings\".\"form_name\" as \"form_name\", \"tag_type_class_form_mappings\".\"ep\" as \"ep\", \"tag_type_class_form_mappings\".\"remark\" as \"remark\", \"tag_type_class_form_mappings\".\"created_at\" as \"created_at\", \"tag_type_class_form_mappings\".\"updated_at\" as \"updated_at\" from \"tag_type_class_form_mappings\" inner join \"projects\" on \"tag_type_class_form_mappings\".\"project_id\" = \"projects\".\"id\"", + "name": "form_lists_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.view_tag_subfields": { + "columns": { + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "definition": "select \"tag_subfields\".\"id\" as \"id\", \"tag_subfields\".\"tag_type_code\", \"tag_types\".\"description\", \"tag_subfields\".\"attributes_id\", \"tag_subfields\".\"attributes_description\", \"tag_subfields\".\"expression\", \"tag_subfields\".\"delimiter\", \"tag_subfields\".\"sort_order\", \"tag_subfields\".\"created_at\", \"tag_subfields\".\"updated_at\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\", \"projects\".\"name\" from \"tag_subfields\" inner join \"tag_types\" on (\"tag_subfields\".\"tag_type_code\" = \"tag_types\".\"code\" and \"tag_subfields\".\"project_id\" = \"tag_types\".\"project_id\") inner join \"projects\" on \"tag_subfields\".\"project_id\" = \"projects\".\"id\"", + "name": "view_tag_subfields", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.document_stages_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_count": { + "name": "stage_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_list": { + "name": "stage_list", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT\n d.id AS document_id,\n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n d.contract_id,\n (SELECT COUNT(*) FROM issue_stages WHERE document_id = d.id) AS stage_count,\n COALESCE( \n (SELECT json_agg(i.stage_name) FROM issue_stages i WHERE i.document_id = d.id), \n '[]'\n ) AS stage_list,\n d.created_at,\n d.updated_at\n FROM documents d\n", + "name": "document_stages_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.enhanced_documents_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_id": { + "name": "current_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_name": { + "name": "current_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_status": { + "name": "current_stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_order": { + "name": "current_stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_plan_date": { + "name": "current_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_actual_date": { + "name": "current_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_assignee_name": { + "name": "current_stage_assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_priority": { + "name": "current_stage_priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "days_until_due": { + "name": "days_until_due", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_overdue": { + "name": "is_overdue", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "days_difference": { + "name": "days_difference", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "total_stages": { + "name": "total_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "completed_stages": { + "name": "completed_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "progress_percentage": { + "name": "progress_percentage", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_status": { + "name": "latest_revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_submitted_date": { + "name": "latest_submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "all_stages": { + "name": "all_stages", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n WITH document_stats AS (\n SELECT \n d.id as document_id,\n COUNT(ist.id) as total_stages,\n COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) as completed_stages,\n CASE \n WHEN COUNT(ist.id) > 0 \n THEN ROUND((COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) * 100.0) / COUNT(ist.id))\n ELSE 0 \n END as progress_percentage\n FROM documents d\n LEFT JOIN issue_stages ist ON d.id = ist.document_id\n GROUP BY d.id\n ),\n current_stage_info AS (\n SELECT DISTINCT ON (document_id)\n document_id,\n id as current_stage_id,\n stage_name as current_stage_name,\n stage_status as current_stage_status,\n stage_order as current_stage_order,\n plan_date as current_stage_plan_date,\n actual_date as current_stage_actual_date,\n assignee_name as current_stage_assignee_name,\n priority as current_stage_priority,\n CASE \n WHEN actual_date IS NULL AND plan_date IS NOT NULL \n THEN plan_date - CURRENT_DATE\n ELSE NULL \n END as days_until_due,\n CASE \n WHEN actual_date IS NULL AND plan_date < CURRENT_DATE \n THEN true\n WHEN actual_date IS NOT NULL AND actual_date > plan_date \n THEN true\n ELSE false \n END as is_overdue,\n CASE \n WHEN actual_date IS NOT NULL AND plan_date IS NOT NULL \n THEN actual_date - plan_date\n ELSE NULL \n END as days_difference\n FROM issue_stages\n WHERE stage_status NOT IN ('COMPLETED', 'APPROVED')\n ORDER BY document_id, stage_order ASC, priority DESC\n ),\n latest_revision_info AS (\n SELECT DISTINCT ON (ist.document_id)\n ist.document_id,\n r.id as latest_revision_id,\n r.revision as latest_revision,\n r.revision_status as latest_revision_status,\n r.uploader_name as latest_revision_uploader_name,\n r.submitted_date as latest_submitted_date\n FROM revisions r\n JOIN issue_stages ist ON r.issue_stage_id = ist.id\n ORDER BY ist.document_id, r.created_at DESC\n ),\n -- 리비전별 첨부파일 집계\n revision_attachments AS (\n SELECT \n r.id as revision_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', da.id,\n 'revisionId', da.revision_id,\n 'fileName', da.file_name,\n 'filePath', da.file_path,\n 'fileSize', da.file_size,\n 'fileType', da.file_type,\n 'createdAt', da.created_at,\n 'updatedAt', da.updated_at\n ) ORDER BY da.created_at\n ) FILTER (WHERE da.id IS NOT NULL),\n '[]'::json\n ) as attachments\n FROM revisions r\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY r.id\n ),\n -- 스테이지별 리비전 집계 (첨부파일 포함)\n stage_revisions AS (\n SELECT \n ist.id as stage_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', r.id,\n 'issueStageId', r.issue_stage_id,\n 'revision', r.revision,\n 'uploaderType', r.uploader_type,\n 'uploaderId', r.uploader_id,\n 'uploaderName', r.uploader_name,\n 'comment', r.comment,\n 'usage', r.usage,\n 'revisionStatus', r.revision_status,\n 'submittedDate', r.submitted_date,\n 'uploadedAt', r.uploaded_at,\n 'approvedDate', r.approved_date,\n 'reviewStartDate', r.review_start_date,\n 'rejectedDate', r.rejected_date,\n 'reviewerId', r.reviewer_id,\n 'reviewerName', r.reviewer_name,\n 'reviewComments', r.review_comments,\n 'createdAt', r.created_at,\n 'updatedAt', r.updated_at,\n 'attachments', ra.attachments\n ) ORDER BY r.created_at\n ) FILTER (WHERE r.id IS NOT NULL),\n '[]'::json\n ) as revisions\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN revision_attachments ra ON r.id = ra.revision_id\n GROUP BY ist.id\n ),\n -- 문서별 스테이지 집계 (리비전 포함)\n stage_aggregation AS (\n SELECT \n ist.document_id,\n json_agg(\n json_build_object(\n 'id', ist.id,\n 'stageName', ist.stage_name,\n 'stageStatus', ist.stage_status,\n 'stageOrder', ist.stage_order,\n 'planDate', ist.plan_date,\n 'actualDate', ist.actual_date,\n 'assigneeName', ist.assignee_name,\n 'priority', ist.priority,\n 'revisions', sr.revisions\n ) ORDER BY ist.stage_order\n ) as all_stages\n FROM issue_stages ist\n LEFT JOIN stage_revisions sr ON ist.id = sr.stage_id\n GROUP BY ist.document_id\n ),\n attachment_counts AS (\n SELECT \n ist.document_id,\n COUNT(da.id) as attachment_count\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY ist.document_id\n )\n \n SELECT \n d.id as document_id,\n d.doc_number,\n d.drawing_kind,\n d.vendor_doc_number, -- ✅ 벤더 문서 번호 추가\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n -- ✅ 프로젝트 및 벤더 정보 추가\n p.code as project_code,\n v.vendor_name as vendor_name,\n v.vendor_code as vendor_code,\n \n -- 현재 스테이지 정보\n csi.current_stage_id,\n csi.current_stage_name,\n csi.current_stage_status,\n csi.current_stage_order,\n csi.current_stage_plan_date,\n csi.current_stage_actual_date,\n csi.current_stage_assignee_name,\n csi.current_stage_priority,\n \n -- 계산 필드\n csi.days_until_due,\n csi.is_overdue,\n csi.days_difference,\n \n -- 진행률 정보\n ds.total_stages,\n ds.completed_stages,\n ds.progress_percentage,\n \n -- 최신 리비전 정보\n lri.latest_revision_id,\n lri.latest_revision,\n lri.latest_revision_status,\n lri.latest_revision_uploader_name,\n lri.latest_submitted_date,\n \n -- 전체 스테이지 (리비전 및 첨부파일 포함)\n COALESCE(sa.all_stages, '[]'::json) as all_stages,\n \n -- 기타\n COALESCE(ac.attachment_count, 0) as attachment_count,\n d.created_at,\n d.updated_at\n \n FROM documents d\n -- ✅ contracts, projects, vendors 테이블 JOIN 추가\n LEFT JOIN contracts c ON d.contract_id = c.id\n LEFT JOIN projects p ON c.project_id = p.id\n LEFT JOIN vendors v ON c.vendor_id = v.id\n \n LEFT JOIN document_stats ds ON d.id = ds.document_id\n LEFT JOIN current_stage_info csi ON d.id = csi.document_id\n LEFT JOIN latest_revision_info lri ON d.id = lri.document_id\n LEFT JOIN stage_aggregation sa ON d.id = sa.document_id\n LEFT JOIN attachment_counts ac ON d.id = ac.document_id\n \n ORDER BY d.created_at DESC\n", + "name": "enhanced_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.sync_status_view": { + "columns": { + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "total_changes": { + "name": "total_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pending_changes": { + "name": "pending_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "synced_changes": { + "name": "synced_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "failed_changes": { + "name": "failed_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "last_sync_at": { + "name": "last_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_sync_at": { + "name": "next_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n WITH change_stats AS (\n SELECT \n cl.contract_id,\n sc.target_system,\n COUNT(*) as total_changes,\n COUNT(CASE WHEN cl.is_synced = false AND cl.sync_attempts < sc.retry_max_attempts THEN 1 END) as pending_changes,\n COUNT(CASE WHEN cl.is_synced = true THEN 1 END) as synced_changes,\n COUNT(CASE WHEN cl.sync_attempts >= sc.retry_max_attempts AND cl.is_synced = false THEN 1 END) as failed_changes,\n MAX(cl.synced_at) as last_sync_at\n FROM change_logs cl\n CROSS JOIN sync_configs sc \n WHERE cl.contract_id = sc.contract_id\n AND (cl.target_systems IS NULL OR cl.target_systems @> to_jsonb(sc.target_system))\n GROUP BY cl.contract_id, sc.target_system\n )\n SELECT \n cs.contract_id,\n cs.target_system,\n COALESCE(cs.total_changes, 0) as total_changes,\n COALESCE(cs.pending_changes, 0) as pending_changes,\n COALESCE(cs.synced_changes, 0) as synced_changes,\n COALESCE(cs.failed_changes, 0) as failed_changes,\n cs.last_sync_at,\n CASE \n WHEN sc.sync_enabled = true AND sc.last_successful_sync IS NOT NULL \n THEN sc.last_successful_sync + (sc.sync_interval_minutes || ' minutes')::interval\n ELSE NULL\n END as next_sync_at,\n sc.sync_enabled\n FROM sync_configs sc\n LEFT JOIN change_stats cs ON sc.contract_id = cs.contract_id AND sc.target_system = cs.target_system\n", + "name": "sync_status_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_documents_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "latest_stage_id": { + "name": "latest_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_stage_name": { + "name": "latest_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_stage_plan_date": { + "name": "latest_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_stage_actual_date": { + "name": "latest_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_type": { + "name": "latest_revision_uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT \n d.id, \n d.doc_number,\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n (SELECT id FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_id,\n (SELECT stage_name FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_name,\n (SELECT plan_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_plan_date,\n (SELECT actual_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_actual_date,\n \n (SELECT r.id FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_id,\n (SELECT r.revision FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision,\n (SELECT r.uploader_type FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_type,\n (SELECT r.uploader_name FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_name,\n \n (SELECT COUNT(*) FROM document_attachments a JOIN revisions r ON a.revision_id = r.id JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id) AS attachment_count,\n \n d.created_at,\n d.updated_at\n FROM documents d\n JOIN contracts c ON d.contract_id = c.id\n ", + "name": "vendor_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_candidates_with_vendor_info": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_candidates\".\"id\", \"vendor_candidates\".\"company_name\", \"vendor_candidates\".\"contact_email\", \"vendor_candidates\".\"contact_phone\", \"vendor_candidates\".\"tax_id\", \"vendor_candidates\".\"address\", \"vendor_candidates\".\"country\", \"vendor_candidates\".\"source\", \"vendor_candidates\".\"status\", \"vendor_candidates\".\"items\", \"vendor_candidates\".\"remark\", \"vendor_candidates\".\"created_at\", \"vendor_candidates\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"created_at\" as \"vendor_created_at\", (\n SELECT l2.\"created_at\"\n FROM \"vendor_candidate_logs\" l2\n WHERE l2.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l2.\"action\" = 'status_change'\n ORDER BY l2.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_at\", (\n SELECT u.\"name\"\n FROM \"users\" u\n JOIN \"vendor_candidate_logs\" l3\n ON l3.\"user_id\" = u.\"id\"\n WHERE l3.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l3.\"action\" = 'status_change'\n ORDER BY l3.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_by\", (\n SELECT l4.\"created_at\"\n FROM \"vendor_candidate_logs\" l4\n WHERE l4.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l4.\"action\" = 'invite_sent'\n ORDER BY l4.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_at\", (\n SELECT u2.\"name\"\n FROM \"users\" u2\n JOIN \"vendor_candidate_logs\" l5\n ON l5.\"user_id\" = u2.\"id\"\n WHERE l5.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l5.\"action\" = 'invite_sent'\n ORDER BY l5.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_by\" from \"vendor_candidates\" left join \"vendors\" on \"vendor_candidates\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "vendor_candidates_with_vendor_info", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"business_size\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"", + "name": "vendor_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", + "name": "vendor_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_materials_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_materials\".\"id\", \"vendor_possible_materials\".\"vendor_id\", \"materials\".\"item_name\", \"materials\".\"item_code\", \"materials\".\"description\", \"materials\".\"unit_of_measure\", \"materials\".\"steel_type\", \"materials\".\"grade_material\", \"vendor_possible_materials\".\"created_at\", \"vendor_possible_materials\".\"updated_at\" from \"vendor_possible_materials\" left join \"materials\" on \"vendor_possible_materials\".\"item_code\" = \"materials\".\"item_code\"", + "name": "vendor_materials_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendors_with_types": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"tax_id\" as \"tax_id\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"phone\" as \"phone\", \"vendors\".\"email\" as \"email\", \"vendors\".\"business_size\" as \"business_size\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"status\", \"vendors\".\"vendor_type_id\" as \"vendor_type_id\", \"vendors\".\"representative_name\" as \"representative_name\", \"vendors\".\"representative_birth\" as \"representative_birth\", \"vendors\".\"representative_email\" as \"representative_email\", \"vendors\".\"representative_phone\" as \"representative_phone\", \"vendors\".\"corporate_registration_number\" as \"corporate_registration_number\", \"vendors\".\"items\" as \"items\", \"vendors\".\"credit_agency\" as \"credit_agency\", \"vendors\".\"credit_rating\" as \"credit_rating\", \"vendors\".\"cash_flow_rating\" as \"cash_flow_rating\", \"vendors\".\"created_at\" as \"created_at\", \"vendors\".\"updated_at\" as \"updated_at\", \"vendor_types\".\"name_ko\" as \"vendor_type_name\", \"vendor_types\".\"name_en\" as \"vendor_type_name_en\", \"vendor_types\".\"code\" as \"vendor_type_code\", \n CASE\n WHEN \"vendors\".\"status\" = 'ACTIVE' THEN '정규업체'\n WHEN \"vendors\".\"status\" IN ('INACTIVE', 'BLACKLISTED', 'REJECTED') THEN ''\n ELSE '잠재업체'\n END\n as \"vendor_category\" from \"vendors\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\"", + "name": "vendors_with_types", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.basic_contract_view": { + "columns": {}, + "definition": "select \"basic_contract\".\"id\" as \"id\", \"basic_contract\".\"template_id\" as \"template_id\", \"basic_contract\".\"vendor_id\" as \"vendor_id\", \"basic_contract\".\"requested_by\" as \"requested_by\", \"basic_contract\".\"status\" as \"basic_contract_status\", \"basic_contract\".\"created_at\" as \"created_at\", \"basic_contract\".\"updated_at\" as \"updated_at\", \"basic_contract\".\"updated_at\" as \"completed_at\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"email\" as \"vendor_email\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"users\".\"name\" as \"user_name\", \"basic_contract_templates\".\"template_name\" as \"template_name\", \"basic_contract_templates\".\"validity_period\" as \"validityPeriod\", \"basic_contract_templates\".\"file_path\" as \"file_path\", \"basic_contract_templates\".\"file_name\" as \"file_name\", \"basic_contract\".\"file_path\" as \"signed_file_path\" from \"basic_contract\" left join \"vendors\" on \"basic_contract\".\"vendor_id\" = \"vendors\".\"id\" left join \"users\" on \"basic_contract\".\"requested_by\" = \"users\".\"id\" left join \"basic_contract_templates\" on \"basic_contract\".\"template_id\" = \"basic_contract_templates\".\"id\"", + "name": "basic_contract_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.pr_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"pr_items\".\"id\", \"pr_items\".\"procurement_rfqs_id\", \"pr_items\".\"rfq_item\", \"pr_items\".\"pr_item\", \"pr_items\".\"pr_no\", \"pr_items\".\"material_code\", \"pr_items\".\"material_category\", \"pr_items\".\"acc\", \"pr_items\".\"material_description\", \"pr_items\".\"size\", \"pr_items\".\"delivery_date\", \"pr_items\".\"quantity\", \"pr_items\".\"uom\", \"pr_items\".\"gross_weight\", \"pr_items\".\"gw_uom\", \"pr_items\".\"spec_no\", \"pr_items\".\"spec_url\", \"pr_items\".\"tracking_no\", \"pr_items\".\"major_yn\", \"pr_items\".\"project_def\", \"pr_items\".\"project_sc\", \"pr_items\".\"project_kl\", \"pr_items\".\"project_lc\", \"pr_items\".\"project_dl\", \"pr_items\".\"remark\", \"procurement_rfqs\".\"rfq_code\", \"procurement_rfqs\".\"item_code\", \"procurement_rfqs\".\"item_name\" from \"pr_items\" left join \"procurement_rfqs\" on \"pr_items\".\"procurement_rfqs_id\" = \"procurement_rfqs\".\"id\"", + "name": "pr_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfq_details_view": { + "columns": {}, + "definition": "select \"rfq_details\".\"id\" as \"detail_id\", \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfqs\".\"item_code\" as \"item_code\", \"rfqs\".\"item_name\" as \"item_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"country\" as \"vendor_country\", \"rfq_details\".\"currency\" as \"currency\", \"payment_terms\".\"code\" as \"payment_terms_code\", \"payment_terms\".\"description\" as \"payment_terms_description\", \"incoterms\".\"code\" as \"incoterms_code\", \"incoterms\".\"description\" as \"incoterms_description\", \"rfq_details\".\"incoterms_detail\" as \"incoterms_detail\", \"rfq_details\".\"delivery_date\" as \"delivery_date\", \"rfq_details\".\"tax_code\" as \"tax_code\", \"rfq_details\".\"place_of_shipping\" as \"place_of_shipping\", \"rfq_details\".\"place_of_destination\" as \"place_of_destination\", \"rfq_details\".\"material_price_related_yn\" as \"material_price_related_yn\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"rfq_details\".\"updated_at\" as \"updated_at\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\"\n ) as \"pr_items_count\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\" \n AND major_yn = true\n ) as \"major_items_count\", (\n SELECT COUNT(*) \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"comment_count\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_comment_date\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\" AND is_vendor_comment = true\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_vendor_comment_date\", (\n SELECT COUNT(*) \n FROM procurement_rfq_attachments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) > 0\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"has_quotation\", (\n SELECT status\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_status\", (\n SELECT total_price\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_total_price\", (\n SELECT quotation_version\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"quotation_version\", (\n SELECT COUNT(DISTINCT quotation_version)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"quotation_version_count\", (\n SELECT created_at\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"last_quotation_date\" from \"procurement_rfq_details\" \"rfq_details\" left join \"procurement_rfqs\" \"rfqs\" on \"rfq_details\".\"procurement_rfqs_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"rfq_details\".\"vendors_id\" = \"vendors\".\"id\" left join \"payment_terms\" on \"rfq_details\".\"payment_terms_code\" = \"payment_terms\".\"code\" left join \"incoterms\" on \"rfq_details\".\"incoterms_code\" = \"incoterms\".\"code\" left join \"users\" \"updated_by_user\" on \"rfq_details\".\"updated_by\" = \"updated_by_user\".\"id\"", + "name": "procurement_rfq_details_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfqs_view": { + "columns": {}, + "definition": "select \"procurement_rfqs\".\"id\" as \"id\", \"procurement_rfqs\".\"rfq_code\" as \"rfq_code\", \"procurement_rfqs\".\"series\" as \"series\", \"procurement_rfqs\".\"rfq_sealed_yn\" as \"rfq_sealed_yn\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"procurement_rfqs\".\"item_code\" as \"item_code\", \"procurement_rfqs\".\"item_name\" as \"item_name\", \"procurement_rfqs\".\"status\" as \"status\", \"procurement_rfqs\".\"pic_code\" as \"pic_code\", \"procurement_rfqs\".\"rfq_send_date\" as \"rfq_send_date\", \"procurement_rfqs\".\"due_date\" as \"due_date\", (\n SELECT MIN(submitted_at)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"procurement_rfqs\".\"id\"\n AND submitted_at IS NOT NULL\n ) as \"earliest_quotation_submitted_at\", \"created_by_user\".\"name\" as \"created_by_user_name\", \"sent_by_user\".\"name\" as \"sent_by_user_name\", \"procurement_rfqs\".\"updated_at\" as \"updated_at\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"procurement_rfqs\".\"remark\" as \"remark\", (\n SELECT material_code \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"major_item_material_code\", (\n SELECT pr_no \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"po_no\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n ) as \"pr_items_count\" from \"procurement_rfqs\" left join \"projects\" on \"procurement_rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" \"created_by_user\" on \"procurement_rfqs\".\"created_by\" = \"created_by_user\".\"id\" left join \"users\" \"updated_by_user\" on \"procurement_rfqs\".\"updated_by\" = \"updated_by_user\".\"id\" left join \"users\" \"sent_by_user\" on \"procurement_rfqs\".\"sent_by\" = \"sent_by_user\".\"id\"", + "name": "procurement_rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + } + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db/migrations/meta/0117_snapshot.json b/db/migrations/meta/0117_snapshot.json new file mode 100644 index 00000000..73f6e712 --- /dev/null +++ b/db/migrations/meta/0117_snapshot.json @@ -0,0 +1,12046 @@ +{ + "id": "b05fff1c-bfe7-41d7-801e-d8f2ade806ee", + "prevId": "9dfe8279-40e2-4c3f-8565-b8733860d0cd", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.companies": { + "name": "companies", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "companies_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "taxID": { + "name": "taxID", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_envelopes": { + "name": "contract_envelopes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_envelopes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "envelope_id": { + "name": "envelope_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": true + }, + "document_id": { + "name": "document_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": false + }, + "envelope_status": { + "name": "envelope_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_envelopes_contract_id_contracts_id_fk": { + "name": "contract_envelopes_contract_id_contracts_id_fk", + "tableFrom": "contract_envelopes", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_items": { + "name": "contract_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_items_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_id": { + "name": "item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "unit_price": { + "name": "unit_price", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "total_line_amount": { + "name": "total_line_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_items_contract_item_idx": { + "name": "contract_items_contract_item_idx", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "contract_items_contract_id_contracts_id_fk": { + "name": "contract_items_contract_id_contracts_id_fk", + "tableFrom": "contract_items", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_items_item_id_items_id_fk": { + "name": "contract_items_item_id_items_id_fk", + "tableFrom": "contract_items", + "tableTo": "items", + "columnsFrom": [ + "item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_items_contract_id_item_id_unique": { + "name": "contract_items_contract_id_item_id_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_id", + "item_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_signers": { + "name": "contract_signers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_signers_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "envelope_id": { + "name": "envelope_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_contact_id": { + "name": "vendor_contact_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "signer_type": { + "name": "signer_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'VENDOR'" + }, + "signer_email": { + "name": "signer_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "signer_name": { + "name": "signer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "signer_position": { + "name": "signer_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "signer_status": { + "name": "signer_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "signed_at": { + "name": "signed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_signers_envelope_id_contract_envelopes_id_fk": { + "name": "contract_signers_envelope_id_contract_envelopes_id_fk", + "tableFrom": "contract_signers", + "tableTo": "contract_envelopes", + "columnsFrom": [ + "envelope_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_signers_vendor_contact_id_vendor_contacts_id_fk": { + "name": "contract_signers_vendor_contact_id_vendor_contacts_id_fk", + "tableFrom": "contract_signers", + "tableTo": "vendor_contacts", + "columnsFrom": [ + "vendor_contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contracts": { + "name": "contracts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contracts_project_id_projects_id_fk": { + "name": "contracts_project_id_projects_id_fk", + "tableFrom": "contracts", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contracts_vendor_id_vendors_id_fk": { + "name": "contracts_vendor_id_vendors_id_fk", + "tableFrom": "contracts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contracts_contract_no_unique": { + "name": "contracts_contract_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.poa": { + "name": "poa", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "original_contract_no": { + "name": "original_contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "original_contract_name": { + "name": "original_contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_status": { + "name": "original_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "poa_original_contract_no_contracts_contract_no_fk": { + "name": "poa_original_contract_no_contracts_contract_no_fk", + "tableFrom": "poa", + "tableTo": "contracts", + "columnsFrom": [ + "original_contract_no" + ], + "columnsTo": [ + "contract_no" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_project_id_projects_id_fk": { + "name": "poa_project_id_projects_id_fk", + "tableFrom": "poa", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_vendor_id_vendors_id_fk": { + "name": "poa_vendor_id_vendors_id_fk", + "tableFrom": "poa", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_hull": { + "name": "item_offshore_hull", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_hull_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_hull_item_code_items_item_code_fk": { + "name": "item_offshore_hull_item_code_items_item_code_fk", + "tableFrom": "item_offshore_hull", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_top": { + "name": "item_offshore_top", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_top_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_top_item_code_items_item_code_fk": { + "name": "item_offshore_top_item_code_items_item_code_fk", + "tableFrom": "item_offshore_top", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_shipbuilding": { + "name": "item_shipbuilding", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ship_types": { + "name": "ship_types", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'OPTION'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_shipbuilding_item_code_items_item_code_fk": { + "name": "item_shipbuilding_item_code_items_item_code_fk", + "tableFrom": "item_shipbuilding", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.items": { + "name": "items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_no": { + "name": "project_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "package_code": { + "name": "package_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "sm_code": { + "name": "sm_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "items_item_code_unique": { + "name": "items_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.materials": { + "name": "materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "materials_item_code_unique": { + "name": "materials_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias": { + "name": "pq_criterias", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "check_point": { + "name": "check_point", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "group_name": { + "name": "group_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias_extension": { + "name": "pq_criterias_extension", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_criteria_id": { + "name": "pq_criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_info": { + "name": "contract_info", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "additional_requirement": { + "name": "additional_requirement", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk": { + "name": "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "pq_criterias", + "columnsFrom": [ + "pq_criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "pq_criterias_extension_project_id_projects_id_fk": { + "name": "pq_criterias_extension_project_id_projects_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_criteria_attachments": { + "name": "vendor_criteria_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_criteria_answer_id": { + "name": "vendor_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_criteria_attachments", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigation_attachments": { + "name": "vendor_investigation_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "investigation_id": { + "name": "investigation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'REPORT'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { + "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", + "tableFrom": "vendor_investigation_attachments", + "tableTo": "vendor_investigations", + "columnsFrom": [ + "investigation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigations": { + "name": "vendor_investigations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigations_vendor_id_vendors_id_fk": { + "name": "vendor_investigations_vendor_id_vendors_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk": { + "name": "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendor_pq_submissions", + "columnsFrom": [ + "pq_submission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "vendor_investigations_requester_id_users_id_fk": { + "name": "vendor_investigations_requester_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_qm_manager_id_users_id_fk": { + "name": "vendor_investigations_qm_manager_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "qm_manager_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_submissions": { + "name": "vendor_pq_submissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_number": { + "name": "pq_number", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_pq_submission": { + "name": "unique_pq_submission", + "columns": [ + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_pq_submissions_requester_id_users_id_fk": { + "name": "vendor_pq_submissions_requester_id_users_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_pq_submissions_vendor_id_vendors_id_fk": { + "name": "vendor_pq_submissions_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_submissions_project_id_projects_id_fk": { + "name": "vendor_pq_submissions_project_id_projects_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_pq_submissions_pq_number_unique": { + "name": "vendor_pq_submissions_pq_number_unique", + "nullsNotDistinct": false, + "columns": [ + "pq_number" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_criteria_answers": { + "name": "vendor_pq_criteria_answers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "criteria_id": { + "name": "criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "answer": { + "name": "answer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_criteria_answers_vendor_id_vendors_id_fk": { + "name": "vendor_pq_criteria_answers_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": { + "name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "pq_criterias", + "columnsFrom": [ + "criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_project_id_projects_id_fk": { + "name": "vendor_pq_criteria_answers_project_id_projects_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_review_logs": { + "name": "vendor_pq_review_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_pq_criteria_answer_id": { + "name": "vendor_pq_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "reviewer_comment": { + "name": "reviewer_comment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_pq_review_logs", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_pq_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_project_pqs": { + "name": "vendor_project_pqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_project_pqs_vendor_id_vendors_id_fk": { + "name": "vendor_project_pqs_vendor_id_vendors_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_project_pqs_project_id_projects_id_fk": { + "name": "vendor_project_pqs_project_id_projects_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bidding_projects": { + "name": "bidding_projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "proj_nm": { + "name": "proj_nm", + "type": "varchar(90)", + "primaryKey": false, + "notNull": false + }, + "sector": { + "name": "sector", + "type": "char(1)", + "primaryKey": false, + "notNull": false + }, + "proj_msrm": { + "name": "proj_msrm", + "type": "numeric(3, 0)", + "primaryKey": false, + "notNull": false + }, + "kunnr": { + "name": "kunnr", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "kunnr_nm": { + "name": "kunnr_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "cls_1": { + "name": "cls_1", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "cls1_nm": { + "name": "cls1_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "ptype": { + "name": "ptype", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "ptype_nm": { + "name": "ptype_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_cd": { + "name": "pmodel_cd", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "pmodel_nm": { + "name": "pmodel_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_sz": { + "name": "pmodel_sz", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "pmodel_uom": { + "name": "pmodel_uom", + "type": "char(5)", + "primaryKey": false, + "notNull": false + }, + "txt04": { + "name": "txt04", + "type": "char(4)", + "primaryKey": false, + "notNull": false + }, + "txt30": { + "name": "txt30", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "estm_pm": { + "name": "estm_pm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "bidding_projects_pspid_unique": { + "name": "bidding_projects_pspid_unique", + "nullsNotDistinct": false, + "columns": [ + "pspid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_series": { + "name": "project_series", + "schema": "", + "columns": { + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "sers_no": { + "name": "sers_no", + "type": "char(3)", + "primaryKey": false, + "notNull": true + }, + "sc_dt": { + "name": "sc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "kl_dt": { + "name": "kl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "lc_dt": { + "name": "lc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dl_dt": { + "name": "dl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dock_no": { + "name": "dock_no", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "dock_nm": { + "name": "dock_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "proj_no": { + "name": "proj_no", + "type": "char(24)", + "primaryKey": false, + "notNull": false + }, + "post1": { + "name": "post1", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "project_sersNo_unique": { + "name": "project_sersNo_unique", + "columns": [ + { + "expression": "pspid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sers_no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "project_series_pspid_bidding_projects_pspid_fk": { + "name": "project_series_pspid_bidding_projects_pspid_fk", + "tableFrom": "project_series", + "tableTo": "bidding_projects", + "columnsFrom": [ + "pspid" + ], + "columnsTo": [ + "pspid" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projects": { + "name": "projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cbe_evaluations": { + "name": "cbe_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluated_by": { + "name": "evaluated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluated_at": { + "name": "evaluated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "result": { + "name": "result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "total_cost": { + "name": "total_cost", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_schedule": { + "name": "delivery_schedule", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "cbe_evaluations_rfq_id_rfqs_id_fk": { + "name": "cbe_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_vendor_id_vendors_id_fk": { + "name": "cbe_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_evaluated_by_users_id_fk": { + "name": "cbe_evaluations_evaluated_by_users_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "users", + "columnsFrom": [ + "evaluated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_attachments": { + "name": "rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_attachments_rfq_id_rfqs_id_fk": { + "name": "rfq_attachments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_vendor_id_vendors_id_fk": { + "name": "rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_attachments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_cbe_id_cbe_evaluations_id_fk": { + "name": "rfq_attachments_cbe_id_cbe_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "cbe_evaluations", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_comment_id_rfq_comments_id_fk": { + "name": "rfq_attachments_comment_id_rfq_comments_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_comments": { + "name": "rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "comment_text": { + "name": "comment_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "commented_by": { + "name": "commented_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_comments_rfq_id_rfqs_id_fk": { + "name": "rfq_comments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_vendor_id_vendors_id_fk": { + "name": "rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_commented_by_users_id_fk": { + "name": "rfq_comments_commented_by_users_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "commented_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_comments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_cbe_id_vendor_responses_id_fk": { + "name": "rfq_comments_cbe_id_vendor_responses_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_evaluations": { + "name": "rfq_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "eval_type": { + "name": "eval_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "result": { + "name": "result", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_evaluations_rfq_id_rfqs_id_fk": { + "name": "rfq_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_evaluations_vendor_id_vendors_id_fk": { + "name": "rfq_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_items": { + "name": "rfq_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_items_rfq_id_rfqs_id_fk": { + "name": "rfq_items_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_items", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "rfq_items_item_code_items_item_code_fk": { + "name": "rfq_items_item_code_items_item_code_fk", + "tableFrom": "rfq_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfqs": { + "name": "rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "bid_project_id": { + "name": "bid_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false, + "default": "'PURCHASE'" + }, + "parent_rfq_id": { + "name": "parent_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfqs_project_id_projects_id_fk": { + "name": "rfqs_project_id_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_bid_project_id_bidding_projects_id_fk": { + "name": "rfqs_bid_project_id_bidding_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bid_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_created_by_users_id_fk": { + "name": "rfqs_created_by_users_id_fk", + "tableFrom": "rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_parent_rfq_id_rfqs_id_fk": { + "name": "rfqs_parent_rfq_id_rfqs_id_fk", + "tableFrom": "rfqs", + "tableTo": "rfqs", + "columnsFrom": [ + "parent_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "rfqs_rfq_code_unique": { + "name": "rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_commercial_responses": { + "name": "vendor_commercial_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "total_price": { + "name": "total_price", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_period": { + "name": "delivery_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "warranty_period": { + "name": "warranty_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "validity_period": { + "name": "validity_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "price_breakdown": { + "name": "price_breakdown", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "commercial_notes": { + "name": "commercial_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_commercial_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_commercial_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_commercial_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_attachments": { + "name": "vendor_response_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "technical_response_id": { + "name": "technical_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "commercial_response_id": { + "name": "commercial_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_attachments_response_id_vendor_responses_id_fk": { + "name": "vendor_response_attachments_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk": { + "name": "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_technical_responses", + "columnsFrom": [ + "technical_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk": { + "name": "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_commercial_responses", + "columnsFrom": [ + "commercial_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_responses": { + "name": "vendor_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'REVIEWING'" + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "responded_by": { + "name": "responded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "responded_at": { + "name": "responded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "vendor_response_unique": { + "name": "vendor_response_unique", + "columns": [ + { + "expression": "rfq_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_responses_rfq_id_rfqs_id_fk": { + "name": "vendor_responses_rfq_id_rfqs_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_responses_vendor_id_vendors_id_fk": { + "name": "vendor_responses_vendor_id_vendors_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_technical_responses": { + "name": "vendor_technical_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_technical_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_technical_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_technical_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.otps": { + "name": "otps", + "schema": "", + "columns": { + "email": { + "name": "email", + "type": "varchar(256)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(6)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "otpToken": { + "name": "otpToken", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "otp_expires": { + "name": "otp_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permissions": { + "name": "permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "permissions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "permission_key": { + "name": "permission_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.role_permissions": { + "name": "role_permissions", + "schema": "", + "columns": { + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "permission_id": { + "name": "permission_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "role_permissions_role_id_roles_id_fk": { + "name": "role_permissions_role_id_roles_id_fk", + "tableFrom": "role_permissions", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "role_permissions_permission_id_permissions_id_fk": { + "name": "role_permissions_permission_id_permissions_id_fk", + "tableFrom": "role_permissions", + "tableTo": "permissions", + "columnsFrom": [ + "permission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.roles": { + "name": "roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "roles_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "roles_company_id_vendors_id_fk": { + "name": "roles_company_id_vendors_id_fk", + "tableFrom": "roles", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_roles": { + "name": "user_roles", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_roles_user_id_users_id_fk": { + "name": "user_roles_user_id_users_id_fk", + "tableFrom": "user_roles", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_roles_role_id_roles_id_fk": { + "name": "user_roles_role_id_roles_id_fk", + "tableFrom": "user_roles", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "users_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'partners'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "image_url": { + "name": "image_url", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "language": { + "name": "language", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'en'" + } + }, + "indexes": {}, + "foreignKeys": { + "users_company_id_vendors_id_fk": { + "name": "users_company_id_vendors_id_fk", + "tableFrom": "users", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_entries": { + "name": "form_entries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_entries_contract_item_id_contract_items_id_fk": { + "name": "form_entries_contract_item_id_contract_items_id_fk", + "tableFrom": "form_entries", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_metas": { + "name": "form_metas", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "columns": { + "name": "columns", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_metas_project_id_projects_id_fk": { + "name": "form_metas_project_id_projects_id_fk", + "tableFrom": "form_metas", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "form_code_project_unique": { + "name": "form_code_project_unique", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.forms": { + "name": "forms", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "forms_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "eng": { + "name": "eng", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "im": { + "name": "im", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_item_form_code_unique": { + "name": "contract_item_form_code_unique", + "columns": [ + { + "expression": "contract_item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "form_code", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "forms_contract_item_id_contract_items_id_fk": { + "name": "forms_contract_item_id_contract_items_id_fk", + "tableFrom": "forms", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_class_attributes": { + "name": "tag_class_attributes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_class_attributes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "tag_class_id": { + "name": "tag_class_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "att_id": { + "name": "att_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "def_val": { + "name": "def_val", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uom_id": { + "name": "uom_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "seq": { + "name": "seq", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "tag_class_attributes_seq_idx": { + "name": "tag_class_attributes_seq_idx", + "columns": [ + { + "expression": "seq", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "tag_class_attributes_tag_class_id_tag_classes_id_fk": { + "name": "tag_class_attributes_tag_class_id_tag_classes_id_fk", + "tableFrom": "tag_class_attributes", + "tableTo": "tag_classes", + "columnsFrom": [ + "tag_class_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_att_id_in_tag_class": { + "name": "uniq_att_id_in_tag_class", + "nullsNotDistinct": false, + "columns": [ + "tag_class_id", + "att_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_classes": { + "name": "tag_classes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_classes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_classes_project_id_projects_id_fk": { + "name": "tag_classes_project_id_projects_id_fk", + "tableFrom": "tag_classes", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk": { + "name": "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk", + "tableFrom": "tag_classes", + "tableTo": "tag_types", + "columnsFrom": [ + "tag_type_code", + "project_id" + ], + "columnsTo": [ + "code", + "project_id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_code_in_project": { + "name": "uniq_code_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfield_options": { + "name": "tag_subfield_options", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfield_options_project_id_projects_id_fk": { + "name": "tag_subfield_options_project_id_projects_id_fk", + "tableFrom": "tag_subfield_options", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_attribute_project_code": { + "name": "uniq_attribute_project_code", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "attributes_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfields": { + "name": "tag_subfields", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfields_project_id_projects_id_fk": { + "name": "tag_subfields_project_id_projects_id_fk", + "tableFrom": "tag_subfields", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_tag_type_attribute": { + "name": "uniq_tag_type_attribute", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_code", + "attributes_id" + ] + }, + "uniq_attribute_id_project": { + "name": "uniq_attribute_id_project", + "nullsNotDistinct": false, + "columns": [ + "attributes_id", + "project_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_type_class_form_mappings": { + "name": "tag_type_class_form_mappings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_label": { + "name": "tag_type_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "class_label": { + "name": "class_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "ep": { + "name": "ep", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_mapping_in_project": { + "name": "uniq_mapping_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_label", + "class_label", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_types": { + "name": "tag_types", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_types_project_id_projects_id_fk": { + "name": "tag_types_project_id_projects_id_fk", + "tableFrom": "tag_types", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "tag_types_code_project_id_pk": { + "name": "tag_types_code_project_id_pk", + "columns": [ + "code", + "project_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tags": { + "name": "tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tags_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "tag_type": { + "name": "tag_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "class": { + "name": "class", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tags_contract_item_id_contract_items_id_fk": { + "name": "tags_contract_item_id_contract_items_id_fk", + "tableFrom": "tags", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_form_id_forms_id_fk": { + "name": "tags_form_id_forms_id_fk", + "tableFrom": "tags", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_item_tag_no_unique": { + "name": "contract_item_tag_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_item_id", + "tag_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_data_report_temps": { + "name": "vendor_data_report_temps", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_data_report_temps_contract_item_id_contract_items_id_fk": { + "name": "vendor_data_report_temps_contract_item_id_contract_items_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_data_report_temps_form_id_forms_id_fk": { + "name": "vendor_data_report_temps_form_id_forms_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.change_logs": { + "name": "change_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "changed_fields": { + "name": "changed_fields", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "old_values": { + "name": "old_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "new_values": { + "name": "new_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_name": { + "name": "user_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_synced": { + "name": "is_synced", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "sync_attempts": { + "name": "sync_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_sync_error": { + "name": "last_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "synced_at": { + "name": "synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "target_systems": { + "name": "target_systems", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + } + }, + "indexes": { + "idx_change_logs_contract_synced": { + "name": "idx_change_logs_contract_synced", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_synced", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_created_at": { + "name": "idx_change_logs_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_entity": { + "name": "idx_change_logs_entity", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_sync_attempts": { + "name": "idx_change_logs_sync_attempts", + "columns": [ + { + "expression": "sync_attempts", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.document_attachments": { + "name": "document_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "document_attachments_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "revision_id": { + "name": "revision_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "upload_id": { + "name": "upload_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "file_id": { + "name": "file_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "dolce_file_path": { + "name": "dolce_file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "document_attachments_revision_id_revisions_id_fk": { + "name": "document_attachments_revision_id_revisions_id_fk", + "tableFrom": "document_attachments", + "tableTo": "revisions", + "columnsFrom": [ + "revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.documents": { + "name": "documents", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "documents_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "drawing_move_gbn": { + "name": "drawing_move_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "discipline": { + "name": "discipline", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "external_document_id": { + "name": "external_document_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "external_system_type": { + "name": "external_system_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "external_synced_at": { + "name": "external_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "shi_drawing_no": { + "name": "shi_drawing_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager": { + "name": "manager", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_enm": { + "name": "manager_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_no": { + "name": "manager_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "register_group": { + "name": "register_group", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "register_group_id": { + "name": "register_group_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "create_user_no": { + "name": "create_user_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "create_user_id": { + "name": "create_user_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "create_user_enm": { + "name": "create_user_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_contract_doc_status": { + "name": "unique_contract_doc_status", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_contract_vendor_doc": { + "name": "unique_contract_vendor_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"vendor_doc_number\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_external_doc": { + "name": "unique_external_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_system_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"external_document_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "drawing_kind_idx": { + "name": "drawing_kind_idx", + "columns": [ + { + "expression": "drawing_kind", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "documents_contract_id_contracts_id_fk": { + "name": "documents_contract_id_contracts_id_fk", + "tableFrom": "documents", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.issue_stages": { + "name": "issue_stages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "issue_stages_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_name": { + "name": "stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "plan_date": { + "name": "plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "actual_date": { + "name": "actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "stage_status": { + "name": "stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "stage_order": { + "name": "stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "priority": { + "name": "priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'MEDIUM'" + }, + "assignee_id": { + "name": "assignee_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "assignee_name": { + "name": "assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "reminder_days": { + "name": "reminder_days", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_document_stage": { + "name": "unique_document_stage", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_stage_order": { + "name": "document_stage_order", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "issue_stages_document_id_documents_id_fk": { + "name": "issue_stages_document_id_documents_id_fk", + "tableFrom": "issue_stages", + "tableTo": "documents", + "columnsFrom": [ + "document_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.revisions": { + "name": "revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "revisions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "issue_stage_id": { + "name": "issue_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "revision": { + "name": "revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "uploader_type": { + "name": "uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'vendor'" + }, + "uploader_id": { + "name": "uploader_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploader_name": { + "name": "uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "usage": { + "name": "usage", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "revision_status": { + "name": "revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'SUBMITTED'" + }, + "submitted_date": { + "name": "submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "review_start_date": { + "name": "review_start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "approved_date": { + "name": "approved_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "rejected_date": { + "name": "rejected_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "reviewer_id": { + "name": "reviewer_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "review_comments": { + "name": "review_comments", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "external_upload_id": { + "name": "external_upload_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_stage_rev": { + "name": "unique_stage_rev", + "columns": [ + { + "expression": "issue_stage_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "revision", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_batches": { + "name": "sync_batches", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "batch_size": { + "name": "batch_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "retry_count": { + "name": "retry_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "change_log_ids": { + "name": "change_log_ids", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "success_count": { + "name": "success_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "failure_count": { + "name": "failure_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sync_metadata": { + "name": "sync_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_batches_contract_system": { + "name": "idx_sync_batches_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_status": { + "name": "idx_sync_batches_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_created_at": { + "name": "idx_sync_batches_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_configs": { + "name": "sync_configs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "sync_interval_minutes": { + "name": "sync_interval_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 30 + }, + "last_successful_sync": { + "name": "last_successful_sync", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_sync_attempt": { + "name": "last_sync_attempt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "endpoint_url": { + "name": "endpoint_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "auth_token": { + "name": "auth_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "api_version": { + "name": "api_version", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'v1'" + }, + "max_batch_size": { + "name": "max_batch_size", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 100 + }, + "retry_max_attempts": { + "name": "retry_max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_configs_contract_system": { + "name": "idx_sync_configs_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sync_configs_contract_id_contracts_id_fk": { + "name": "sync_configs_contract_id_contracts_id_fk", + "tableFrom": "sync_configs", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_attachments": { + "name": "vendor_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'GENERAL'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_attachments_vendor_id_vendors_id_fk": { + "name": "vendor_attachments_vendor_id_vendors_id_fk", + "tableFrom": "vendor_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidates": { + "name": "vendor_candidates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidates_vendor_id_vendors_id_fk": { + "name": "vendor_candidates_vendor_id_vendors_id_fk", + "tableFrom": "vendor_candidates", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_contacts": { + "name": "vendor_contacts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contact_name": { + "name": "contact_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_position": { + "name": "contact_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "is_primary": { + "name": "is_primary", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_contacts_vendor_id_vendors_id_fk": { + "name": "vendor_contacts_vendor_id_vendors_id_fk", + "tableFrom": "vendor_contacts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_items": { + "name": "vendor_possible_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_items_vendor_id_vendors_id_fk": { + "name": "vendor_possible_items_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_items_item_code_items_item_code_fk": { + "name": "vendor_possible_items_item_code_items_item_code_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_materials": { + "name": "vendor_possible_materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_materials_vendor_id_vendors_id_fk": { + "name": "vendor_possible_materials_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_materials_item_code_materials_item_code_fk": { + "name": "vendor_possible_materials_item_code_materials_item_code_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "materials", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_types": { + "name": "vendor_types", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_types_code_unique": { + "name": "vendor_types_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors": { + "name": "vendors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "vendor_type_id": { + "name": "vendor_type_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_vendor_type_id_vendor_types_id_fk": { + "name": "vendors_vendor_type_id_vendor_types_id_fk", + "tableFrom": "vendors", + "tableTo": "vendor_types", + "columnsFrom": [ + "vendor_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tasks": { + "name": "tasks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'todo'" + }, + "label": { + "name": "label", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'bug'" + }, + "priority": { + "name": "priority", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'low'" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "current_timestamp" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tasks_code_unique": { + "name": "tasks_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidate_logs": { + "name": "vendor_candidate_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_candidate_id": { + "name": "vendor_candidate_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk": { + "name": "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "vendor_candidates", + "columnsFrom": [ + "vendor_candidate_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_candidate_logs_user_id_users_id_fk": { + "name": "vendor_candidate_logs_user_id_users_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors_logs": { + "name": "vendors_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_logs_vendor_id_vendors_id_fk": { + "name": "vendors_logs_vendor_id_vendors_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendors_logs_user_id_users_id_fk": { + "name": "vendors_logs_user_id_users_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract": { + "name": "basic_contract", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_id": { + "name": "template_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requested_by": { + "name": "requested_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "basic_contract_template_id_basic_contract_templates_id_fk": { + "name": "basic_contract_template_id_basic_contract_templates_id_fk", + "tableFrom": "basic_contract", + "tableTo": "basic_contract_templates", + "columnsFrom": [ + "template_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_vendor_id_vendors_id_fk": { + "name": "basic_contract_vendor_id_vendors_id_fk", + "tableFrom": "basic_contract", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_requested_by_users_id_fk": { + "name": "basic_contract_requested_by_users_id_fk", + "tableFrom": "basic_contract", + "tableTo": "users", + "columnsFrom": [ + "requested_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract_templates": { + "name": "basic_contract_templates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_templates_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_name": { + "name": "template_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "validity_period": { + "name": "validity_period", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.incoterms": { + "name": "incoterms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(20)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "incoterms_created_by_users_id_fk": { + "name": "incoterms_created_by_users_id_fk", + "tableFrom": "incoterms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payment_terms": { + "name": "payment_terms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "payment_terms_created_by_users_id_fk": { + "name": "payment_terms_created_by_users_id_fk", + "tableFrom": "payment_terms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pr_items": { + "name": "pr_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "pr_items", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_attachments": { + "name": "procurement_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "procurement_rfq_details_id": { + "name": "procurement_rfq_details_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk": { + "name": "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfq_details", + "columnsFrom": [ + "procurement_rfq_details_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_created_by_users_id_fk": { + "name": "procurement_attachments_created_by_users_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "attachment_type_check": { + "name": "attachment_type_check", + "value": "\"procurement_attachments\".\"procurement_rfqs_id\" IS NOT NULL OR \"procurement_attachments\".\"procurement_rfq_details_id\" IS NOT NULL" + } + }, + "isRLSEnabled": false + }, + "public.procurement_quotation_items": { + "name": "procurement_quotation_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pr_item_id": { + "name": "pr_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "material_code": { + "name": "material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "uom": { + "name": "uom", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "unit_price": { + "name": "unit_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "vendor_material_code": { + "name": "vendor_material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_material_description": { + "name": "vendor_material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "lead_time_in_days": { + "name": "lead_time_in_days", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_rate": { + "name": "discount_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_amount": { + "name": "discount_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_alternative": { + "name": "is_alternative", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_recommended": { + "name": "is_recommended", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_quotation_items_pr_item_id_pr_items_id_fk": { + "name": "procurement_quotation_items_pr_item_id_pr_items_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "pr_items", + "columnsFrom": [ + "pr_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_attachments": { + "name": "procurement_rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_uploaded_by_users_id_fk": { + "name": "procurement_rfq_attachments_uploaded_by_users_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_comments": { + "name": "procurement_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_comments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_user_id_users_id_fk": { + "name": "procurement_rfq_comments_user_id_users_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_details": { + "name": "procurement_rfq_details", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendors_id": { + "name": "vendors_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'VV'" + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_vendors_id_vendors_id_fk": { + "name": "procurement_rfq_details_vendors_id_vendors_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "vendors", + "columnsFrom": [ + "vendors_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_rfq_details_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_incoterms_code_incoterms_code_fk": { + "name": "procurement_rfq_details_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_updated_by_users_id_fk": { + "name": "procurement_rfq_details_updated_by_users_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfqs": { + "name": "procurement_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "series": { + "name": "series", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "rfq_sealed_yn": { + "name": "rfq_sealed_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfqs_project_id_projects_id_fk": { + "name": "procurement_rfqs_project_id_projects_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_sent_by_users_id_fk": { + "name": "procurement_rfqs_sent_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_created_by_users_id_fk": { + "name": "procurement_rfqs_created_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_updated_by_users_id_fk": { + "name": "procurement_rfqs_updated_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "procurement_rfqs_rfq_code_unique": { + "name": "procurement_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_vendor_quotations": { + "name": "procurement_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_items_count": { + "name": "total_items_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sub_total": { + "name": "sub_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "tax_total": { + "name": "tax_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "discount_total": { + "name": "discount_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "estimated_delivery_date": { + "name": "estimated_delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "procurement_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_incoterms_code_incoterms_code_fk": { + "name": "procurement_vendor_quotations_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.preset_shares": { + "name": "preset_shares", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "preset_id": { + "name": "preset_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "shared_with_user_id": { + "name": "shared_with_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'read'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "preset_shares_preset_id_table_presets_id_fk": { + "name": "preset_shares_preset_id_table_presets_id_fk", + "tableFrom": "preset_shares", + "tableTo": "table_presets", + "columnsFrom": [ + "preset_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_presets": { + "name": "table_presets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_shared": { + "name": "is_shared", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_attachments": { + "name": "tech_sales_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "tech_sales_rfq_id": { + "name": "tech_sales_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "tech_sales_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_attachments_created_by_users_id_fk": { + "name": "tech_sales_attachments_created_by_users_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comment_attachments": { + "name": "tech_sales_rfq_comment_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk": { + "name": "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk": { + "name": "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comments": { + "name": "tech_sales_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_user_id_users_id_fk": { + "name": "tech_sales_rfq_comments_user_id_users_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfqs": { + "name": "tech_sales_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_shipbuilding_id": { + "name": "item_shipbuilding_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "bidding_project_id": { + "name": "bidding_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_snapshot": { + "name": "project_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "series_snapshot": { + "name": "series_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk": { + "name": "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "item_shipbuilding", + "columnsFrom": [ + "item_shipbuilding_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk": { + "name": "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bidding_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_sent_by_users_id_fk": { + "name": "tech_sales_rfqs_sent_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_created_by_users_id_fk": { + "name": "tech_sales_rfqs_created_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_updated_by_users_id_fk": { + "name": "tech_sales_rfqs_updated_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tech_sales_rfqs_rfq_code_unique": { + "name": "tech_sales_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_vendor_quotations": { + "name": "tech_sales_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "tech_sales_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rotation_attempts": { + "name": "ocr_rotation_attempts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "rotation": { + "name": "rotation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "tables_found": { + "name": "tables_found", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "text_quality": { + "name": "text_quality", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "keyword_count": { + "name": "keyword_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "score": { + "name": "score", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "extracted_rows_count": { + "name": "extracted_rows_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_rotation_attempts_session_id_ocr_sessions_id_fk": { + "name": "ocr_rotation_attempts_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rotation_attempts", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rows": { + "name": "ocr_rows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "table_id": { + "name": "table_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "row_index": { + "name": "row_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "report_no": { + "name": "report_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "no": { + "name": "no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "identification_no": { + "name": "identification_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_no": { + "name": "joint_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_type": { + "name": "joint_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "welding_date": { + "name": "welding_date", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "source_table": { + "name": "source_table", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "source_row": { + "name": "source_row", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_ocr_row_unique": { + "name": "idx_ocr_row_unique", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "report_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "ocr_rows_table_id_ocr_tables_id_fk": { + "name": "ocr_rows_table_id_ocr_tables_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_tables", + "columnsFrom": [ + "table_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_session_id_ocr_sessions_id_fk": { + "name": "ocr_rows_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_user_id_users_id_fk": { + "name": "ocr_rows_user_id_users_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_sessions": { + "name": "ocr_sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "processing_time": { + "name": "processing_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "best_rotation": { + "name": "best_rotation", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_tables": { + "name": "total_tables", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_rows": { + "name": "total_rows", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "image_enhanced": { + "name": "image_enhanced", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pdf_converted": { + "name": "pdf_converted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "success": { + "name": "success", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "warnings": { + "name": "warnings", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_tables": { + "name": "ocr_tables", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "table_index": { + "name": "table_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "row_count": { + "name": "row_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_tables_session_id_ocr_sessions_id_fk": { + "name": "ocr_tables_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_tables", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.offshore_hull_work_type": { + "name": "offshore_hull_work_type", + "schema": "public", + "values": [ + "HA", + "HE", + "HH", + "HM", + "NC" + ] + }, + "public.offshore_top_work_type": { + "name": "offshore_top_work_type", + "schema": "public", + "values": [ + "TM", + "TS", + "TE", + "TP" + ] + }, + "public.work_type": { + "name": "work_type", + "schema": "public", + "values": [ + "기장", + "전장", + "선실", + "배관", + "철의" + ] + }, + "public.user_domain": { + "name": "user_domain", + "schema": "public", + "values": [ + "evcp", + "partners" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": { + "public.contracts_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"contracts\".\"id\", \"contracts\".\"contract_no\", \"contracts\".\"contract_name\", \"contracts\".\"status\", \"contracts\".\"start_date\", \"contracts\".\"end_date\", \"contracts\".\"project_id\", \"projects\".\"code\", \"projects\".\"name\", \"contracts\".\"vendor_id\", \"vendors\".\"vendor_name\", \"contracts\".\"payment_terms\", \"contracts\".\"delivery_terms\", \"contracts\".\"delivery_date\", \"contracts\".\"delivery_location\", \"contracts\".\"currency\", \"contracts\".\"total_amount\", \"contracts\".\"discount\", \"contracts\".\"tax\", \"contracts\".\"shipping_fee\", \"contracts\".\"net_total\", \"contracts\".\"partial_shipping_allowed\", \"contracts\".\"partial_payment_allowed\", \"contracts\".\"remarks\", \"contracts\".\"version\", \"contracts\".\"created_at\", \"contracts\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"contracts\".\"id\"\n ) as \"has_signature\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "contracts_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.poa_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", + "name": "poa_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.project_approved_vendors": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"status\", \"vendor_types\".\"name_ko\", \"vendor_types\".\"name_en\", \"projects\".\"code\", \"projects\".\"name\", \"projects\".\"type\", \"vendor_pq_submissions\".\"submitted_at\", \"vendor_pq_submissions\".\"approved_at\" from \"vendors\" inner join \"vendor_pq_submissions\" on \"vendor_pq_submissions\".\"vendor_id\" = \"vendors\".\"id\" inner join \"projects\" on \"vendor_pq_submissions\".\"project_id\" = \"projects\".\"id\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\" where \"vendor_pq_submissions\".\"status\" = 'APPROVED'", + "name": "project_approved_vendors", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_investigations_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"vendor_id\", \"vendor_investigations\".\"pq_submission_id\", \"vendor_investigations\".\"requester_id\", \"vendor_investigations\".\"qm_manager_id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"evaluation_type\", \"vendor_investigations\".\"investigation_address\", \"vendor_investigations\".\"investigation_method\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"forecasted_at\", \"vendor_investigations\".\"requested_at\", \"vendor_investigations\".\"confirmed_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"evaluation_score\", \"vendor_investigations\".\"evaluation_result\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", requester.name as \"requesterName\", requester.email as \"requesterEmail\", qm_manager.name as \"qmManagerName\", qm_manager.email as \"qmManagerEmail\", (\n CASE \n WHEN EXISTS (\n SELECT 1 FROM vendor_investigation_attachments via \n WHERE via.investigation_id = \"vendor_investigations\".\"id\"\n ) \n THEN true \n ELSE false \n END\n ) as \"hasAttachments\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\" left join users AS requester on \"vendor_investigations\".\"requester_id\" = requester.id left join users AS qm_manager on \"vendor_investigations\".\"qm_manager_id\" = qm_manager.id", + "name": "vendor_investigations_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.cbe_view": { + "columns": {}, + "definition": "select \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"rfq_id\" as \"rfq_id\", \"cbe_evaluations\".\"vendor_id\" as \"vendor_id\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"result\" as \"result\", \"cbe_evaluations\".\"notes\" as \"notes\", \"cbe_evaluations\".\"evaluated_by\" as \"evaluated_by\", \"cbe_evaluations\".\"evaluated_at\" as \"evaluated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"name\" as \"evaluator_name\", \"users\".\"email\" as \"evaluator_email\" from \"cbe_evaluations\" inner join \"rfqs\" on \"cbe_evaluations\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"cbe_evaluations\".\"evaluated_by\" = \"users\".\"id\"", + "name": "cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.rfqs_view": { + "columns": {}, + "definition": "select \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"rfqs\".\"parent_rfq_id\" as \"parent_rfq_id\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"email\" as \"user_email\", \"users\".\"name\" as \"user_name\", (\n SELECT COUNT(*) \n FROM \"rfq_items\" \n WHERE \"rfq_items\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"item_count\", (\n SELECT COUNT(*) \n FROM \"rfq_attachments\" \n WHERE \"rfq_attachments\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"attachment_count\" from \"rfqs\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"rfqs\".\"created_by\" = \"users\".\"id\"", + "name": "rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_cbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", \"cbe_evaluations\".\"notes\" as \"cbe_note\", \"cbe_evaluations\".\"updated_at\" as \"cbe_updated\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"delivery_schedule\" as \"delivery_schedule\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_response_cbe_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"notes\" as \"response_notes\", \"vendor_responses\".\"responded_by\" as \"responded_by\", \"vendor_responses\".\"responded_at\" as \"responded_at\", \"vendor_responses\".\"updated_at\" as \"response_updated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"status\" as \"vendor_status\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"response_status\" as \"commercial_response_status\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"vendor_commercial_responses\".\"payment_terms\" as \"payment_terms\", \"vendor_commercial_responses\".\"incoterms\" as \"incoterms\", \"vendor_commercial_responses\".\"delivery_period\" as \"delivery_period\", \"vendor_commercial_responses\".\"warranty_period\" as \"warranty_period\", \"vendor_commercial_responses\".\"validity_period\" as \"validity_period\", \"vendor_commercial_responses\".\"price_breakdown\" as \"price_breakdown\", \"vendor_commercial_responses\".\"commercial_notes\" as \"commercial_notes\", \"vendor_commercial_responses\".\"created_at\" as \"commercial_created_at\", \"vendor_commercial_responses\".\"updated_at\" as \"commercial_updated_at\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"commercial_response_id\" = \"vendor_commercial_responses\".\"id\"\n ) as \"commercial_attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n AND \"vendor_response_attachments\".\"attachment_type\" = 'TECHNICAL_SPEC'\n ) as \"technical_attachment_count\", (\n SELECT MAX(\"uploaded_at\") \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"latest_attachment_date\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\"", + "name": "vendor_response_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_responses_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"created_at\" as \"rfq_created_at\", \"rfqs\".\"updated_at\" as \"rfq_updated_at\", \"rfqs\".\"created_by\" as \"rfq_created_by\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"responded_at\" as \"responded_at\", CASE WHEN \"vendor_technical_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_technical_response\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", CASE WHEN \"vendor_commercial_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_commercial_response\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"rfq_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE') left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"cbe_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\")", + "name": "vendor_responses_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_rfq_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", + "name": "vendor_rfq_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_tbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", \"vendor_technical_responses\".\"response_status\" as \"technical_response_status\", \"vendor_technical_responses\".\"summary\" as \"technical_summary\", \"vendor_technical_responses\".\"notes\" as \"technical_notes\", \"vendor_technical_responses\".\"updated_at\" as \"technical_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"rfq_evaluations\".\"notes\" as \"tbe_note\", \"rfq_evaluations\".\"updated_at\" as \"tbe_updated\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_tbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.role_view": { + "columns": {}, + "definition": "select \"roles\".\"id\" as \"id\", \"roles\".\"name\" as \"name\", \"roles\".\"description\" as \"description\", \"roles\".\"domain\" as \"domain\", \"roles\".\"created_at\" as \"created_at\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", COUNT(\"users\".\"id\") as \"user_count\" from \"roles\" left join \"user_roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" left join \"users\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"vendors\" on \"roles\".\"company_id\" = \"vendors\".\"id\" group by \"roles\".\"id\", \"vendors\".\"id\"", + "name": "role_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.user_view": { + "columns": {}, + "definition": "select \"users\".\"id\" as \"user_id\", \"users\".\"name\" as \"user_name\", \"users\".\"email\" as \"user_email\", \"users\".\"domain\" as \"user_domain\", \"users\".\"image_url\" as \"user_image\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"vendors\" on \"users\".\"company_id\" = \"vendors\".\"id\" left join \"user_roles\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" group by \"users\".\"id\", \"vendors\".\"id\"", + "name": "user_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.form_lists_view": { + "columns": {}, + "definition": "select \"tag_type_class_form_mappings\".\"id\" as \"id\", \"tag_type_class_form_mappings\".\"project_id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"tag_type_class_form_mappings\".\"tag_type_label\" as \"tag_type_label\", \"tag_type_class_form_mappings\".\"class_label\" as \"class_label\", \"tag_type_class_form_mappings\".\"form_code\" as \"form_code\", \"tag_type_class_form_mappings\".\"form_name\" as \"form_name\", \"tag_type_class_form_mappings\".\"ep\" as \"ep\", \"tag_type_class_form_mappings\".\"remark\" as \"remark\", \"tag_type_class_form_mappings\".\"created_at\" as \"created_at\", \"tag_type_class_form_mappings\".\"updated_at\" as \"updated_at\" from \"tag_type_class_form_mappings\" inner join \"projects\" on \"tag_type_class_form_mappings\".\"project_id\" = \"projects\".\"id\"", + "name": "form_lists_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.view_tag_subfields": { + "columns": { + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "definition": "select \"tag_subfields\".\"id\" as \"id\", \"tag_subfields\".\"tag_type_code\", \"tag_types\".\"description\", \"tag_subfields\".\"attributes_id\", \"tag_subfields\".\"attributes_description\", \"tag_subfields\".\"expression\", \"tag_subfields\".\"delimiter\", \"tag_subfields\".\"sort_order\", \"tag_subfields\".\"created_at\", \"tag_subfields\".\"updated_at\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\", \"projects\".\"name\" from \"tag_subfields\" inner join \"tag_types\" on (\"tag_subfields\".\"tag_type_code\" = \"tag_types\".\"code\" and \"tag_subfields\".\"project_id\" = \"tag_types\".\"project_id\") inner join \"projects\" on \"tag_subfields\".\"project_id\" = \"projects\".\"id\"", + "name": "view_tag_subfields", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.document_stages_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_count": { + "name": "stage_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_list": { + "name": "stage_list", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT\n d.id AS document_id,\n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n d.contract_id,\n (SELECT COUNT(*) FROM issue_stages WHERE document_id = d.id) AS stage_count,\n COALESCE( \n (SELECT json_agg(i.stage_name) FROM issue_stages i WHERE i.document_id = d.id), \n '[]'\n ) AS stage_list,\n d.created_at,\n d.updated_at\n FROM documents d\n", + "name": "document_stages_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.enhanced_documents_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_id": { + "name": "current_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_name": { + "name": "current_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_status": { + "name": "current_stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_order": { + "name": "current_stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_plan_date": { + "name": "current_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_actual_date": { + "name": "current_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_assignee_name": { + "name": "current_stage_assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_priority": { + "name": "current_stage_priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "days_until_due": { + "name": "days_until_due", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_overdue": { + "name": "is_overdue", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "days_difference": { + "name": "days_difference", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "total_stages": { + "name": "total_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "completed_stages": { + "name": "completed_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "progress_percentage": { + "name": "progress_percentage", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_status": { + "name": "latest_revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_submitted_date": { + "name": "latest_submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "all_stages": { + "name": "all_stages", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n WITH document_stats AS (\n SELECT \n d.id as document_id,\n COUNT(ist.id) as total_stages,\n COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) as completed_stages,\n CASE \n WHEN COUNT(ist.id) > 0 \n THEN ROUND((COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) * 100.0) / COUNT(ist.id))\n ELSE 0 \n END as progress_percentage\n FROM documents d\n LEFT JOIN issue_stages ist ON d.id = ist.document_id\n GROUP BY d.id\n ),\n current_stage_info AS (\n SELECT DISTINCT ON (document_id)\n document_id,\n id as current_stage_id,\n stage_name as current_stage_name,\n stage_status as current_stage_status,\n stage_order as current_stage_order,\n plan_date as current_stage_plan_date,\n actual_date as current_stage_actual_date,\n assignee_name as current_stage_assignee_name,\n priority as current_stage_priority,\n CASE \n WHEN actual_date IS NULL AND plan_date IS NOT NULL \n THEN plan_date - CURRENT_DATE\n ELSE NULL \n END as days_until_due,\n CASE \n WHEN actual_date IS NULL AND plan_date < CURRENT_DATE \n THEN true\n WHEN actual_date IS NOT NULL AND actual_date > plan_date \n THEN true\n ELSE false \n END as is_overdue,\n CASE \n WHEN actual_date IS NOT NULL AND plan_date IS NOT NULL \n THEN actual_date - plan_date\n ELSE NULL \n END as days_difference\n FROM issue_stages\n WHERE stage_status NOT IN ('COMPLETED', 'APPROVED')\n ORDER BY document_id, stage_order ASC, priority DESC\n ),\n latest_revision_info AS (\n SELECT DISTINCT ON (ist.document_id)\n ist.document_id,\n r.id as latest_revision_id,\n r.revision as latest_revision,\n r.revision_status as latest_revision_status,\n r.uploader_name as latest_revision_uploader_name,\n r.submitted_date as latest_submitted_date\n FROM revisions r\n JOIN issue_stages ist ON r.issue_stage_id = ist.id\n ORDER BY ist.document_id, r.created_at DESC\n ),\n -- 리비전별 첨부파일 집계\n revision_attachments AS (\n SELECT \n r.id as revision_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', da.id,\n 'revisionId', da.revision_id,\n 'fileName', da.file_name,\n 'filePath', da.file_path,\n 'fileSize', da.file_size,\n 'fileType', da.file_type,\n 'createdAt', da.created_at,\n 'updatedAt', da.updated_at\n ) ORDER BY da.created_at\n ) FILTER (WHERE da.id IS NOT NULL),\n '[]'::json\n ) as attachments\n FROM revisions r\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY r.id\n ),\n -- 스테이지별 리비전 집계 (첨부파일 포함)\n stage_revisions AS (\n SELECT \n ist.id as stage_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', r.id,\n 'issueStageId', r.issue_stage_id,\n 'revision', r.revision,\n 'uploaderType', r.uploader_type,\n 'uploaderId', r.uploader_id,\n 'uploaderName', r.uploader_name,\n 'comment', r.comment,\n 'usage', r.usage,\n 'revisionStatus', r.revision_status,\n 'submittedDate', r.submitted_date,\n 'uploadedAt', r.uploaded_at,\n 'approvedDate', r.approved_date,\n 'reviewStartDate', r.review_start_date,\n 'rejectedDate', r.rejected_date,\n 'reviewerId', r.reviewer_id,\n 'reviewerName', r.reviewer_name,\n 'reviewComments', r.review_comments,\n 'createdAt', r.created_at,\n 'updatedAt', r.updated_at,\n 'attachments', ra.attachments\n ) ORDER BY r.created_at\n ) FILTER (WHERE r.id IS NOT NULL),\n '[]'::json\n ) as revisions\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN revision_attachments ra ON r.id = ra.revision_id\n GROUP BY ist.id\n ),\n -- 문서별 스테이지 집계 (리비전 포함)\n stage_aggregation AS (\n SELECT \n ist.document_id,\n json_agg(\n json_build_object(\n 'id', ist.id,\n 'stageName', ist.stage_name,\n 'stageStatus', ist.stage_status,\n 'stageOrder', ist.stage_order,\n 'planDate', ist.plan_date,\n 'actualDate', ist.actual_date,\n 'assigneeName', ist.assignee_name,\n 'priority', ist.priority,\n 'revisions', sr.revisions\n ) ORDER BY ist.stage_order\n ) as all_stages\n FROM issue_stages ist\n LEFT JOIN stage_revisions sr ON ist.id = sr.stage_id\n GROUP BY ist.document_id\n ),\n attachment_counts AS (\n SELECT \n ist.document_id,\n COUNT(da.id) as attachment_count\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY ist.document_id\n )\n \n SELECT \n d.id as document_id,\n d.doc_number,\n d.drawing_kind,\n d.vendor_doc_number, -- ✅ 벤더 문서 번호 추가\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n -- ✅ 프로젝트 및 벤더 정보 추가\n p.code as project_code,\n v.vendor_name as vendor_name,\n v.vendor_code as vendor_code,\n \n -- 현재 스테이지 정보\n csi.current_stage_id,\n csi.current_stage_name,\n csi.current_stage_status,\n csi.current_stage_order,\n csi.current_stage_plan_date,\n csi.current_stage_actual_date,\n csi.current_stage_assignee_name,\n csi.current_stage_priority,\n \n -- 계산 필드\n csi.days_until_due,\n csi.is_overdue,\n csi.days_difference,\n \n -- 진행률 정보\n ds.total_stages,\n ds.completed_stages,\n ds.progress_percentage,\n \n -- 최신 리비전 정보\n lri.latest_revision_id,\n lri.latest_revision,\n lri.latest_revision_status,\n lri.latest_revision_uploader_name,\n lri.latest_submitted_date,\n \n -- 전체 스테이지 (리비전 및 첨부파일 포함)\n COALESCE(sa.all_stages, '[]'::json) as all_stages,\n \n -- 기타\n COALESCE(ac.attachment_count, 0) as attachment_count,\n d.created_at,\n d.updated_at\n \n FROM documents d\n -- ✅ contracts, projects, vendors 테이블 JOIN 추가\n LEFT JOIN contracts c ON d.contract_id = c.id\n LEFT JOIN projects p ON c.project_id = p.id\n LEFT JOIN vendors v ON c.vendor_id = v.id\n \n LEFT JOIN document_stats ds ON d.id = ds.document_id\n LEFT JOIN current_stage_info csi ON d.id = csi.document_id\n LEFT JOIN latest_revision_info lri ON d.id = lri.document_id\n LEFT JOIN stage_aggregation sa ON d.id = sa.document_id\n LEFT JOIN attachment_counts ac ON d.id = ac.document_id\n \n ORDER BY d.created_at DESC\n", + "name": "enhanced_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.sync_status_view": { + "columns": { + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "total_changes": { + "name": "total_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pending_changes": { + "name": "pending_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "synced_changes": { + "name": "synced_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "failed_changes": { + "name": "failed_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "last_sync_at": { + "name": "last_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_sync_at": { + "name": "next_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n WITH change_stats AS (\n SELECT \n cl.contract_id,\n sc.target_system,\n COUNT(*) as total_changes,\n COUNT(CASE WHEN cl.is_synced = false AND cl.sync_attempts < sc.retry_max_attempts THEN 1 END) as pending_changes,\n COUNT(CASE WHEN cl.is_synced = true THEN 1 END) as synced_changes,\n COUNT(CASE WHEN cl.sync_attempts >= sc.retry_max_attempts AND cl.is_synced = false THEN 1 END) as failed_changes,\n MAX(cl.synced_at) as last_sync_at\n FROM change_logs cl\n CROSS JOIN sync_configs sc \n WHERE cl.contract_id = sc.contract_id\n AND (cl.target_systems IS NULL OR cl.target_systems @> to_jsonb(sc.target_system))\n GROUP BY cl.contract_id, sc.target_system\n )\n SELECT \n cs.contract_id,\n cs.target_system,\n COALESCE(cs.total_changes, 0) as total_changes,\n COALESCE(cs.pending_changes, 0) as pending_changes,\n COALESCE(cs.synced_changes, 0) as synced_changes,\n COALESCE(cs.failed_changes, 0) as failed_changes,\n cs.last_sync_at,\n CASE \n WHEN sc.sync_enabled = true AND sc.last_successful_sync IS NOT NULL \n THEN sc.last_successful_sync + (sc.sync_interval_minutes || ' minutes')::interval\n ELSE NULL\n END as next_sync_at,\n sc.sync_enabled\n FROM sync_configs sc\n LEFT JOIN change_stats cs ON sc.contract_id = cs.contract_id AND sc.target_system = cs.target_system\n", + "name": "sync_status_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_documents_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "latest_stage_id": { + "name": "latest_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_stage_name": { + "name": "latest_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_stage_plan_date": { + "name": "latest_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_stage_actual_date": { + "name": "latest_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_type": { + "name": "latest_revision_uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT \n d.id, \n d.doc_number,\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n (SELECT id FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_id,\n (SELECT stage_name FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_name,\n (SELECT plan_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_plan_date,\n (SELECT actual_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_actual_date,\n \n (SELECT r.id FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_id,\n (SELECT r.revision FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision,\n (SELECT r.uploader_type FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_type,\n (SELECT r.uploader_name FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_name,\n \n (SELECT COUNT(*) FROM document_attachments a JOIN revisions r ON a.revision_id = r.id JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id) AS attachment_count,\n \n d.created_at,\n d.updated_at\n FROM documents d\n JOIN contracts c ON d.contract_id = c.id\n ", + "name": "vendor_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_candidates_with_vendor_info": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_candidates\".\"id\", \"vendor_candidates\".\"company_name\", \"vendor_candidates\".\"contact_email\", \"vendor_candidates\".\"contact_phone\", \"vendor_candidates\".\"tax_id\", \"vendor_candidates\".\"address\", \"vendor_candidates\".\"country\", \"vendor_candidates\".\"source\", \"vendor_candidates\".\"status\", \"vendor_candidates\".\"items\", \"vendor_candidates\".\"remark\", \"vendor_candidates\".\"created_at\", \"vendor_candidates\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"created_at\" as \"vendor_created_at\", (\n SELECT l2.\"created_at\"\n FROM \"vendor_candidate_logs\" l2\n WHERE l2.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l2.\"action\" = 'status_change'\n ORDER BY l2.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_at\", (\n SELECT u.\"name\"\n FROM \"users\" u\n JOIN \"vendor_candidate_logs\" l3\n ON l3.\"user_id\" = u.\"id\"\n WHERE l3.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l3.\"action\" = 'status_change'\n ORDER BY l3.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_by\", (\n SELECT l4.\"created_at\"\n FROM \"vendor_candidate_logs\" l4\n WHERE l4.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l4.\"action\" = 'invite_sent'\n ORDER BY l4.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_at\", (\n SELECT u2.\"name\"\n FROM \"users\" u2\n JOIN \"vendor_candidate_logs\" l5\n ON l5.\"user_id\" = u2.\"id\"\n WHERE l5.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l5.\"action\" = 'invite_sent'\n ORDER BY l5.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_by\" from \"vendor_candidates\" left join \"vendors\" on \"vendor_candidates\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "vendor_candidates_with_vendor_info", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"business_size\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"", + "name": "vendor_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", + "name": "vendor_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_materials_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_materials\".\"id\", \"vendor_possible_materials\".\"vendor_id\", \"materials\".\"item_name\", \"materials\".\"item_code\", \"materials\".\"description\", \"materials\".\"unit_of_measure\", \"materials\".\"steel_type\", \"materials\".\"grade_material\", \"vendor_possible_materials\".\"created_at\", \"vendor_possible_materials\".\"updated_at\" from \"vendor_possible_materials\" left join \"materials\" on \"vendor_possible_materials\".\"item_code\" = \"materials\".\"item_code\"", + "name": "vendor_materials_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendors_with_types": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"tax_id\" as \"tax_id\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"phone\" as \"phone\", \"vendors\".\"email\" as \"email\", \"vendors\".\"business_size\" as \"business_size\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"status\", \"vendors\".\"vendor_type_id\" as \"vendor_type_id\", \"vendors\".\"representative_name\" as \"representative_name\", \"vendors\".\"representative_birth\" as \"representative_birth\", \"vendors\".\"representative_email\" as \"representative_email\", \"vendors\".\"representative_phone\" as \"representative_phone\", \"vendors\".\"corporate_registration_number\" as \"corporate_registration_number\", \"vendors\".\"items\" as \"items\", \"vendors\".\"credit_agency\" as \"credit_agency\", \"vendors\".\"credit_rating\" as \"credit_rating\", \"vendors\".\"cash_flow_rating\" as \"cash_flow_rating\", \"vendors\".\"created_at\" as \"created_at\", \"vendors\".\"updated_at\" as \"updated_at\", \"vendor_types\".\"name_ko\" as \"vendor_type_name\", \"vendor_types\".\"name_en\" as \"vendor_type_name_en\", \"vendor_types\".\"code\" as \"vendor_type_code\", \n CASE\n WHEN \"vendors\".\"status\" = 'ACTIVE' THEN '정규업체'\n WHEN \"vendors\".\"status\" IN ('INACTIVE', 'BLACKLISTED', 'REJECTED') THEN ''\n ELSE '잠재업체'\n END\n as \"vendor_category\" from \"vendors\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\"", + "name": "vendors_with_types", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.basic_contract_view": { + "columns": {}, + "definition": "select \"basic_contract\".\"id\" as \"id\", \"basic_contract\".\"template_id\" as \"template_id\", \"basic_contract\".\"vendor_id\" as \"vendor_id\", \"basic_contract\".\"requested_by\" as \"requested_by\", \"basic_contract\".\"status\" as \"basic_contract_status\", \"basic_contract\".\"created_at\" as \"created_at\", \"basic_contract\".\"updated_at\" as \"updated_at\", \"basic_contract\".\"updated_at\" as \"completed_at\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"email\" as \"vendor_email\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"users\".\"name\" as \"user_name\", \"basic_contract_templates\".\"template_name\" as \"template_name\", \"basic_contract_templates\".\"validity_period\" as \"validityPeriod\", \"basic_contract_templates\".\"file_path\" as \"file_path\", \"basic_contract_templates\".\"file_name\" as \"file_name\", \"basic_contract\".\"file_path\" as \"signed_file_path\" from \"basic_contract\" left join \"vendors\" on \"basic_contract\".\"vendor_id\" = \"vendors\".\"id\" left join \"users\" on \"basic_contract\".\"requested_by\" = \"users\".\"id\" left join \"basic_contract_templates\" on \"basic_contract\".\"template_id\" = \"basic_contract_templates\".\"id\"", + "name": "basic_contract_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.pr_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"pr_items\".\"id\", \"pr_items\".\"procurement_rfqs_id\", \"pr_items\".\"rfq_item\", \"pr_items\".\"pr_item\", \"pr_items\".\"pr_no\", \"pr_items\".\"material_code\", \"pr_items\".\"material_category\", \"pr_items\".\"acc\", \"pr_items\".\"material_description\", \"pr_items\".\"size\", \"pr_items\".\"delivery_date\", \"pr_items\".\"quantity\", \"pr_items\".\"uom\", \"pr_items\".\"gross_weight\", \"pr_items\".\"gw_uom\", \"pr_items\".\"spec_no\", \"pr_items\".\"spec_url\", \"pr_items\".\"tracking_no\", \"pr_items\".\"major_yn\", \"pr_items\".\"project_def\", \"pr_items\".\"project_sc\", \"pr_items\".\"project_kl\", \"pr_items\".\"project_lc\", \"pr_items\".\"project_dl\", \"pr_items\".\"remark\", \"procurement_rfqs\".\"rfq_code\", \"procurement_rfqs\".\"item_code\", \"procurement_rfqs\".\"item_name\" from \"pr_items\" left join \"procurement_rfqs\" on \"pr_items\".\"procurement_rfqs_id\" = \"procurement_rfqs\".\"id\"", + "name": "pr_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfq_details_view": { + "columns": {}, + "definition": "select \"rfq_details\".\"id\" as \"detail_id\", \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfqs\".\"item_code\" as \"item_code\", \"rfqs\".\"item_name\" as \"item_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"country\" as \"vendor_country\", \"rfq_details\".\"currency\" as \"currency\", \"payment_terms\".\"code\" as \"payment_terms_code\", \"payment_terms\".\"description\" as \"payment_terms_description\", \"incoterms\".\"code\" as \"incoterms_code\", \"incoterms\".\"description\" as \"incoterms_description\", \"rfq_details\".\"incoterms_detail\" as \"incoterms_detail\", \"rfq_details\".\"delivery_date\" as \"delivery_date\", \"rfq_details\".\"tax_code\" as \"tax_code\", \"rfq_details\".\"place_of_shipping\" as \"place_of_shipping\", \"rfq_details\".\"place_of_destination\" as \"place_of_destination\", \"rfq_details\".\"material_price_related_yn\" as \"material_price_related_yn\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"rfq_details\".\"updated_at\" as \"updated_at\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\"\n ) as \"pr_items_count\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\" \n AND major_yn = true\n ) as \"major_items_count\", (\n SELECT COUNT(*) \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"comment_count\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_comment_date\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\" AND is_vendor_comment = true\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_vendor_comment_date\", (\n SELECT COUNT(*) \n FROM procurement_rfq_attachments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) > 0\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"has_quotation\", (\n SELECT status\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_status\", (\n SELECT total_price\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_total_price\", (\n SELECT quotation_version\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"quotation_version\", (\n SELECT COUNT(DISTINCT quotation_version)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"quotation_version_count\", (\n SELECT created_at\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"last_quotation_date\" from \"procurement_rfq_details\" \"rfq_details\" left join \"procurement_rfqs\" \"rfqs\" on \"rfq_details\".\"procurement_rfqs_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"rfq_details\".\"vendors_id\" = \"vendors\".\"id\" left join \"payment_terms\" on \"rfq_details\".\"payment_terms_code\" = \"payment_terms\".\"code\" left join \"incoterms\" on \"rfq_details\".\"incoterms_code\" = \"incoterms\".\"code\" left join \"users\" \"updated_by_user\" on \"rfq_details\".\"updated_by\" = \"updated_by_user\".\"id\"", + "name": "procurement_rfq_details_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfqs_view": { + "columns": {}, + "definition": "select \"procurement_rfqs\".\"id\" as \"id\", \"procurement_rfqs\".\"rfq_code\" as \"rfq_code\", \"procurement_rfqs\".\"series\" as \"series\", \"procurement_rfqs\".\"rfq_sealed_yn\" as \"rfq_sealed_yn\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"procurement_rfqs\".\"item_code\" as \"item_code\", \"procurement_rfqs\".\"item_name\" as \"item_name\", \"procurement_rfqs\".\"status\" as \"status\", \"procurement_rfqs\".\"pic_code\" as \"pic_code\", \"procurement_rfqs\".\"rfq_send_date\" as \"rfq_send_date\", \"procurement_rfqs\".\"due_date\" as \"due_date\", (\n SELECT MIN(submitted_at)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"procurement_rfqs\".\"id\"\n AND submitted_at IS NOT NULL\n ) as \"earliest_quotation_submitted_at\", \"created_by_user\".\"name\" as \"created_by_user_name\", \"sent_by_user\".\"name\" as \"sent_by_user_name\", \"procurement_rfqs\".\"updated_at\" as \"updated_at\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"procurement_rfqs\".\"remark\" as \"remark\", (\n SELECT material_code \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"major_item_material_code\", (\n SELECT pr_no \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"po_no\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n ) as \"pr_items_count\" from \"procurement_rfqs\" left join \"projects\" on \"procurement_rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" \"created_by_user\" on \"procurement_rfqs\".\"created_by\" = \"created_by_user\".\"id\" left join \"users\" \"updated_by_user\" on \"procurement_rfqs\".\"updated_by\" = \"updated_by_user\".\"id\" left join \"users\" \"sent_by_user\" on \"procurement_rfqs\".\"sent_by\" = \"sent_by_user\".\"id\"", + "name": "procurement_rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + } + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db/migrations/meta/0118_snapshot.json b/db/migrations/meta/0118_snapshot.json new file mode 100644 index 00000000..c055c8a7 --- /dev/null +++ b/db/migrations/meta/0118_snapshot.json @@ -0,0 +1,12040 @@ +{ + "id": "486b96c5-7ead-4fac-8e25-ee386b0c5b92", + "prevId": "b05fff1c-bfe7-41d7-801e-d8f2ade806ee", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.companies": { + "name": "companies", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "companies_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "taxID": { + "name": "taxID", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_envelopes": { + "name": "contract_envelopes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_envelopes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "envelope_id": { + "name": "envelope_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": true + }, + "document_id": { + "name": "document_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": false + }, + "envelope_status": { + "name": "envelope_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_envelopes_contract_id_contracts_id_fk": { + "name": "contract_envelopes_contract_id_contracts_id_fk", + "tableFrom": "contract_envelopes", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_items": { + "name": "contract_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_items_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_id": { + "name": "item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "unit_price": { + "name": "unit_price", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "total_line_amount": { + "name": "total_line_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_items_contract_item_idx": { + "name": "contract_items_contract_item_idx", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "contract_items_contract_id_contracts_id_fk": { + "name": "contract_items_contract_id_contracts_id_fk", + "tableFrom": "contract_items", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_items_item_id_items_id_fk": { + "name": "contract_items_item_id_items_id_fk", + "tableFrom": "contract_items", + "tableTo": "items", + "columnsFrom": [ + "item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_items_contract_id_item_id_unique": { + "name": "contract_items_contract_id_item_id_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_id", + "item_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_signers": { + "name": "contract_signers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_signers_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "envelope_id": { + "name": "envelope_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_contact_id": { + "name": "vendor_contact_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "signer_type": { + "name": "signer_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'VENDOR'" + }, + "signer_email": { + "name": "signer_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "signer_name": { + "name": "signer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "signer_position": { + "name": "signer_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "signer_status": { + "name": "signer_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "signed_at": { + "name": "signed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_signers_envelope_id_contract_envelopes_id_fk": { + "name": "contract_signers_envelope_id_contract_envelopes_id_fk", + "tableFrom": "contract_signers", + "tableTo": "contract_envelopes", + "columnsFrom": [ + "envelope_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_signers_vendor_contact_id_vendor_contacts_id_fk": { + "name": "contract_signers_vendor_contact_id_vendor_contacts_id_fk", + "tableFrom": "contract_signers", + "tableTo": "vendor_contacts", + "columnsFrom": [ + "vendor_contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contracts": { + "name": "contracts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contracts_project_id_projects_id_fk": { + "name": "contracts_project_id_projects_id_fk", + "tableFrom": "contracts", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contracts_vendor_id_vendors_id_fk": { + "name": "contracts_vendor_id_vendors_id_fk", + "tableFrom": "contracts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contracts_contract_no_unique": { + "name": "contracts_contract_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.poa": { + "name": "poa", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "original_contract_no": { + "name": "original_contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "original_contract_name": { + "name": "original_contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_status": { + "name": "original_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "poa_original_contract_no_contracts_contract_no_fk": { + "name": "poa_original_contract_no_contracts_contract_no_fk", + "tableFrom": "poa", + "tableTo": "contracts", + "columnsFrom": [ + "original_contract_no" + ], + "columnsTo": [ + "contract_no" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_project_id_projects_id_fk": { + "name": "poa_project_id_projects_id_fk", + "tableFrom": "poa", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_vendor_id_vendors_id_fk": { + "name": "poa_vendor_id_vendors_id_fk", + "tableFrom": "poa", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_hull": { + "name": "item_offshore_hull", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_hull_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_hull_item_code_items_item_code_fk": { + "name": "item_offshore_hull_item_code_items_item_code_fk", + "tableFrom": "item_offshore_hull", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_top": { + "name": "item_offshore_top", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_top_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_top_item_code_items_item_code_fk": { + "name": "item_offshore_top_item_code_items_item_code_fk", + "tableFrom": "item_offshore_top", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_shipbuilding": { + "name": "item_shipbuilding", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ship_types": { + "name": "ship_types", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'OPTION'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_shipbuilding_item_code_items_item_code_fk": { + "name": "item_shipbuilding_item_code_items_item_code_fk", + "tableFrom": "item_shipbuilding", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.items": { + "name": "items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_no": { + "name": "project_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "package_code": { + "name": "package_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "sm_code": { + "name": "sm_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "items_item_code_unique": { + "name": "items_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.materials": { + "name": "materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "materials_item_code_unique": { + "name": "materials_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias": { + "name": "pq_criterias", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "check_point": { + "name": "check_point", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "group_name": { + "name": "group_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias_extension": { + "name": "pq_criterias_extension", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_criteria_id": { + "name": "pq_criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_info": { + "name": "contract_info", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "additional_requirement": { + "name": "additional_requirement", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk": { + "name": "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "pq_criterias", + "columnsFrom": [ + "pq_criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "pq_criterias_extension_project_id_projects_id_fk": { + "name": "pq_criterias_extension_project_id_projects_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_criteria_attachments": { + "name": "vendor_criteria_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_criteria_answer_id": { + "name": "vendor_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_criteria_attachments", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigation_attachments": { + "name": "vendor_investigation_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "investigation_id": { + "name": "investigation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'REPORT'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { + "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", + "tableFrom": "vendor_investigation_attachments", + "tableTo": "vendor_investigations", + "columnsFrom": [ + "investigation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigations": { + "name": "vendor_investigations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigations_vendor_id_vendors_id_fk": { + "name": "vendor_investigations_vendor_id_vendors_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk": { + "name": "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendor_pq_submissions", + "columnsFrom": [ + "pq_submission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "vendor_investigations_requester_id_users_id_fk": { + "name": "vendor_investigations_requester_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_qm_manager_id_users_id_fk": { + "name": "vendor_investigations_qm_manager_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "qm_manager_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_submissions": { + "name": "vendor_pq_submissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_number": { + "name": "pq_number", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_pq_submission": { + "name": "unique_pq_submission", + "columns": [ + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_pq_submissions_requester_id_users_id_fk": { + "name": "vendor_pq_submissions_requester_id_users_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_pq_submissions_vendor_id_vendors_id_fk": { + "name": "vendor_pq_submissions_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_submissions_project_id_projects_id_fk": { + "name": "vendor_pq_submissions_project_id_projects_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_pq_submissions_pq_number_unique": { + "name": "vendor_pq_submissions_pq_number_unique", + "nullsNotDistinct": false, + "columns": [ + "pq_number" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_criteria_answers": { + "name": "vendor_pq_criteria_answers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "criteria_id": { + "name": "criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "answer": { + "name": "answer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_criteria_answers_vendor_id_vendors_id_fk": { + "name": "vendor_pq_criteria_answers_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": { + "name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "pq_criterias", + "columnsFrom": [ + "criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_project_id_projects_id_fk": { + "name": "vendor_pq_criteria_answers_project_id_projects_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_review_logs": { + "name": "vendor_pq_review_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_pq_criteria_answer_id": { + "name": "vendor_pq_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "reviewer_comment": { + "name": "reviewer_comment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_pq_review_logs", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_pq_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_project_pqs": { + "name": "vendor_project_pqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_project_pqs_vendor_id_vendors_id_fk": { + "name": "vendor_project_pqs_vendor_id_vendors_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_project_pqs_project_id_projects_id_fk": { + "name": "vendor_project_pqs_project_id_projects_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bidding_projects": { + "name": "bidding_projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "proj_nm": { + "name": "proj_nm", + "type": "varchar(90)", + "primaryKey": false, + "notNull": false + }, + "sector": { + "name": "sector", + "type": "char(1)", + "primaryKey": false, + "notNull": false + }, + "proj_msrm": { + "name": "proj_msrm", + "type": "numeric(3, 0)", + "primaryKey": false, + "notNull": false + }, + "kunnr": { + "name": "kunnr", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "kunnr_nm": { + "name": "kunnr_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "cls_1": { + "name": "cls_1", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "cls1_nm": { + "name": "cls1_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "ptype": { + "name": "ptype", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "ptype_nm": { + "name": "ptype_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_cd": { + "name": "pmodel_cd", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "pmodel_nm": { + "name": "pmodel_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_sz": { + "name": "pmodel_sz", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "pmodel_uom": { + "name": "pmodel_uom", + "type": "char(5)", + "primaryKey": false, + "notNull": false + }, + "txt04": { + "name": "txt04", + "type": "char(4)", + "primaryKey": false, + "notNull": false + }, + "txt30": { + "name": "txt30", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "estm_pm": { + "name": "estm_pm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "bidding_projects_pspid_unique": { + "name": "bidding_projects_pspid_unique", + "nullsNotDistinct": false, + "columns": [ + "pspid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_series": { + "name": "project_series", + "schema": "", + "columns": { + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "sers_no": { + "name": "sers_no", + "type": "char(3)", + "primaryKey": false, + "notNull": true + }, + "sc_dt": { + "name": "sc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "kl_dt": { + "name": "kl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "lc_dt": { + "name": "lc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dl_dt": { + "name": "dl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dock_no": { + "name": "dock_no", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "dock_nm": { + "name": "dock_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "proj_no": { + "name": "proj_no", + "type": "char(24)", + "primaryKey": false, + "notNull": false + }, + "post1": { + "name": "post1", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "project_sersNo_unique": { + "name": "project_sersNo_unique", + "columns": [ + { + "expression": "pspid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sers_no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "project_series_pspid_bidding_projects_pspid_fk": { + "name": "project_series_pspid_bidding_projects_pspid_fk", + "tableFrom": "project_series", + "tableTo": "bidding_projects", + "columnsFrom": [ + "pspid" + ], + "columnsTo": [ + "pspid" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projects": { + "name": "projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cbe_evaluations": { + "name": "cbe_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluated_by": { + "name": "evaluated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluated_at": { + "name": "evaluated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "result": { + "name": "result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "total_cost": { + "name": "total_cost", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_schedule": { + "name": "delivery_schedule", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "cbe_evaluations_rfq_id_rfqs_id_fk": { + "name": "cbe_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_vendor_id_vendors_id_fk": { + "name": "cbe_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_evaluated_by_users_id_fk": { + "name": "cbe_evaluations_evaluated_by_users_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "users", + "columnsFrom": [ + "evaluated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_attachments": { + "name": "rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_attachments_rfq_id_rfqs_id_fk": { + "name": "rfq_attachments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_vendor_id_vendors_id_fk": { + "name": "rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_attachments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_cbe_id_cbe_evaluations_id_fk": { + "name": "rfq_attachments_cbe_id_cbe_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "cbe_evaluations", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_comment_id_rfq_comments_id_fk": { + "name": "rfq_attachments_comment_id_rfq_comments_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_comments": { + "name": "rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "comment_text": { + "name": "comment_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "commented_by": { + "name": "commented_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_comments_rfq_id_rfqs_id_fk": { + "name": "rfq_comments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_vendor_id_vendors_id_fk": { + "name": "rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_commented_by_users_id_fk": { + "name": "rfq_comments_commented_by_users_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "commented_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_comments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_cbe_id_vendor_responses_id_fk": { + "name": "rfq_comments_cbe_id_vendor_responses_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_evaluations": { + "name": "rfq_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "eval_type": { + "name": "eval_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "result": { + "name": "result", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_evaluations_rfq_id_rfqs_id_fk": { + "name": "rfq_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_evaluations_vendor_id_vendors_id_fk": { + "name": "rfq_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_items": { + "name": "rfq_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_items_rfq_id_rfqs_id_fk": { + "name": "rfq_items_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_items", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "rfq_items_item_code_items_item_code_fk": { + "name": "rfq_items_item_code_items_item_code_fk", + "tableFrom": "rfq_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfqs": { + "name": "rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "bid_project_id": { + "name": "bid_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false, + "default": "'PURCHASE'" + }, + "parent_rfq_id": { + "name": "parent_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfqs_project_id_projects_id_fk": { + "name": "rfqs_project_id_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_bid_project_id_bidding_projects_id_fk": { + "name": "rfqs_bid_project_id_bidding_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bid_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_created_by_users_id_fk": { + "name": "rfqs_created_by_users_id_fk", + "tableFrom": "rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_parent_rfq_id_rfqs_id_fk": { + "name": "rfqs_parent_rfq_id_rfqs_id_fk", + "tableFrom": "rfqs", + "tableTo": "rfqs", + "columnsFrom": [ + "parent_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "rfqs_rfq_code_unique": { + "name": "rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_commercial_responses": { + "name": "vendor_commercial_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "total_price": { + "name": "total_price", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_period": { + "name": "delivery_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "warranty_period": { + "name": "warranty_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "validity_period": { + "name": "validity_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "price_breakdown": { + "name": "price_breakdown", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "commercial_notes": { + "name": "commercial_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_commercial_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_commercial_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_commercial_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_attachments": { + "name": "vendor_response_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "technical_response_id": { + "name": "technical_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "commercial_response_id": { + "name": "commercial_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_attachments_response_id_vendor_responses_id_fk": { + "name": "vendor_response_attachments_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk": { + "name": "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_technical_responses", + "columnsFrom": [ + "technical_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk": { + "name": "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_commercial_responses", + "columnsFrom": [ + "commercial_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_responses": { + "name": "vendor_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'REVIEWING'" + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "responded_by": { + "name": "responded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "responded_at": { + "name": "responded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "vendor_response_unique": { + "name": "vendor_response_unique", + "columns": [ + { + "expression": "rfq_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_responses_rfq_id_rfqs_id_fk": { + "name": "vendor_responses_rfq_id_rfqs_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_responses_vendor_id_vendors_id_fk": { + "name": "vendor_responses_vendor_id_vendors_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_technical_responses": { + "name": "vendor_technical_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_technical_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_technical_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_technical_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.otps": { + "name": "otps", + "schema": "", + "columns": { + "email": { + "name": "email", + "type": "varchar(256)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(6)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "otpToken": { + "name": "otpToken", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "otp_expires": { + "name": "otp_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permissions": { + "name": "permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "permissions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "permission_key": { + "name": "permission_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.role_permissions": { + "name": "role_permissions", + "schema": "", + "columns": { + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "permission_id": { + "name": "permission_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "role_permissions_role_id_roles_id_fk": { + "name": "role_permissions_role_id_roles_id_fk", + "tableFrom": "role_permissions", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "role_permissions_permission_id_permissions_id_fk": { + "name": "role_permissions_permission_id_permissions_id_fk", + "tableFrom": "role_permissions", + "tableTo": "permissions", + "columnsFrom": [ + "permission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.roles": { + "name": "roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "roles_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "roles_company_id_vendors_id_fk": { + "name": "roles_company_id_vendors_id_fk", + "tableFrom": "roles", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_roles": { + "name": "user_roles", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_roles_user_id_users_id_fk": { + "name": "user_roles_user_id_users_id_fk", + "tableFrom": "user_roles", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_roles_role_id_roles_id_fk": { + "name": "user_roles_role_id_roles_id_fk", + "tableFrom": "user_roles", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "users_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'partners'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "image_url": { + "name": "image_url", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "language": { + "name": "language", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'en'" + } + }, + "indexes": {}, + "foreignKeys": { + "users_company_id_vendors_id_fk": { + "name": "users_company_id_vendors_id_fk", + "tableFrom": "users", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_entries": { + "name": "form_entries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_entries_contract_item_id_contract_items_id_fk": { + "name": "form_entries_contract_item_id_contract_items_id_fk", + "tableFrom": "form_entries", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_metas": { + "name": "form_metas", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "columns": { + "name": "columns", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_metas_project_id_projects_id_fk": { + "name": "form_metas_project_id_projects_id_fk", + "tableFrom": "form_metas", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "form_code_project_unique": { + "name": "form_code_project_unique", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.forms": { + "name": "forms", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "forms_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "eng": { + "name": "eng", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "im": { + "name": "im", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_item_form_code_unique": { + "name": "contract_item_form_code_unique", + "columns": [ + { + "expression": "contract_item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "form_code", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "forms_contract_item_id_contract_items_id_fk": { + "name": "forms_contract_item_id_contract_items_id_fk", + "tableFrom": "forms", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_class_attributes": { + "name": "tag_class_attributes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_class_attributes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "tag_class_id": { + "name": "tag_class_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "att_id": { + "name": "att_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "def_val": { + "name": "def_val", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uom_id": { + "name": "uom_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "seq": { + "name": "seq", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "tag_class_attributes_seq_idx": { + "name": "tag_class_attributes_seq_idx", + "columns": [ + { + "expression": "seq", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "tag_class_attributes_tag_class_id_tag_classes_id_fk": { + "name": "tag_class_attributes_tag_class_id_tag_classes_id_fk", + "tableFrom": "tag_class_attributes", + "tableTo": "tag_classes", + "columnsFrom": [ + "tag_class_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_att_id_in_tag_class": { + "name": "uniq_att_id_in_tag_class", + "nullsNotDistinct": false, + "columns": [ + "tag_class_id", + "att_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_classes": { + "name": "tag_classes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_classes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_classes_project_id_projects_id_fk": { + "name": "tag_classes_project_id_projects_id_fk", + "tableFrom": "tag_classes", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk": { + "name": "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk", + "tableFrom": "tag_classes", + "tableTo": "tag_types", + "columnsFrom": [ + "tag_type_code", + "project_id" + ], + "columnsTo": [ + "code", + "project_id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_code_in_project": { + "name": "uniq_code_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfield_options": { + "name": "tag_subfield_options", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfield_options_project_id_projects_id_fk": { + "name": "tag_subfield_options_project_id_projects_id_fk", + "tableFrom": "tag_subfield_options", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_attribute_project_code": { + "name": "uniq_attribute_project_code", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "attributes_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfields": { + "name": "tag_subfields", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfields_project_id_projects_id_fk": { + "name": "tag_subfields_project_id_projects_id_fk", + "tableFrom": "tag_subfields", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_tag_type_attribute": { + "name": "uniq_tag_type_attribute", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_code", + "attributes_id" + ] + }, + "uniq_attribute_id_project": { + "name": "uniq_attribute_id_project", + "nullsNotDistinct": false, + "columns": [ + "attributes_id", + "project_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_type_class_form_mappings": { + "name": "tag_type_class_form_mappings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_label": { + "name": "tag_type_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "class_label": { + "name": "class_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "ep": { + "name": "ep", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_mapping_in_project": { + "name": "uniq_mapping_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_label", + "class_label", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_types": { + "name": "tag_types", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_types_project_id_projects_id_fk": { + "name": "tag_types_project_id_projects_id_fk", + "tableFrom": "tag_types", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "tag_types_code_project_id_pk": { + "name": "tag_types_code_project_id_pk", + "columns": [ + "code", + "project_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tags": { + "name": "tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tags_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "tag_type": { + "name": "tag_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "class": { + "name": "class", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tags_contract_item_id_contract_items_id_fk": { + "name": "tags_contract_item_id_contract_items_id_fk", + "tableFrom": "tags", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_form_id_forms_id_fk": { + "name": "tags_form_id_forms_id_fk", + "tableFrom": "tags", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_item_tag_no_unique": { + "name": "contract_item_tag_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_item_id", + "tag_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_data_report_temps": { + "name": "vendor_data_report_temps", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_data_report_temps_contract_item_id_contract_items_id_fk": { + "name": "vendor_data_report_temps_contract_item_id_contract_items_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_data_report_temps_form_id_forms_id_fk": { + "name": "vendor_data_report_temps_form_id_forms_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.change_logs": { + "name": "change_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "changed_fields": { + "name": "changed_fields", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "old_values": { + "name": "old_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "new_values": { + "name": "new_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_name": { + "name": "user_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_synced": { + "name": "is_synced", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "sync_attempts": { + "name": "sync_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_sync_error": { + "name": "last_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "synced_at": { + "name": "synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "target_systems": { + "name": "target_systems", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + } + }, + "indexes": { + "idx_change_logs_contract_synced": { + "name": "idx_change_logs_contract_synced", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_synced", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_created_at": { + "name": "idx_change_logs_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_entity": { + "name": "idx_change_logs_entity", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_sync_attempts": { + "name": "idx_change_logs_sync_attempts", + "columns": [ + { + "expression": "sync_attempts", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.document_attachments": { + "name": "document_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "document_attachments_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "revision_id": { + "name": "revision_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "upload_id": { + "name": "upload_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "file_id": { + "name": "file_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "dolce_file_path": { + "name": "dolce_file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "document_attachments_revision_id_revisions_id_fk": { + "name": "document_attachments_revision_id_revisions_id_fk", + "tableFrom": "document_attachments", + "tableTo": "revisions", + "columnsFrom": [ + "revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.documents": { + "name": "documents", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "documents_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "drawing_move_gbn": { + "name": "drawing_move_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "discipline": { + "name": "discipline", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "external_document_id": { + "name": "external_document_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "external_system_type": { + "name": "external_system_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "external_synced_at": { + "name": "external_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "shi_drawing_no": { + "name": "shi_drawing_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager": { + "name": "manager", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_enm": { + "name": "manager_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_no": { + "name": "manager_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "register_group": { + "name": "register_group", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "register_group_id": { + "name": "register_group_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "create_user_no": { + "name": "create_user_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "create_user_id": { + "name": "create_user_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "create_user_enm": { + "name": "create_user_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_contract_doc_status": { + "name": "unique_contract_doc_status", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_contract_vendor_doc": { + "name": "unique_contract_vendor_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"vendor_doc_number\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_external_doc": { + "name": "unique_external_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_system_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"external_document_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "drawing_kind_idx": { + "name": "drawing_kind_idx", + "columns": [ + { + "expression": "drawing_kind", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "documents_contract_id_contracts_id_fk": { + "name": "documents_contract_id_contracts_id_fk", + "tableFrom": "documents", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.issue_stages": { + "name": "issue_stages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "issue_stages_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_name": { + "name": "stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "plan_date": { + "name": "plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "actual_date": { + "name": "actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "stage_status": { + "name": "stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "stage_order": { + "name": "stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "priority": { + "name": "priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'MEDIUM'" + }, + "assignee_id": { + "name": "assignee_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "assignee_name": { + "name": "assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "reminder_days": { + "name": "reminder_days", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_document_stage": { + "name": "unique_document_stage", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_stage_order": { + "name": "document_stage_order", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "issue_stages_document_id_documents_id_fk": { + "name": "issue_stages_document_id_documents_id_fk", + "tableFrom": "issue_stages", + "tableTo": "documents", + "columnsFrom": [ + "document_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.revisions": { + "name": "revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "revisions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "issue_stage_id": { + "name": "issue_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "revision": { + "name": "revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "uploader_type": { + "name": "uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'vendor'" + }, + "uploader_id": { + "name": "uploader_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploader_name": { + "name": "uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "usage": { + "name": "usage", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "revision_status": { + "name": "revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'SUBMITTED'" + }, + "submitted_date": { + "name": "submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "review_start_date": { + "name": "review_start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "approved_date": { + "name": "approved_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "rejected_date": { + "name": "rejected_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "reviewer_id": { + "name": "reviewer_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "review_comments": { + "name": "review_comments", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "external_upload_id": { + "name": "external_upload_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_stage_rev": { + "name": "unique_stage_rev", + "columns": [ + { + "expression": "issue_stage_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "revision", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_batches": { + "name": "sync_batches", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "batch_size": { + "name": "batch_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "retry_count": { + "name": "retry_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "change_log_ids": { + "name": "change_log_ids", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "success_count": { + "name": "success_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "failure_count": { + "name": "failure_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sync_metadata": { + "name": "sync_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_batches_contract_system": { + "name": "idx_sync_batches_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_status": { + "name": "idx_sync_batches_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_created_at": { + "name": "idx_sync_batches_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_configs": { + "name": "sync_configs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "sync_interval_minutes": { + "name": "sync_interval_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 30 + }, + "last_successful_sync": { + "name": "last_successful_sync", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_sync_attempt": { + "name": "last_sync_attempt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "endpoint_url": { + "name": "endpoint_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "auth_token": { + "name": "auth_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "api_version": { + "name": "api_version", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'v1'" + }, + "max_batch_size": { + "name": "max_batch_size", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 100 + }, + "retry_max_attempts": { + "name": "retry_max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_configs_contract_system": { + "name": "idx_sync_configs_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sync_configs_contract_id_contracts_id_fk": { + "name": "sync_configs_contract_id_contracts_id_fk", + "tableFrom": "sync_configs", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_attachments": { + "name": "vendor_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'GENERAL'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_attachments_vendor_id_vendors_id_fk": { + "name": "vendor_attachments_vendor_id_vendors_id_fk", + "tableFrom": "vendor_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidates": { + "name": "vendor_candidates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidates_vendor_id_vendors_id_fk": { + "name": "vendor_candidates_vendor_id_vendors_id_fk", + "tableFrom": "vendor_candidates", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_contacts": { + "name": "vendor_contacts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contact_name": { + "name": "contact_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_position": { + "name": "contact_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "is_primary": { + "name": "is_primary", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_contacts_vendor_id_vendors_id_fk": { + "name": "vendor_contacts_vendor_id_vendors_id_fk", + "tableFrom": "vendor_contacts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_items": { + "name": "vendor_possible_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_items_vendor_id_vendors_id_fk": { + "name": "vendor_possible_items_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_items_item_code_items_item_code_fk": { + "name": "vendor_possible_items_item_code_items_item_code_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_materials": { + "name": "vendor_possible_materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_materials_vendor_id_vendors_id_fk": { + "name": "vendor_possible_materials_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_materials_item_code_materials_item_code_fk": { + "name": "vendor_possible_materials_item_code_materials_item_code_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "materials", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_types": { + "name": "vendor_types", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_types_code_unique": { + "name": "vendor_types_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors": { + "name": "vendors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "vendor_type_id": { + "name": "vendor_type_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_vendor_type_id_vendor_types_id_fk": { + "name": "vendors_vendor_type_id_vendor_types_id_fk", + "tableFrom": "vendors", + "tableTo": "vendor_types", + "columnsFrom": [ + "vendor_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tasks": { + "name": "tasks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'todo'" + }, + "label": { + "name": "label", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'bug'" + }, + "priority": { + "name": "priority", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'low'" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "current_timestamp" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tasks_code_unique": { + "name": "tasks_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidate_logs": { + "name": "vendor_candidate_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_candidate_id": { + "name": "vendor_candidate_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk": { + "name": "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "vendor_candidates", + "columnsFrom": [ + "vendor_candidate_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_candidate_logs_user_id_users_id_fk": { + "name": "vendor_candidate_logs_user_id_users_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors_logs": { + "name": "vendors_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_logs_vendor_id_vendors_id_fk": { + "name": "vendors_logs_vendor_id_vendors_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendors_logs_user_id_users_id_fk": { + "name": "vendors_logs_user_id_users_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract": { + "name": "basic_contract", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_id": { + "name": "template_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requested_by": { + "name": "requested_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "basic_contract_template_id_basic_contract_templates_id_fk": { + "name": "basic_contract_template_id_basic_contract_templates_id_fk", + "tableFrom": "basic_contract", + "tableTo": "basic_contract_templates", + "columnsFrom": [ + "template_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_vendor_id_vendors_id_fk": { + "name": "basic_contract_vendor_id_vendors_id_fk", + "tableFrom": "basic_contract", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_requested_by_users_id_fk": { + "name": "basic_contract_requested_by_users_id_fk", + "tableFrom": "basic_contract", + "tableTo": "users", + "columnsFrom": [ + "requested_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract_templates": { + "name": "basic_contract_templates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_templates_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_name": { + "name": "template_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "validity_period": { + "name": "validity_period", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.incoterms": { + "name": "incoterms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(20)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "incoterms_created_by_users_id_fk": { + "name": "incoterms_created_by_users_id_fk", + "tableFrom": "incoterms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payment_terms": { + "name": "payment_terms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "payment_terms_created_by_users_id_fk": { + "name": "payment_terms_created_by_users_id_fk", + "tableFrom": "payment_terms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pr_items": { + "name": "pr_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "pr_items", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_attachments": { + "name": "procurement_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "procurement_rfq_details_id": { + "name": "procurement_rfq_details_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk": { + "name": "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfq_details", + "columnsFrom": [ + "procurement_rfq_details_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_created_by_users_id_fk": { + "name": "procurement_attachments_created_by_users_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "attachment_type_check": { + "name": "attachment_type_check", + "value": "\"procurement_attachments\".\"procurement_rfqs_id\" IS NOT NULL OR \"procurement_attachments\".\"procurement_rfq_details_id\" IS NOT NULL" + } + }, + "isRLSEnabled": false + }, + "public.procurement_quotation_items": { + "name": "procurement_quotation_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pr_item_id": { + "name": "pr_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "material_code": { + "name": "material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "uom": { + "name": "uom", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "unit_price": { + "name": "unit_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "vendor_material_code": { + "name": "vendor_material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_material_description": { + "name": "vendor_material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "lead_time_in_days": { + "name": "lead_time_in_days", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_rate": { + "name": "discount_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_amount": { + "name": "discount_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_alternative": { + "name": "is_alternative", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_recommended": { + "name": "is_recommended", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_quotation_items_pr_item_id_pr_items_id_fk": { + "name": "procurement_quotation_items_pr_item_id_pr_items_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "pr_items", + "columnsFrom": [ + "pr_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_attachments": { + "name": "procurement_rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_uploaded_by_users_id_fk": { + "name": "procurement_rfq_attachments_uploaded_by_users_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_comments": { + "name": "procurement_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_comments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_user_id_users_id_fk": { + "name": "procurement_rfq_comments_user_id_users_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_details": { + "name": "procurement_rfq_details", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendors_id": { + "name": "vendors_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'VV'" + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_vendors_id_vendors_id_fk": { + "name": "procurement_rfq_details_vendors_id_vendors_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "vendors", + "columnsFrom": [ + "vendors_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_rfq_details_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_incoterms_code_incoterms_code_fk": { + "name": "procurement_rfq_details_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_updated_by_users_id_fk": { + "name": "procurement_rfq_details_updated_by_users_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfqs": { + "name": "procurement_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "series": { + "name": "series", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "rfq_sealed_yn": { + "name": "rfq_sealed_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfqs_project_id_projects_id_fk": { + "name": "procurement_rfqs_project_id_projects_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_sent_by_users_id_fk": { + "name": "procurement_rfqs_sent_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_created_by_users_id_fk": { + "name": "procurement_rfqs_created_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_updated_by_users_id_fk": { + "name": "procurement_rfqs_updated_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "procurement_rfqs_rfq_code_unique": { + "name": "procurement_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_vendor_quotations": { + "name": "procurement_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_items_count": { + "name": "total_items_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sub_total": { + "name": "sub_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "tax_total": { + "name": "tax_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "discount_total": { + "name": "discount_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "estimated_delivery_date": { + "name": "estimated_delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "procurement_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_incoterms_code_incoterms_code_fk": { + "name": "procurement_vendor_quotations_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.preset_shares": { + "name": "preset_shares", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "preset_id": { + "name": "preset_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "shared_with_user_id": { + "name": "shared_with_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'read'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "preset_shares_preset_id_table_presets_id_fk": { + "name": "preset_shares_preset_id_table_presets_id_fk", + "tableFrom": "preset_shares", + "tableTo": "table_presets", + "columnsFrom": [ + "preset_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_presets": { + "name": "table_presets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_shared": { + "name": "is_shared", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_attachments": { + "name": "tech_sales_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "tech_sales_rfq_id": { + "name": "tech_sales_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "tech_sales_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_attachments_created_by_users_id_fk": { + "name": "tech_sales_attachments_created_by_users_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comment_attachments": { + "name": "tech_sales_rfq_comment_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk": { + "name": "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk": { + "name": "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comments": { + "name": "tech_sales_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_user_id_users_id_fk": { + "name": "tech_sales_rfq_comments_user_id_users_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfqs": { + "name": "tech_sales_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_shipbuilding_id": { + "name": "item_shipbuilding_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "bidding_project_id": { + "name": "bidding_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_snapshot": { + "name": "project_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "series_snapshot": { + "name": "series_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk": { + "name": "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "item_shipbuilding", + "columnsFrom": [ + "item_shipbuilding_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk": { + "name": "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bidding_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_sent_by_users_id_fk": { + "name": "tech_sales_rfqs_sent_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_created_by_users_id_fk": { + "name": "tech_sales_rfqs_created_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_updated_by_users_id_fk": { + "name": "tech_sales_rfqs_updated_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tech_sales_rfqs_rfq_code_unique": { + "name": "tech_sales_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_vendor_quotations": { + "name": "tech_sales_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "tech_sales_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rotation_attempts": { + "name": "ocr_rotation_attempts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "rotation": { + "name": "rotation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "tables_found": { + "name": "tables_found", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "text_quality": { + "name": "text_quality", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "keyword_count": { + "name": "keyword_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "score": { + "name": "score", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "extracted_rows_count": { + "name": "extracted_rows_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_rotation_attempts_session_id_ocr_sessions_id_fk": { + "name": "ocr_rotation_attempts_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rotation_attempts", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rows": { + "name": "ocr_rows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "table_id": { + "name": "table_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "row_index": { + "name": "row_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "report_no": { + "name": "report_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "no": { + "name": "no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "identification_no": { + "name": "identification_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_no": { + "name": "joint_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_type": { + "name": "joint_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "welding_date": { + "name": "welding_date", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "source_table": { + "name": "source_table", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "source_row": { + "name": "source_row", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_ocr_row_unique": { + "name": "idx_ocr_row_unique", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "report_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "ocr_rows_table_id_ocr_tables_id_fk": { + "name": "ocr_rows_table_id_ocr_tables_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_tables", + "columnsFrom": [ + "table_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_session_id_ocr_sessions_id_fk": { + "name": "ocr_rows_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_user_id_users_id_fk": { + "name": "ocr_rows_user_id_users_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_sessions": { + "name": "ocr_sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "processing_time": { + "name": "processing_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "best_rotation": { + "name": "best_rotation", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_tables": { + "name": "total_tables", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_rows": { + "name": "total_rows", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "image_enhanced": { + "name": "image_enhanced", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pdf_converted": { + "name": "pdf_converted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "success": { + "name": "success", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "warnings": { + "name": "warnings", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_tables": { + "name": "ocr_tables", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "table_index": { + "name": "table_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "row_count": { + "name": "row_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_tables_session_id_ocr_sessions_id_fk": { + "name": "ocr_tables_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_tables", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.offshore_hull_work_type": { + "name": "offshore_hull_work_type", + "schema": "public", + "values": [ + "HA", + "HE", + "HH", + "HM", + "NC" + ] + }, + "public.offshore_top_work_type": { + "name": "offshore_top_work_type", + "schema": "public", + "values": [ + "TM", + "TS", + "TE", + "TP" + ] + }, + "public.work_type": { + "name": "work_type", + "schema": "public", + "values": [ + "기장", + "전장", + "선실", + "배관", + "철의" + ] + }, + "public.user_domain": { + "name": "user_domain", + "schema": "public", + "values": [ + "evcp", + "partners" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": { + "public.contracts_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"contracts\".\"id\", \"contracts\".\"contract_no\", \"contracts\".\"contract_name\", \"contracts\".\"status\", \"contracts\".\"start_date\", \"contracts\".\"end_date\", \"contracts\".\"project_id\", \"projects\".\"code\", \"projects\".\"name\", \"contracts\".\"vendor_id\", \"vendors\".\"vendor_name\", \"contracts\".\"payment_terms\", \"contracts\".\"delivery_terms\", \"contracts\".\"delivery_date\", \"contracts\".\"delivery_location\", \"contracts\".\"currency\", \"contracts\".\"total_amount\", \"contracts\".\"discount\", \"contracts\".\"tax\", \"contracts\".\"shipping_fee\", \"contracts\".\"net_total\", \"contracts\".\"partial_shipping_allowed\", \"contracts\".\"partial_payment_allowed\", \"contracts\".\"remarks\", \"contracts\".\"version\", \"contracts\".\"created_at\", \"contracts\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"contracts\".\"id\"\n ) as \"has_signature\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "contracts_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.poa_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", + "name": "poa_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.project_approved_vendors": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"status\", \"vendor_types\".\"name_ko\", \"vendor_types\".\"name_en\", \"projects\".\"code\", \"projects\".\"name\", \"projects\".\"type\", \"vendor_pq_submissions\".\"submitted_at\", \"vendor_pq_submissions\".\"approved_at\" from \"vendors\" inner join \"vendor_pq_submissions\" on \"vendor_pq_submissions\".\"vendor_id\" = \"vendors\".\"id\" inner join \"projects\" on \"vendor_pq_submissions\".\"project_id\" = \"projects\".\"id\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\" where \"vendor_pq_submissions\".\"status\" = 'APPROVED'", + "name": "project_approved_vendors", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_investigations_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"vendor_id\", \"vendor_investigations\".\"pq_submission_id\", \"vendor_investigations\".\"requester_id\", \"vendor_investigations\".\"qm_manager_id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"evaluation_type\", \"vendor_investigations\".\"investigation_address\", \"vendor_investigations\".\"investigation_method\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"forecasted_at\", \"vendor_investigations\".\"requested_at\", \"vendor_investigations\".\"confirmed_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"evaluation_score\", \"vendor_investigations\".\"evaluation_result\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", requester.name as \"requesterName\", requester.email as \"requesterEmail\", qm_manager.name as \"qmManagerName\", qm_manager.email as \"qmManagerEmail\", (\n CASE \n WHEN EXISTS (\n SELECT 1 FROM vendor_investigation_attachments via \n WHERE via.investigation_id = \"vendor_investigations\".\"id\"\n ) \n THEN true \n ELSE false \n END\n ) as \"hasAttachments\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\" left join users AS requester on \"vendor_investigations\".\"requester_id\" = requester.id left join users AS qm_manager on \"vendor_investigations\".\"qm_manager_id\" = qm_manager.id", + "name": "vendor_investigations_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.cbe_view": { + "columns": {}, + "definition": "select \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"rfq_id\" as \"rfq_id\", \"cbe_evaluations\".\"vendor_id\" as \"vendor_id\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"result\" as \"result\", \"cbe_evaluations\".\"notes\" as \"notes\", \"cbe_evaluations\".\"evaluated_by\" as \"evaluated_by\", \"cbe_evaluations\".\"evaluated_at\" as \"evaluated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"name\" as \"evaluator_name\", \"users\".\"email\" as \"evaluator_email\" from \"cbe_evaluations\" inner join \"rfqs\" on \"cbe_evaluations\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"cbe_evaluations\".\"evaluated_by\" = \"users\".\"id\"", + "name": "cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.rfqs_view": { + "columns": {}, + "definition": "select \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"rfqs\".\"parent_rfq_id\" as \"parent_rfq_id\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"email\" as \"user_email\", \"users\".\"name\" as \"user_name\", (\n SELECT COUNT(*) \n FROM \"rfq_items\" \n WHERE \"rfq_items\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"item_count\", (\n SELECT COUNT(*) \n FROM \"rfq_attachments\" \n WHERE \"rfq_attachments\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"attachment_count\" from \"rfqs\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"rfqs\".\"created_by\" = \"users\".\"id\"", + "name": "rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_cbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", \"cbe_evaluations\".\"notes\" as \"cbe_note\", \"cbe_evaluations\".\"updated_at\" as \"cbe_updated\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"delivery_schedule\" as \"delivery_schedule\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_response_cbe_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"notes\" as \"response_notes\", \"vendor_responses\".\"responded_by\" as \"responded_by\", \"vendor_responses\".\"responded_at\" as \"responded_at\", \"vendor_responses\".\"updated_at\" as \"response_updated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"status\" as \"vendor_status\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"response_status\" as \"commercial_response_status\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"vendor_commercial_responses\".\"payment_terms\" as \"payment_terms\", \"vendor_commercial_responses\".\"incoterms\" as \"incoterms\", \"vendor_commercial_responses\".\"delivery_period\" as \"delivery_period\", \"vendor_commercial_responses\".\"warranty_period\" as \"warranty_period\", \"vendor_commercial_responses\".\"validity_period\" as \"validity_period\", \"vendor_commercial_responses\".\"price_breakdown\" as \"price_breakdown\", \"vendor_commercial_responses\".\"commercial_notes\" as \"commercial_notes\", \"vendor_commercial_responses\".\"created_at\" as \"commercial_created_at\", \"vendor_commercial_responses\".\"updated_at\" as \"commercial_updated_at\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"commercial_response_id\" = \"vendor_commercial_responses\".\"id\"\n ) as \"commercial_attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n AND \"vendor_response_attachments\".\"attachment_type\" = 'TECHNICAL_SPEC'\n ) as \"technical_attachment_count\", (\n SELECT MAX(\"uploaded_at\") \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"latest_attachment_date\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\"", + "name": "vendor_response_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_responses_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"created_at\" as \"rfq_created_at\", \"rfqs\".\"updated_at\" as \"rfq_updated_at\", \"rfqs\".\"created_by\" as \"rfq_created_by\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"responded_at\" as \"responded_at\", CASE WHEN \"vendor_technical_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_technical_response\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", CASE WHEN \"vendor_commercial_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_commercial_response\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"rfq_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE') left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"cbe_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\")", + "name": "vendor_responses_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_rfq_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", + "name": "vendor_rfq_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_tbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", \"vendor_technical_responses\".\"response_status\" as \"technical_response_status\", \"vendor_technical_responses\".\"summary\" as \"technical_summary\", \"vendor_technical_responses\".\"notes\" as \"technical_notes\", \"vendor_technical_responses\".\"updated_at\" as \"technical_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"rfq_evaluations\".\"notes\" as \"tbe_note\", \"rfq_evaluations\".\"updated_at\" as \"tbe_updated\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_tbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.role_view": { + "columns": {}, + "definition": "select \"roles\".\"id\" as \"id\", \"roles\".\"name\" as \"name\", \"roles\".\"description\" as \"description\", \"roles\".\"domain\" as \"domain\", \"roles\".\"created_at\" as \"created_at\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", COUNT(\"users\".\"id\") as \"user_count\" from \"roles\" left join \"user_roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" left join \"users\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"vendors\" on \"roles\".\"company_id\" = \"vendors\".\"id\" group by \"roles\".\"id\", \"vendors\".\"id\"", + "name": "role_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.user_view": { + "columns": {}, + "definition": "select \"users\".\"id\" as \"user_id\", \"users\".\"name\" as \"user_name\", \"users\".\"email\" as \"user_email\", \"users\".\"domain\" as \"user_domain\", \"users\".\"image_url\" as \"user_image\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"vendors\" on \"users\".\"company_id\" = \"vendors\".\"id\" left join \"user_roles\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" group by \"users\".\"id\", \"vendors\".\"id\"", + "name": "user_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.form_lists_view": { + "columns": {}, + "definition": "select \"tag_type_class_form_mappings\".\"id\" as \"id\", \"tag_type_class_form_mappings\".\"project_id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"tag_type_class_form_mappings\".\"tag_type_label\" as \"tag_type_label\", \"tag_type_class_form_mappings\".\"class_label\" as \"class_label\", \"tag_type_class_form_mappings\".\"form_code\" as \"form_code\", \"tag_type_class_form_mappings\".\"form_name\" as \"form_name\", \"tag_type_class_form_mappings\".\"ep\" as \"ep\", \"tag_type_class_form_mappings\".\"remark\" as \"remark\", \"tag_type_class_form_mappings\".\"created_at\" as \"created_at\", \"tag_type_class_form_mappings\".\"updated_at\" as \"updated_at\" from \"tag_type_class_form_mappings\" inner join \"projects\" on \"tag_type_class_form_mappings\".\"project_id\" = \"projects\".\"id\"", + "name": "form_lists_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.view_tag_subfields": { + "columns": { + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "definition": "select \"tag_subfields\".\"id\" as \"id\", \"tag_subfields\".\"tag_type_code\", \"tag_types\".\"description\", \"tag_subfields\".\"attributes_id\", \"tag_subfields\".\"attributes_description\", \"tag_subfields\".\"expression\", \"tag_subfields\".\"delimiter\", \"tag_subfields\".\"sort_order\", \"tag_subfields\".\"created_at\", \"tag_subfields\".\"updated_at\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\", \"projects\".\"name\" from \"tag_subfields\" inner join \"tag_types\" on (\"tag_subfields\".\"tag_type_code\" = \"tag_types\".\"code\" and \"tag_subfields\".\"project_id\" = \"tag_types\".\"project_id\") inner join \"projects\" on \"tag_subfields\".\"project_id\" = \"projects\".\"id\"", + "name": "view_tag_subfields", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.document_stages_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_count": { + "name": "stage_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_list": { + "name": "stage_list", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT\n d.id AS document_id,\n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n d.contract_id,\n (SELECT COUNT(*) FROM issue_stages WHERE document_id = d.id) AS stage_count,\n COALESCE( \n (SELECT json_agg(i.stage_name) FROM issue_stages i WHERE i.document_id = d.id), \n '[]'\n ) AS stage_list,\n d.created_at,\n d.updated_at\n FROM documents d\n", + "name": "document_stages_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.enhanced_documents_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_id": { + "name": "current_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_name": { + "name": "current_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_status": { + "name": "current_stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_order": { + "name": "current_stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_plan_date": { + "name": "current_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_actual_date": { + "name": "current_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_assignee_name": { + "name": "current_stage_assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_priority": { + "name": "current_stage_priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "days_until_due": { + "name": "days_until_due", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_overdue": { + "name": "is_overdue", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "days_difference": { + "name": "days_difference", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "total_stages": { + "name": "total_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "completed_stages": { + "name": "completed_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "progress_percentage": { + "name": "progress_percentage", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_status": { + "name": "latest_revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_submitted_date": { + "name": "latest_submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "all_stages": { + "name": "all_stages", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n WITH document_stats AS (\n SELECT \n d.id as document_id,\n COUNT(ist.id) as total_stages,\n COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) as completed_stages,\n CASE \n WHEN COUNT(ist.id) > 0 \n THEN ROUND((COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) * 100.0) / COUNT(ist.id))\n ELSE 0 \n END as progress_percentage\n FROM documents d\n LEFT JOIN issue_stages ist ON d.id = ist.document_id\n GROUP BY d.id\n ),\n current_stage_info AS (\n SELECT DISTINCT ON (document_id)\n document_id,\n id as current_stage_id,\n stage_name as current_stage_name,\n stage_status as current_stage_status,\n stage_order as current_stage_order,\n plan_date as current_stage_plan_date,\n actual_date as current_stage_actual_date,\n assignee_name as current_stage_assignee_name,\n priority as current_stage_priority,\n CASE \n WHEN actual_date IS NULL AND plan_date IS NOT NULL \n THEN plan_date - CURRENT_DATE\n ELSE NULL \n END as days_until_due,\n CASE \n WHEN actual_date IS NULL AND plan_date < CURRENT_DATE \n THEN true\n WHEN actual_date IS NOT NULL AND actual_date > plan_date \n THEN true\n ELSE false \n END as is_overdue,\n CASE \n WHEN actual_date IS NOT NULL AND plan_date IS NOT NULL \n THEN actual_date - plan_date\n ELSE NULL \n END as days_difference\n FROM issue_stages\n WHERE stage_status NOT IN ('COMPLETED', 'APPROVED')\n ORDER BY document_id, stage_order ASC, priority DESC\n ),\n latest_revision_info AS (\n SELECT DISTINCT ON (ist.document_id)\n ist.document_id,\n r.id as latest_revision_id,\n r.revision as latest_revision,\n r.revision_status as latest_revision_status,\n r.uploader_name as latest_revision_uploader_name,\n r.submitted_date as latest_submitted_date\n FROM revisions r\n JOIN issue_stages ist ON r.issue_stage_id = ist.id\n ORDER BY ist.document_id, r.created_at DESC\n ),\n -- 리비전별 첨부파일 집계\n revision_attachments AS (\n SELECT \n r.id as revision_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', da.id,\n 'revisionId', da.revision_id,\n 'fileName', da.file_name,\n 'filePath', da.file_path,\n 'fileSize', da.file_size,\n 'fileType', da.file_type,\n 'createdAt', da.created_at,\n 'updatedAt', da.updated_at\n ) ORDER BY da.created_at\n ) FILTER (WHERE da.id IS NOT NULL),\n '[]'::json\n ) as attachments\n FROM revisions r\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY r.id\n ),\n -- 스테이지별 리비전 집계 (첨부파일 포함)\n stage_revisions AS (\n SELECT \n ist.id as stage_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', r.id,\n 'issueStageId', r.issue_stage_id,\n 'revision', r.revision,\n 'uploaderType', r.uploader_type,\n 'uploaderId', r.uploader_id,\n 'uploaderName', r.uploader_name,\n 'comment', r.comment,\n 'usage', r.usage,\n 'revisionStatus', r.revision_status,\n 'submittedDate', r.submitted_date,\n 'uploadedAt', r.uploaded_at,\n 'approvedDate', r.approved_date,\n 'reviewStartDate', r.review_start_date,\n 'rejectedDate', r.rejected_date,\n 'reviewerId', r.reviewer_id,\n 'reviewerName', r.reviewer_name,\n 'reviewComments', r.review_comments,\n 'createdAt', r.created_at,\n 'updatedAt', r.updated_at,\n 'attachments', ra.attachments\n ) ORDER BY r.created_at\n ) FILTER (WHERE r.id IS NOT NULL),\n '[]'::json\n ) as revisions\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN revision_attachments ra ON r.id = ra.revision_id\n GROUP BY ist.id\n ),\n -- 문서별 스테이지 집계 (리비전 포함)\n stage_aggregation AS (\n SELECT \n ist.document_id,\n json_agg(\n json_build_object(\n 'id', ist.id,\n 'stageName', ist.stage_name,\n 'stageStatus', ist.stage_status,\n 'stageOrder', ist.stage_order,\n 'planDate', ist.plan_date,\n 'actualDate', ist.actual_date,\n 'assigneeName', ist.assignee_name,\n 'priority', ist.priority,\n 'revisions', sr.revisions\n ) ORDER BY ist.stage_order\n ) as all_stages\n FROM issue_stages ist\n LEFT JOIN stage_revisions sr ON ist.id = sr.stage_id\n GROUP BY ist.document_id\n ),\n attachment_counts AS (\n SELECT \n ist.document_id,\n COUNT(da.id) as attachment_count\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY ist.document_id\n )\n \n SELECT \n d.id as document_id,\n d.doc_number,\n d.drawing_kind,\n d.vendor_doc_number, -- ✅ 벤더 문서 번호 추가\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n -- ✅ 프로젝트 및 벤더 정보 추가\n p.code as project_code,\n v.vendor_name as vendor_name,\n v.vendor_code as vendor_code,\n \n -- 현재 스테이지 정보\n csi.current_stage_id,\n csi.current_stage_name,\n csi.current_stage_status,\n csi.current_stage_order,\n csi.current_stage_plan_date,\n csi.current_stage_actual_date,\n csi.current_stage_assignee_name,\n csi.current_stage_priority,\n \n -- 계산 필드\n csi.days_until_due,\n csi.is_overdue,\n csi.days_difference,\n \n -- 진행률 정보\n ds.total_stages,\n ds.completed_stages,\n ds.progress_percentage,\n \n -- 최신 리비전 정보\n lri.latest_revision_id,\n lri.latest_revision,\n lri.latest_revision_status,\n lri.latest_revision_uploader_name,\n lri.latest_submitted_date,\n \n -- 전체 스테이지 (리비전 및 첨부파일 포함)\n COALESCE(sa.all_stages, '[]'::json) as all_stages,\n \n -- 기타\n COALESCE(ac.attachment_count, 0) as attachment_count,\n d.created_at,\n d.updated_at\n \n FROM documents d\n -- ✅ contracts, projects, vendors 테이블 JOIN 추가\n LEFT JOIN contracts c ON d.contract_id = c.id\n LEFT JOIN projects p ON c.project_id = p.id\n LEFT JOIN vendors v ON c.vendor_id = v.id\n \n LEFT JOIN document_stats ds ON d.id = ds.document_id\n LEFT JOIN current_stage_info csi ON d.id = csi.document_id\n LEFT JOIN latest_revision_info lri ON d.id = lri.document_id\n LEFT JOIN stage_aggregation sa ON d.id = sa.document_id\n LEFT JOIN attachment_counts ac ON d.id = ac.document_id\n \n ORDER BY d.created_at DESC\n", + "name": "enhanced_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.sync_status_view": { + "columns": { + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "total_changes": { + "name": "total_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pending_changes": { + "name": "pending_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "synced_changes": { + "name": "synced_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "failed_changes": { + "name": "failed_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "last_sync_at": { + "name": "last_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_sync_at": { + "name": "next_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n WITH change_stats AS (\n SELECT \n cl.contract_id,\n sc.target_system,\n COUNT(*) as total_changes,\n COUNT(CASE WHEN cl.is_synced = false AND cl.sync_attempts < sc.retry_max_attempts THEN 1 END) as pending_changes,\n COUNT(CASE WHEN cl.is_synced = true THEN 1 END) as synced_changes,\n COUNT(CASE WHEN cl.sync_attempts >= sc.retry_max_attempts AND cl.is_synced = false THEN 1 END) as failed_changes,\n MAX(cl.synced_at) as last_sync_at\n FROM change_logs cl\n CROSS JOIN sync_configs sc \n WHERE cl.contract_id = sc.contract_id\n AND (cl.target_systems IS NULL OR cl.target_systems @> to_jsonb(sc.target_system))\n GROUP BY cl.contract_id, sc.target_system\n )\n SELECT \n cs.contract_id,\n cs.target_system,\n COALESCE(cs.total_changes, 0) as total_changes,\n COALESCE(cs.pending_changes, 0) as pending_changes,\n COALESCE(cs.synced_changes, 0) as synced_changes,\n COALESCE(cs.failed_changes, 0) as failed_changes,\n cs.last_sync_at,\n CASE \n WHEN sc.sync_enabled = true AND sc.last_successful_sync IS NOT NULL \n THEN sc.last_successful_sync + (sc.sync_interval_minutes || ' minutes')::interval\n ELSE NULL\n END as next_sync_at,\n sc.sync_enabled\n FROM sync_configs sc\n LEFT JOIN change_stats cs ON sc.contract_id = cs.contract_id AND sc.target_system = cs.target_system\n", + "name": "sync_status_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_documents_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "latest_stage_id": { + "name": "latest_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_stage_name": { + "name": "latest_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_stage_plan_date": { + "name": "latest_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_stage_actual_date": { + "name": "latest_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_type": { + "name": "latest_revision_uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT \n d.id, \n d.doc_number,\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n (SELECT id FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_id,\n (SELECT stage_name FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_name,\n (SELECT plan_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_plan_date,\n (SELECT actual_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_actual_date,\n \n (SELECT r.id FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_id,\n (SELECT r.revision FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision,\n (SELECT r.uploader_type FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_type,\n (SELECT r.uploader_name FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_name,\n \n (SELECT COUNT(*) FROM document_attachments a JOIN revisions r ON a.revision_id = r.id JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id) AS attachment_count,\n \n d.created_at,\n d.updated_at\n FROM documents d\n JOIN contracts c ON d.contract_id = c.id\n ", + "name": "vendor_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_candidates_with_vendor_info": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_candidates\".\"id\", \"vendor_candidates\".\"company_name\", \"vendor_candidates\".\"contact_email\", \"vendor_candidates\".\"contact_phone\", \"vendor_candidates\".\"tax_id\", \"vendor_candidates\".\"address\", \"vendor_candidates\".\"country\", \"vendor_candidates\".\"source\", \"vendor_candidates\".\"status\", \"vendor_candidates\".\"items\", \"vendor_candidates\".\"remark\", \"vendor_candidates\".\"created_at\", \"vendor_candidates\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"created_at\" as \"vendor_created_at\", (\n SELECT l2.\"created_at\"\n FROM \"vendor_candidate_logs\" l2\n WHERE l2.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l2.\"action\" = 'status_change'\n ORDER BY l2.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_at\", (\n SELECT u.\"name\"\n FROM \"users\" u\n JOIN \"vendor_candidate_logs\" l3\n ON l3.\"user_id\" = u.\"id\"\n WHERE l3.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l3.\"action\" = 'status_change'\n ORDER BY l3.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_by\", (\n SELECT l4.\"created_at\"\n FROM \"vendor_candidate_logs\" l4\n WHERE l4.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l4.\"action\" = 'invite_sent'\n ORDER BY l4.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_at\", (\n SELECT u2.\"name\"\n FROM \"users\" u2\n JOIN \"vendor_candidate_logs\" l5\n ON l5.\"user_id\" = u2.\"id\"\n WHERE l5.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l5.\"action\" = 'invite_sent'\n ORDER BY l5.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_by\" from \"vendor_candidates\" left join \"vendors\" on \"vendor_candidates\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "vendor_candidates_with_vendor_info", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"business_size\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"", + "name": "vendor_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", + "name": "vendor_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_materials_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_materials\".\"id\", \"vendor_possible_materials\".\"vendor_id\", \"materials\".\"item_name\", \"materials\".\"item_code\", \"materials\".\"description\", \"materials\".\"unit_of_measure\", \"materials\".\"steel_type\", \"materials\".\"grade_material\", \"vendor_possible_materials\".\"created_at\", \"vendor_possible_materials\".\"updated_at\" from \"vendor_possible_materials\" left join \"materials\" on \"vendor_possible_materials\".\"item_code\" = \"materials\".\"item_code\"", + "name": "vendor_materials_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendors_with_types": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"tax_id\" as \"tax_id\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"phone\" as \"phone\", \"vendors\".\"email\" as \"email\", \"vendors\".\"business_size\" as \"business_size\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"status\", \"vendors\".\"vendor_type_id\" as \"vendor_type_id\", \"vendors\".\"representative_name\" as \"representative_name\", \"vendors\".\"representative_birth\" as \"representative_birth\", \"vendors\".\"representative_email\" as \"representative_email\", \"vendors\".\"representative_phone\" as \"representative_phone\", \"vendors\".\"corporate_registration_number\" as \"corporate_registration_number\", \"vendors\".\"items\" as \"items\", \"vendors\".\"credit_agency\" as \"credit_agency\", \"vendors\".\"credit_rating\" as \"credit_rating\", \"vendors\".\"cash_flow_rating\" as \"cash_flow_rating\", \"vendors\".\"created_at\" as \"created_at\", \"vendors\".\"updated_at\" as \"updated_at\", \"vendor_types\".\"name_ko\" as \"vendor_type_name\", \"vendor_types\".\"name_en\" as \"vendor_type_name_en\", \"vendor_types\".\"code\" as \"vendor_type_code\", \n CASE\n WHEN \"vendors\".\"status\" = 'ACTIVE' THEN '정규업체'\n WHEN \"vendors\".\"status\" IN ('INACTIVE', 'BLACKLISTED', 'REJECTED') THEN ''\n ELSE '잠재업체'\n END\n as \"vendor_category\" from \"vendors\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\"", + "name": "vendors_with_types", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.basic_contract_view": { + "columns": {}, + "definition": "select \"basic_contract\".\"id\" as \"id\", \"basic_contract\".\"template_id\" as \"template_id\", \"basic_contract\".\"vendor_id\" as \"vendor_id\", \"basic_contract\".\"requested_by\" as \"requested_by\", \"basic_contract\".\"status\" as \"basic_contract_status\", \"basic_contract\".\"created_at\" as \"created_at\", \"basic_contract\".\"updated_at\" as \"updated_at\", \"basic_contract\".\"updated_at\" as \"completed_at\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"email\" as \"vendor_email\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"users\".\"name\" as \"user_name\", \"basic_contract_templates\".\"template_name\" as \"template_name\", \"basic_contract_templates\".\"validity_period\" as \"validityPeriod\", \"basic_contract_templates\".\"file_path\" as \"file_path\", \"basic_contract_templates\".\"file_name\" as \"file_name\", \"basic_contract\".\"file_path\" as \"signed_file_path\" from \"basic_contract\" left join \"vendors\" on \"basic_contract\".\"vendor_id\" = \"vendors\".\"id\" left join \"users\" on \"basic_contract\".\"requested_by\" = \"users\".\"id\" left join \"basic_contract_templates\" on \"basic_contract\".\"template_id\" = \"basic_contract_templates\".\"id\"", + "name": "basic_contract_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.pr_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"pr_items\".\"id\", \"pr_items\".\"procurement_rfqs_id\", \"pr_items\".\"rfq_item\", \"pr_items\".\"pr_item\", \"pr_items\".\"pr_no\", \"pr_items\".\"material_code\", \"pr_items\".\"material_category\", \"pr_items\".\"acc\", \"pr_items\".\"material_description\", \"pr_items\".\"size\", \"pr_items\".\"delivery_date\", \"pr_items\".\"quantity\", \"pr_items\".\"uom\", \"pr_items\".\"gross_weight\", \"pr_items\".\"gw_uom\", \"pr_items\".\"spec_no\", \"pr_items\".\"spec_url\", \"pr_items\".\"tracking_no\", \"pr_items\".\"major_yn\", \"pr_items\".\"project_def\", \"pr_items\".\"project_sc\", \"pr_items\".\"project_kl\", \"pr_items\".\"project_lc\", \"pr_items\".\"project_dl\", \"pr_items\".\"remark\", \"procurement_rfqs\".\"rfq_code\", \"procurement_rfqs\".\"item_code\", \"procurement_rfqs\".\"item_name\" from \"pr_items\" left join \"procurement_rfqs\" on \"pr_items\".\"procurement_rfqs_id\" = \"procurement_rfqs\".\"id\"", + "name": "pr_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfq_details_view": { + "columns": {}, + "definition": "select \"rfq_details\".\"id\" as \"detail_id\", \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfqs\".\"item_code\" as \"item_code\", \"rfqs\".\"item_name\" as \"item_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"country\" as \"vendor_country\", \"rfq_details\".\"currency\" as \"currency\", \"payment_terms\".\"code\" as \"payment_terms_code\", \"payment_terms\".\"description\" as \"payment_terms_description\", \"incoterms\".\"code\" as \"incoterms_code\", \"incoterms\".\"description\" as \"incoterms_description\", \"rfq_details\".\"incoterms_detail\" as \"incoterms_detail\", \"rfq_details\".\"delivery_date\" as \"delivery_date\", \"rfq_details\".\"tax_code\" as \"tax_code\", \"rfq_details\".\"place_of_shipping\" as \"place_of_shipping\", \"rfq_details\".\"place_of_destination\" as \"place_of_destination\", \"rfq_details\".\"material_price_related_yn\" as \"material_price_related_yn\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"rfq_details\".\"updated_at\" as \"updated_at\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\"\n ) as \"pr_items_count\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\" \n AND major_yn = true\n ) as \"major_items_count\", (\n SELECT COUNT(*) \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"comment_count\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_comment_date\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\" AND is_vendor_comment = true\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_vendor_comment_date\", (\n SELECT COUNT(*) \n FROM procurement_rfq_attachments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) > 0\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"has_quotation\", (\n SELECT status\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_status\", (\n SELECT total_price\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_total_price\", (\n SELECT quotation_version\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"quotation_version\", (\n SELECT COUNT(DISTINCT quotation_version)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"quotation_version_count\", (\n SELECT created_at\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"last_quotation_date\" from \"procurement_rfq_details\" \"rfq_details\" left join \"procurement_rfqs\" \"rfqs\" on \"rfq_details\".\"procurement_rfqs_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"rfq_details\".\"vendors_id\" = \"vendors\".\"id\" left join \"payment_terms\" on \"rfq_details\".\"payment_terms_code\" = \"payment_terms\".\"code\" left join \"incoterms\" on \"rfq_details\".\"incoterms_code\" = \"incoterms\".\"code\" left join \"users\" \"updated_by_user\" on \"rfq_details\".\"updated_by\" = \"updated_by_user\".\"id\"", + "name": "procurement_rfq_details_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfqs_view": { + "columns": {}, + "definition": "select \"procurement_rfqs\".\"id\" as \"id\", \"procurement_rfqs\".\"rfq_code\" as \"rfq_code\", \"procurement_rfqs\".\"series\" as \"series\", \"procurement_rfqs\".\"rfq_sealed_yn\" as \"rfq_sealed_yn\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"procurement_rfqs\".\"item_code\" as \"item_code\", \"procurement_rfqs\".\"item_name\" as \"item_name\", \"procurement_rfqs\".\"status\" as \"status\", \"procurement_rfqs\".\"pic_code\" as \"pic_code\", \"procurement_rfqs\".\"rfq_send_date\" as \"rfq_send_date\", \"procurement_rfqs\".\"due_date\" as \"due_date\", (\n SELECT MIN(submitted_at)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"procurement_rfqs\".\"id\"\n AND submitted_at IS NOT NULL\n ) as \"earliest_quotation_submitted_at\", \"created_by_user\".\"name\" as \"created_by_user_name\", \"sent_by_user\".\"name\" as \"sent_by_user_name\", \"procurement_rfqs\".\"updated_at\" as \"updated_at\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"procurement_rfqs\".\"remark\" as \"remark\", (\n SELECT material_code \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"major_item_material_code\", (\n SELECT pr_no \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"po_no\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n ) as \"pr_items_count\" from \"procurement_rfqs\" left join \"projects\" on \"procurement_rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" \"created_by_user\" on \"procurement_rfqs\".\"created_by\" = \"created_by_user\".\"id\" left join \"users\" \"updated_by_user\" on \"procurement_rfqs\".\"updated_by\" = \"updated_by_user\".\"id\" left join \"users\" \"sent_by_user\" on \"procurement_rfqs\".\"sent_by\" = \"sent_by_user\".\"id\"", + "name": "procurement_rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + } + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db/migrations/meta/0119_snapshot.json b/db/migrations/meta/0119_snapshot.json new file mode 100644 index 00000000..6e580acf --- /dev/null +++ b/db/migrations/meta/0119_snapshot.json @@ -0,0 +1,12034 @@ +{ + "id": "6148230e-f179-4b94-a283-dae33f27b4a1", + "prevId": "486b96c5-7ead-4fac-8e25-ee386b0c5b92", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.companies": { + "name": "companies", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "companies_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "taxID": { + "name": "taxID", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_envelopes": { + "name": "contract_envelopes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_envelopes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "envelope_id": { + "name": "envelope_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": true + }, + "document_id": { + "name": "document_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": false + }, + "envelope_status": { + "name": "envelope_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_envelopes_contract_id_contracts_id_fk": { + "name": "contract_envelopes_contract_id_contracts_id_fk", + "tableFrom": "contract_envelopes", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_items": { + "name": "contract_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_items_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_id": { + "name": "item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "unit_price": { + "name": "unit_price", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "total_line_amount": { + "name": "total_line_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_items_contract_item_idx": { + "name": "contract_items_contract_item_idx", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "contract_items_contract_id_contracts_id_fk": { + "name": "contract_items_contract_id_contracts_id_fk", + "tableFrom": "contract_items", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_items_item_id_items_id_fk": { + "name": "contract_items_item_id_items_id_fk", + "tableFrom": "contract_items", + "tableTo": "items", + "columnsFrom": [ + "item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_items_contract_id_item_id_unique": { + "name": "contract_items_contract_id_item_id_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_id", + "item_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_signers": { + "name": "contract_signers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_signers_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "envelope_id": { + "name": "envelope_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_contact_id": { + "name": "vendor_contact_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "signer_type": { + "name": "signer_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'VENDOR'" + }, + "signer_email": { + "name": "signer_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "signer_name": { + "name": "signer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "signer_position": { + "name": "signer_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "signer_status": { + "name": "signer_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "signed_at": { + "name": "signed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_signers_envelope_id_contract_envelopes_id_fk": { + "name": "contract_signers_envelope_id_contract_envelopes_id_fk", + "tableFrom": "contract_signers", + "tableTo": "contract_envelopes", + "columnsFrom": [ + "envelope_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_signers_vendor_contact_id_vendor_contacts_id_fk": { + "name": "contract_signers_vendor_contact_id_vendor_contacts_id_fk", + "tableFrom": "contract_signers", + "tableTo": "vendor_contacts", + "columnsFrom": [ + "vendor_contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contracts": { + "name": "contracts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contracts_project_id_projects_id_fk": { + "name": "contracts_project_id_projects_id_fk", + "tableFrom": "contracts", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contracts_vendor_id_vendors_id_fk": { + "name": "contracts_vendor_id_vendors_id_fk", + "tableFrom": "contracts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contracts_contract_no_unique": { + "name": "contracts_contract_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.poa": { + "name": "poa", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "original_contract_no": { + "name": "original_contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "original_contract_name": { + "name": "original_contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_status": { + "name": "original_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "poa_original_contract_no_contracts_contract_no_fk": { + "name": "poa_original_contract_no_contracts_contract_no_fk", + "tableFrom": "poa", + "tableTo": "contracts", + "columnsFrom": [ + "original_contract_no" + ], + "columnsTo": [ + "contract_no" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_project_id_projects_id_fk": { + "name": "poa_project_id_projects_id_fk", + "tableFrom": "poa", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_vendor_id_vendors_id_fk": { + "name": "poa_vendor_id_vendors_id_fk", + "tableFrom": "poa", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_hull": { + "name": "item_offshore_hull", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_hull_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_hull_item_code_items_item_code_fk": { + "name": "item_offshore_hull_item_code_items_item_code_fk", + "tableFrom": "item_offshore_hull", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_top": { + "name": "item_offshore_top", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_top_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_top_item_code_items_item_code_fk": { + "name": "item_offshore_top_item_code_items_item_code_fk", + "tableFrom": "item_offshore_top", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_shipbuilding": { + "name": "item_shipbuilding", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ship_types": { + "name": "ship_types", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'OPTION'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_shipbuilding_item_code_items_item_code_fk": { + "name": "item_shipbuilding_item_code_items_item_code_fk", + "tableFrom": "item_shipbuilding", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.items": { + "name": "items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_no": { + "name": "project_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "package_code": { + "name": "package_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "sm_code": { + "name": "sm_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "items_item_code_unique": { + "name": "items_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.materials": { + "name": "materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "materials_item_code_unique": { + "name": "materials_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias": { + "name": "pq_criterias", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "check_point": { + "name": "check_point", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "group_name": { + "name": "group_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias_extension": { + "name": "pq_criterias_extension", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_criteria_id": { + "name": "pq_criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_info": { + "name": "contract_info", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "additional_requirement": { + "name": "additional_requirement", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk": { + "name": "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "pq_criterias", + "columnsFrom": [ + "pq_criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "pq_criterias_extension_project_id_projects_id_fk": { + "name": "pq_criterias_extension_project_id_projects_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_criteria_attachments": { + "name": "vendor_criteria_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_criteria_answer_id": { + "name": "vendor_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_criteria_attachments", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigation_attachments": { + "name": "vendor_investigation_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "investigation_id": { + "name": "investigation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'REPORT'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { + "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", + "tableFrom": "vendor_investigation_attachments", + "tableTo": "vendor_investigations", + "columnsFrom": [ + "investigation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigations": { + "name": "vendor_investigations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigations_vendor_id_vendors_id_fk": { + "name": "vendor_investigations_vendor_id_vendors_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk": { + "name": "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendor_pq_submissions", + "columnsFrom": [ + "pq_submission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "vendor_investigations_requester_id_users_id_fk": { + "name": "vendor_investigations_requester_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_qm_manager_id_users_id_fk": { + "name": "vendor_investigations_qm_manager_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "qm_manager_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_submissions": { + "name": "vendor_pq_submissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_number": { + "name": "pq_number", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_pq_submission": { + "name": "unique_pq_submission", + "columns": [ + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_pq_submissions_requester_id_users_id_fk": { + "name": "vendor_pq_submissions_requester_id_users_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_pq_submissions_vendor_id_vendors_id_fk": { + "name": "vendor_pq_submissions_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_submissions_project_id_projects_id_fk": { + "name": "vendor_pq_submissions_project_id_projects_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_pq_submissions_pq_number_unique": { + "name": "vendor_pq_submissions_pq_number_unique", + "nullsNotDistinct": false, + "columns": [ + "pq_number" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_criteria_answers": { + "name": "vendor_pq_criteria_answers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "criteria_id": { + "name": "criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "answer": { + "name": "answer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_criteria_answers_vendor_id_vendors_id_fk": { + "name": "vendor_pq_criteria_answers_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": { + "name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "pq_criterias", + "columnsFrom": [ + "criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_project_id_projects_id_fk": { + "name": "vendor_pq_criteria_answers_project_id_projects_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_review_logs": { + "name": "vendor_pq_review_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_pq_criteria_answer_id": { + "name": "vendor_pq_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "reviewer_comment": { + "name": "reviewer_comment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_pq_review_logs", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_pq_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_project_pqs": { + "name": "vendor_project_pqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_project_pqs_vendor_id_vendors_id_fk": { + "name": "vendor_project_pqs_vendor_id_vendors_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_project_pqs_project_id_projects_id_fk": { + "name": "vendor_project_pqs_project_id_projects_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bidding_projects": { + "name": "bidding_projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "proj_nm": { + "name": "proj_nm", + "type": "varchar(90)", + "primaryKey": false, + "notNull": false + }, + "sector": { + "name": "sector", + "type": "char(1)", + "primaryKey": false, + "notNull": false + }, + "proj_msrm": { + "name": "proj_msrm", + "type": "numeric(3, 0)", + "primaryKey": false, + "notNull": false + }, + "kunnr": { + "name": "kunnr", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "kunnr_nm": { + "name": "kunnr_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "cls_1": { + "name": "cls_1", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "cls1_nm": { + "name": "cls1_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "ptype": { + "name": "ptype", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "ptype_nm": { + "name": "ptype_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_cd": { + "name": "pmodel_cd", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "pmodel_nm": { + "name": "pmodel_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_sz": { + "name": "pmodel_sz", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "pmodel_uom": { + "name": "pmodel_uom", + "type": "char(5)", + "primaryKey": false, + "notNull": false + }, + "txt04": { + "name": "txt04", + "type": "char(4)", + "primaryKey": false, + "notNull": false + }, + "txt30": { + "name": "txt30", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "estm_pm": { + "name": "estm_pm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "bidding_projects_pspid_unique": { + "name": "bidding_projects_pspid_unique", + "nullsNotDistinct": false, + "columns": [ + "pspid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_series": { + "name": "project_series", + "schema": "", + "columns": { + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "sers_no": { + "name": "sers_no", + "type": "char(3)", + "primaryKey": false, + "notNull": true + }, + "sc_dt": { + "name": "sc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "kl_dt": { + "name": "kl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "lc_dt": { + "name": "lc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dl_dt": { + "name": "dl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dock_no": { + "name": "dock_no", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "dock_nm": { + "name": "dock_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "proj_no": { + "name": "proj_no", + "type": "char(24)", + "primaryKey": false, + "notNull": false + }, + "post1": { + "name": "post1", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "project_sersNo_unique": { + "name": "project_sersNo_unique", + "columns": [ + { + "expression": "pspid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sers_no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "project_series_pspid_bidding_projects_pspid_fk": { + "name": "project_series_pspid_bidding_projects_pspid_fk", + "tableFrom": "project_series", + "tableTo": "bidding_projects", + "columnsFrom": [ + "pspid" + ], + "columnsTo": [ + "pspid" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projects": { + "name": "projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cbe_evaluations": { + "name": "cbe_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluated_by": { + "name": "evaluated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluated_at": { + "name": "evaluated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "result": { + "name": "result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "total_cost": { + "name": "total_cost", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_schedule": { + "name": "delivery_schedule", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "cbe_evaluations_rfq_id_rfqs_id_fk": { + "name": "cbe_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_vendor_id_vendors_id_fk": { + "name": "cbe_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_evaluated_by_users_id_fk": { + "name": "cbe_evaluations_evaluated_by_users_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "users", + "columnsFrom": [ + "evaluated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_attachments": { + "name": "rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_attachments_rfq_id_rfqs_id_fk": { + "name": "rfq_attachments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_vendor_id_vendors_id_fk": { + "name": "rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_attachments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_cbe_id_cbe_evaluations_id_fk": { + "name": "rfq_attachments_cbe_id_cbe_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "cbe_evaluations", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_comment_id_rfq_comments_id_fk": { + "name": "rfq_attachments_comment_id_rfq_comments_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_comments": { + "name": "rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "comment_text": { + "name": "comment_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "commented_by": { + "name": "commented_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_comments_rfq_id_rfqs_id_fk": { + "name": "rfq_comments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_vendor_id_vendors_id_fk": { + "name": "rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_commented_by_users_id_fk": { + "name": "rfq_comments_commented_by_users_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "commented_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_comments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_cbe_id_vendor_responses_id_fk": { + "name": "rfq_comments_cbe_id_vendor_responses_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_evaluations": { + "name": "rfq_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "eval_type": { + "name": "eval_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "result": { + "name": "result", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_evaluations_rfq_id_rfqs_id_fk": { + "name": "rfq_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_evaluations_vendor_id_vendors_id_fk": { + "name": "rfq_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_items": { + "name": "rfq_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_items_rfq_id_rfqs_id_fk": { + "name": "rfq_items_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_items", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "rfq_items_item_code_items_item_code_fk": { + "name": "rfq_items_item_code_items_item_code_fk", + "tableFrom": "rfq_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfqs": { + "name": "rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "bid_project_id": { + "name": "bid_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false, + "default": "'PURCHASE'" + }, + "parent_rfq_id": { + "name": "parent_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfqs_project_id_projects_id_fk": { + "name": "rfqs_project_id_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_bid_project_id_bidding_projects_id_fk": { + "name": "rfqs_bid_project_id_bidding_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bid_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_created_by_users_id_fk": { + "name": "rfqs_created_by_users_id_fk", + "tableFrom": "rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_parent_rfq_id_rfqs_id_fk": { + "name": "rfqs_parent_rfq_id_rfqs_id_fk", + "tableFrom": "rfqs", + "tableTo": "rfqs", + "columnsFrom": [ + "parent_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "rfqs_rfq_code_unique": { + "name": "rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_commercial_responses": { + "name": "vendor_commercial_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "total_price": { + "name": "total_price", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_period": { + "name": "delivery_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "warranty_period": { + "name": "warranty_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "validity_period": { + "name": "validity_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "price_breakdown": { + "name": "price_breakdown", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "commercial_notes": { + "name": "commercial_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_commercial_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_commercial_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_commercial_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_attachments": { + "name": "vendor_response_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "technical_response_id": { + "name": "technical_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "commercial_response_id": { + "name": "commercial_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_attachments_response_id_vendor_responses_id_fk": { + "name": "vendor_response_attachments_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk": { + "name": "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_technical_responses", + "columnsFrom": [ + "technical_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk": { + "name": "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_commercial_responses", + "columnsFrom": [ + "commercial_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_responses": { + "name": "vendor_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'REVIEWING'" + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "responded_by": { + "name": "responded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "responded_at": { + "name": "responded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "vendor_response_unique": { + "name": "vendor_response_unique", + "columns": [ + { + "expression": "rfq_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_responses_rfq_id_rfqs_id_fk": { + "name": "vendor_responses_rfq_id_rfqs_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_responses_vendor_id_vendors_id_fk": { + "name": "vendor_responses_vendor_id_vendors_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_technical_responses": { + "name": "vendor_technical_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_technical_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_technical_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_technical_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.otps": { + "name": "otps", + "schema": "", + "columns": { + "email": { + "name": "email", + "type": "varchar(256)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(6)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "otpToken": { + "name": "otpToken", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "otp_expires": { + "name": "otp_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permissions": { + "name": "permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "permissions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "permission_key": { + "name": "permission_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.role_permissions": { + "name": "role_permissions", + "schema": "", + "columns": { + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "permission_id": { + "name": "permission_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "role_permissions_role_id_roles_id_fk": { + "name": "role_permissions_role_id_roles_id_fk", + "tableFrom": "role_permissions", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "role_permissions_permission_id_permissions_id_fk": { + "name": "role_permissions_permission_id_permissions_id_fk", + "tableFrom": "role_permissions", + "tableTo": "permissions", + "columnsFrom": [ + "permission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.roles": { + "name": "roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "roles_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "roles_company_id_vendors_id_fk": { + "name": "roles_company_id_vendors_id_fk", + "tableFrom": "roles", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_roles": { + "name": "user_roles", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_roles_user_id_users_id_fk": { + "name": "user_roles_user_id_users_id_fk", + "tableFrom": "user_roles", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_roles_role_id_roles_id_fk": { + "name": "user_roles_role_id_roles_id_fk", + "tableFrom": "user_roles", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "users_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'partners'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "image_url": { + "name": "image_url", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "language": { + "name": "language", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'en'" + } + }, + "indexes": {}, + "foreignKeys": { + "users_company_id_vendors_id_fk": { + "name": "users_company_id_vendors_id_fk", + "tableFrom": "users", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_entries": { + "name": "form_entries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_entries_contract_item_id_contract_items_id_fk": { + "name": "form_entries_contract_item_id_contract_items_id_fk", + "tableFrom": "form_entries", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_metas": { + "name": "form_metas", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "columns": { + "name": "columns", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_metas_project_id_projects_id_fk": { + "name": "form_metas_project_id_projects_id_fk", + "tableFrom": "form_metas", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "form_code_project_unique": { + "name": "form_code_project_unique", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.forms": { + "name": "forms", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "forms_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "eng": { + "name": "eng", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "im": { + "name": "im", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_item_form_code_unique": { + "name": "contract_item_form_code_unique", + "columns": [ + { + "expression": "contract_item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "form_code", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "forms_contract_item_id_contract_items_id_fk": { + "name": "forms_contract_item_id_contract_items_id_fk", + "tableFrom": "forms", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_class_attributes": { + "name": "tag_class_attributes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_class_attributes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "tag_class_id": { + "name": "tag_class_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "att_id": { + "name": "att_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "def_val": { + "name": "def_val", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uom_id": { + "name": "uom_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "seq": { + "name": "seq", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "tag_class_attributes_seq_idx": { + "name": "tag_class_attributes_seq_idx", + "columns": [ + { + "expression": "seq", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "tag_class_attributes_tag_class_id_tag_classes_id_fk": { + "name": "tag_class_attributes_tag_class_id_tag_classes_id_fk", + "tableFrom": "tag_class_attributes", + "tableTo": "tag_classes", + "columnsFrom": [ + "tag_class_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_att_id_in_tag_class": { + "name": "uniq_att_id_in_tag_class", + "nullsNotDistinct": false, + "columns": [ + "tag_class_id", + "att_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_classes": { + "name": "tag_classes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_classes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_classes_project_id_projects_id_fk": { + "name": "tag_classes_project_id_projects_id_fk", + "tableFrom": "tag_classes", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk": { + "name": "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk", + "tableFrom": "tag_classes", + "tableTo": "tag_types", + "columnsFrom": [ + "tag_type_code", + "project_id" + ], + "columnsTo": [ + "code", + "project_id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_code_in_project": { + "name": "uniq_code_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfield_options": { + "name": "tag_subfield_options", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfield_options_project_id_projects_id_fk": { + "name": "tag_subfield_options_project_id_projects_id_fk", + "tableFrom": "tag_subfield_options", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_attribute_project_code": { + "name": "uniq_attribute_project_code", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "attributes_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfields": { + "name": "tag_subfields", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfields_project_id_projects_id_fk": { + "name": "tag_subfields_project_id_projects_id_fk", + "tableFrom": "tag_subfields", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_tag_type_attribute": { + "name": "uniq_tag_type_attribute", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_code", + "attributes_id" + ] + }, + "uniq_attribute_id_project": { + "name": "uniq_attribute_id_project", + "nullsNotDistinct": false, + "columns": [ + "attributes_id", + "project_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_type_class_form_mappings": { + "name": "tag_type_class_form_mappings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_label": { + "name": "tag_type_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "class_label": { + "name": "class_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "ep": { + "name": "ep", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_mapping_in_project": { + "name": "uniq_mapping_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_label", + "class_label", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_types": { + "name": "tag_types", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_types_project_id_projects_id_fk": { + "name": "tag_types_project_id_projects_id_fk", + "tableFrom": "tag_types", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "tag_types_code_project_id_pk": { + "name": "tag_types_code_project_id_pk", + "columns": [ + "code", + "project_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tags": { + "name": "tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tags_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "tag_type": { + "name": "tag_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "class": { + "name": "class", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tags_contract_item_id_contract_items_id_fk": { + "name": "tags_contract_item_id_contract_items_id_fk", + "tableFrom": "tags", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_form_id_forms_id_fk": { + "name": "tags_form_id_forms_id_fk", + "tableFrom": "tags", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_item_tag_no_unique": { + "name": "contract_item_tag_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_item_id", + "tag_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_data_report_temps": { + "name": "vendor_data_report_temps", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_data_report_temps_contract_item_id_contract_items_id_fk": { + "name": "vendor_data_report_temps_contract_item_id_contract_items_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_data_report_temps_form_id_forms_id_fk": { + "name": "vendor_data_report_temps_form_id_forms_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.change_logs": { + "name": "change_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "changed_fields": { + "name": "changed_fields", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "old_values": { + "name": "old_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "new_values": { + "name": "new_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_name": { + "name": "user_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_synced": { + "name": "is_synced", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "sync_attempts": { + "name": "sync_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_sync_error": { + "name": "last_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "synced_at": { + "name": "synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "target_systems": { + "name": "target_systems", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + } + }, + "indexes": { + "idx_change_logs_contract_synced": { + "name": "idx_change_logs_contract_synced", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_synced", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_created_at": { + "name": "idx_change_logs_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_entity": { + "name": "idx_change_logs_entity", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_sync_attempts": { + "name": "idx_change_logs_sync_attempts", + "columns": [ + { + "expression": "sync_attempts", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.document_attachments": { + "name": "document_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "document_attachments_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "revision_id": { + "name": "revision_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "upload_id": { + "name": "upload_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "file_id": { + "name": "file_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "dolce_file_path": { + "name": "dolce_file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "document_attachments_revision_id_revisions_id_fk": { + "name": "document_attachments_revision_id_revisions_id_fk", + "tableFrom": "document_attachments", + "tableTo": "revisions", + "columnsFrom": [ + "revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.documents": { + "name": "documents", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "documents_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "drawing_move_gbn": { + "name": "drawing_move_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "discipline": { + "name": "discipline", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "external_document_id": { + "name": "external_document_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "external_system_type": { + "name": "external_system_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "external_synced_at": { + "name": "external_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "shi_drawing_no": { + "name": "shi_drawing_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager": { + "name": "manager", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_enm": { + "name": "manager_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_no": { + "name": "manager_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "register_group": { + "name": "register_group", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "register_group_id": { + "name": "register_group_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "create_user_no": { + "name": "create_user_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "create_user_id": { + "name": "create_user_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "create_user_enm": { + "name": "create_user_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_contract_doc_status": { + "name": "unique_contract_doc_status", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_contract_vendor_doc": { + "name": "unique_contract_vendor_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"vendor_doc_number\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_external_doc": { + "name": "unique_external_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_system_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"external_document_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "drawing_kind_idx": { + "name": "drawing_kind_idx", + "columns": [ + { + "expression": "drawing_kind", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "documents_contract_id_contracts_id_fk": { + "name": "documents_contract_id_contracts_id_fk", + "tableFrom": "documents", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.issue_stages": { + "name": "issue_stages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "issue_stages_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_name": { + "name": "stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "plan_date": { + "name": "plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "actual_date": { + "name": "actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "stage_status": { + "name": "stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "stage_order": { + "name": "stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "priority": { + "name": "priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'MEDIUM'" + }, + "assignee_id": { + "name": "assignee_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "assignee_name": { + "name": "assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "reminder_days": { + "name": "reminder_days", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_document_stage": { + "name": "unique_document_stage", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_stage_order": { + "name": "document_stage_order", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "issue_stages_document_id_documents_id_fk": { + "name": "issue_stages_document_id_documents_id_fk", + "tableFrom": "issue_stages", + "tableTo": "documents", + "columnsFrom": [ + "document_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.revisions": { + "name": "revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "revisions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "issue_stage_id": { + "name": "issue_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "revision": { + "name": "revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "uploader_type": { + "name": "uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'vendor'" + }, + "uploader_id": { + "name": "uploader_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploader_name": { + "name": "uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "usage": { + "name": "usage", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "revision_status": { + "name": "revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'SUBMITTED'" + }, + "submitted_date": { + "name": "submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "review_start_date": { + "name": "review_start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "approved_date": { + "name": "approved_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "rejected_date": { + "name": "rejected_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "reviewer_id": { + "name": "reviewer_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "review_comments": { + "name": "review_comments", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "external_upload_id": { + "name": "external_upload_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_stage_rev": { + "name": "unique_stage_rev", + "columns": [ + { + "expression": "issue_stage_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "revision", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_batches": { + "name": "sync_batches", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "batch_size": { + "name": "batch_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "retry_count": { + "name": "retry_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "change_log_ids": { + "name": "change_log_ids", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "success_count": { + "name": "success_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "failure_count": { + "name": "failure_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sync_metadata": { + "name": "sync_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_batches_contract_system": { + "name": "idx_sync_batches_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_status": { + "name": "idx_sync_batches_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_created_at": { + "name": "idx_sync_batches_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_configs": { + "name": "sync_configs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "sync_interval_minutes": { + "name": "sync_interval_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 30 + }, + "last_successful_sync": { + "name": "last_successful_sync", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_sync_attempt": { + "name": "last_sync_attempt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "endpoint_url": { + "name": "endpoint_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "auth_token": { + "name": "auth_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "api_version": { + "name": "api_version", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'v1'" + }, + "max_batch_size": { + "name": "max_batch_size", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 100 + }, + "retry_max_attempts": { + "name": "retry_max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_configs_contract_system": { + "name": "idx_sync_configs_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sync_configs_contract_id_contracts_id_fk": { + "name": "sync_configs_contract_id_contracts_id_fk", + "tableFrom": "sync_configs", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_attachments": { + "name": "vendor_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'GENERAL'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_attachments_vendor_id_vendors_id_fk": { + "name": "vendor_attachments_vendor_id_vendors_id_fk", + "tableFrom": "vendor_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidates": { + "name": "vendor_candidates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidates_vendor_id_vendors_id_fk": { + "name": "vendor_candidates_vendor_id_vendors_id_fk", + "tableFrom": "vendor_candidates", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_contacts": { + "name": "vendor_contacts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contact_name": { + "name": "contact_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_position": { + "name": "contact_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "is_primary": { + "name": "is_primary", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_contacts_vendor_id_vendors_id_fk": { + "name": "vendor_contacts_vendor_id_vendors_id_fk", + "tableFrom": "vendor_contacts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_items": { + "name": "vendor_possible_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_items_vendor_id_vendors_id_fk": { + "name": "vendor_possible_items_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_items_item_code_items_item_code_fk": { + "name": "vendor_possible_items_item_code_items_item_code_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_materials": { + "name": "vendor_possible_materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_materials_vendor_id_vendors_id_fk": { + "name": "vendor_possible_materials_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_materials_item_code_materials_item_code_fk": { + "name": "vendor_possible_materials_item_code_materials_item_code_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "materials", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_types": { + "name": "vendor_types", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_types_code_unique": { + "name": "vendor_types_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors": { + "name": "vendors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "vendor_type_id": { + "name": "vendor_type_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_vendor_type_id_vendor_types_id_fk": { + "name": "vendors_vendor_type_id_vendor_types_id_fk", + "tableFrom": "vendors", + "tableTo": "vendor_types", + "columnsFrom": [ + "vendor_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tasks": { + "name": "tasks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'todo'" + }, + "label": { + "name": "label", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'bug'" + }, + "priority": { + "name": "priority", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'low'" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "current_timestamp" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tasks_code_unique": { + "name": "tasks_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidate_logs": { + "name": "vendor_candidate_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_candidate_id": { + "name": "vendor_candidate_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk": { + "name": "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "vendor_candidates", + "columnsFrom": [ + "vendor_candidate_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_candidate_logs_user_id_users_id_fk": { + "name": "vendor_candidate_logs_user_id_users_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors_logs": { + "name": "vendors_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_logs_vendor_id_vendors_id_fk": { + "name": "vendors_logs_vendor_id_vendors_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendors_logs_user_id_users_id_fk": { + "name": "vendors_logs_user_id_users_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract": { + "name": "basic_contract", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_id": { + "name": "template_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requested_by": { + "name": "requested_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "basic_contract_template_id_basic_contract_templates_id_fk": { + "name": "basic_contract_template_id_basic_contract_templates_id_fk", + "tableFrom": "basic_contract", + "tableTo": "basic_contract_templates", + "columnsFrom": [ + "template_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_vendor_id_vendors_id_fk": { + "name": "basic_contract_vendor_id_vendors_id_fk", + "tableFrom": "basic_contract", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_requested_by_users_id_fk": { + "name": "basic_contract_requested_by_users_id_fk", + "tableFrom": "basic_contract", + "tableTo": "users", + "columnsFrom": [ + "requested_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract_templates": { + "name": "basic_contract_templates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_templates_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_name": { + "name": "template_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "validity_period": { + "name": "validity_period", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.incoterms": { + "name": "incoterms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(20)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "incoterms_created_by_users_id_fk": { + "name": "incoterms_created_by_users_id_fk", + "tableFrom": "incoterms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payment_terms": { + "name": "payment_terms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "payment_terms_created_by_users_id_fk": { + "name": "payment_terms_created_by_users_id_fk", + "tableFrom": "payment_terms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pr_items": { + "name": "pr_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "pr_items", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_attachments": { + "name": "procurement_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "procurement_rfq_details_id": { + "name": "procurement_rfq_details_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk": { + "name": "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfq_details", + "columnsFrom": [ + "procurement_rfq_details_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_created_by_users_id_fk": { + "name": "procurement_attachments_created_by_users_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "attachment_type_check": { + "name": "attachment_type_check", + "value": "\"procurement_attachments\".\"procurement_rfqs_id\" IS NOT NULL OR \"procurement_attachments\".\"procurement_rfq_details_id\" IS NOT NULL" + } + }, + "isRLSEnabled": false + }, + "public.procurement_quotation_items": { + "name": "procurement_quotation_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pr_item_id": { + "name": "pr_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "material_code": { + "name": "material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "uom": { + "name": "uom", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "unit_price": { + "name": "unit_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "vendor_material_code": { + "name": "vendor_material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_material_description": { + "name": "vendor_material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "lead_time_in_days": { + "name": "lead_time_in_days", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_rate": { + "name": "discount_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_amount": { + "name": "discount_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_alternative": { + "name": "is_alternative", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_recommended": { + "name": "is_recommended", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_quotation_items_pr_item_id_pr_items_id_fk": { + "name": "procurement_quotation_items_pr_item_id_pr_items_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "pr_items", + "columnsFrom": [ + "pr_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_attachments": { + "name": "procurement_rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_uploaded_by_users_id_fk": { + "name": "procurement_rfq_attachments_uploaded_by_users_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_comments": { + "name": "procurement_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_comments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_user_id_users_id_fk": { + "name": "procurement_rfq_comments_user_id_users_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_details": { + "name": "procurement_rfq_details", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendors_id": { + "name": "vendors_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'VV'" + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_vendors_id_vendors_id_fk": { + "name": "procurement_rfq_details_vendors_id_vendors_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "vendors", + "columnsFrom": [ + "vendors_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_rfq_details_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_incoterms_code_incoterms_code_fk": { + "name": "procurement_rfq_details_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_updated_by_users_id_fk": { + "name": "procurement_rfq_details_updated_by_users_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfqs": { + "name": "procurement_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "series": { + "name": "series", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "rfq_sealed_yn": { + "name": "rfq_sealed_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfqs_project_id_projects_id_fk": { + "name": "procurement_rfqs_project_id_projects_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_sent_by_users_id_fk": { + "name": "procurement_rfqs_sent_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_created_by_users_id_fk": { + "name": "procurement_rfqs_created_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_updated_by_users_id_fk": { + "name": "procurement_rfqs_updated_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "procurement_rfqs_rfq_code_unique": { + "name": "procurement_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_vendor_quotations": { + "name": "procurement_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_items_count": { + "name": "total_items_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sub_total": { + "name": "sub_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "tax_total": { + "name": "tax_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "discount_total": { + "name": "discount_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "estimated_delivery_date": { + "name": "estimated_delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "procurement_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_incoterms_code_incoterms_code_fk": { + "name": "procurement_vendor_quotations_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.preset_shares": { + "name": "preset_shares", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "preset_id": { + "name": "preset_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "shared_with_user_id": { + "name": "shared_with_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'read'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "preset_shares_preset_id_table_presets_id_fk": { + "name": "preset_shares_preset_id_table_presets_id_fk", + "tableFrom": "preset_shares", + "tableTo": "table_presets", + "columnsFrom": [ + "preset_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_presets": { + "name": "table_presets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_shared": { + "name": "is_shared", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_attachments": { + "name": "tech_sales_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "tech_sales_rfq_id": { + "name": "tech_sales_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "tech_sales_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_attachments_created_by_users_id_fk": { + "name": "tech_sales_attachments_created_by_users_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comment_attachments": { + "name": "tech_sales_rfq_comment_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk": { + "name": "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk": { + "name": "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comments": { + "name": "tech_sales_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_user_id_users_id_fk": { + "name": "tech_sales_rfq_comments_user_id_users_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfqs": { + "name": "tech_sales_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_shipbuilding_id": { + "name": "item_shipbuilding_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "bidding_project_id": { + "name": "bidding_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_snapshot": { + "name": "project_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "series_snapshot": { + "name": "series_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk": { + "name": "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "item_shipbuilding", + "columnsFrom": [ + "item_shipbuilding_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk": { + "name": "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bidding_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_sent_by_users_id_fk": { + "name": "tech_sales_rfqs_sent_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_created_by_users_id_fk": { + "name": "tech_sales_rfqs_created_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_updated_by_users_id_fk": { + "name": "tech_sales_rfqs_updated_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tech_sales_rfqs_rfq_code_unique": { + "name": "tech_sales_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_vendor_quotations": { + "name": "tech_sales_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "tech_sales_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rotation_attempts": { + "name": "ocr_rotation_attempts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "rotation": { + "name": "rotation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "tables_found": { + "name": "tables_found", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "text_quality": { + "name": "text_quality", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "keyword_count": { + "name": "keyword_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "score": { + "name": "score", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "extracted_rows_count": { + "name": "extracted_rows_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_rotation_attempts_session_id_ocr_sessions_id_fk": { + "name": "ocr_rotation_attempts_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rotation_attempts", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rows": { + "name": "ocr_rows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "table_id": { + "name": "table_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "row_index": { + "name": "row_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "report_no": { + "name": "report_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "no": { + "name": "no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "identification_no": { + "name": "identification_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_no": { + "name": "joint_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_type": { + "name": "joint_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "welding_date": { + "name": "welding_date", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "source_table": { + "name": "source_table", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "source_row": { + "name": "source_row", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_ocr_report_no_unique": { + "name": "idx_ocr_report_no_unique", + "columns": [ + { + "expression": "report_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "ocr_rows_table_id_ocr_tables_id_fk": { + "name": "ocr_rows_table_id_ocr_tables_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_tables", + "columnsFrom": [ + "table_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_session_id_ocr_sessions_id_fk": { + "name": "ocr_rows_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_user_id_users_id_fk": { + "name": "ocr_rows_user_id_users_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_sessions": { + "name": "ocr_sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "processing_time": { + "name": "processing_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "best_rotation": { + "name": "best_rotation", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_tables": { + "name": "total_tables", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_rows": { + "name": "total_rows", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "image_enhanced": { + "name": "image_enhanced", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pdf_converted": { + "name": "pdf_converted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "success": { + "name": "success", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "warnings": { + "name": "warnings", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_tables": { + "name": "ocr_tables", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "table_index": { + "name": "table_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "row_count": { + "name": "row_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_tables_session_id_ocr_sessions_id_fk": { + "name": "ocr_tables_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_tables", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.offshore_hull_work_type": { + "name": "offshore_hull_work_type", + "schema": "public", + "values": [ + "HA", + "HE", + "HH", + "HM", + "NC" + ] + }, + "public.offshore_top_work_type": { + "name": "offshore_top_work_type", + "schema": "public", + "values": [ + "TM", + "TS", + "TE", + "TP" + ] + }, + "public.work_type": { + "name": "work_type", + "schema": "public", + "values": [ + "기장", + "전장", + "선실", + "배관", + "철의" + ] + }, + "public.user_domain": { + "name": "user_domain", + "schema": "public", + "values": [ + "evcp", + "partners" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": { + "public.contracts_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"contracts\".\"id\", \"contracts\".\"contract_no\", \"contracts\".\"contract_name\", \"contracts\".\"status\", \"contracts\".\"start_date\", \"contracts\".\"end_date\", \"contracts\".\"project_id\", \"projects\".\"code\", \"projects\".\"name\", \"contracts\".\"vendor_id\", \"vendors\".\"vendor_name\", \"contracts\".\"payment_terms\", \"contracts\".\"delivery_terms\", \"contracts\".\"delivery_date\", \"contracts\".\"delivery_location\", \"contracts\".\"currency\", \"contracts\".\"total_amount\", \"contracts\".\"discount\", \"contracts\".\"tax\", \"contracts\".\"shipping_fee\", \"contracts\".\"net_total\", \"contracts\".\"partial_shipping_allowed\", \"contracts\".\"partial_payment_allowed\", \"contracts\".\"remarks\", \"contracts\".\"version\", \"contracts\".\"created_at\", \"contracts\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"contracts\".\"id\"\n ) as \"has_signature\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "contracts_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.poa_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", + "name": "poa_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.project_approved_vendors": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"status\", \"vendor_types\".\"name_ko\", \"vendor_types\".\"name_en\", \"projects\".\"code\", \"projects\".\"name\", \"projects\".\"type\", \"vendor_pq_submissions\".\"submitted_at\", \"vendor_pq_submissions\".\"approved_at\" from \"vendors\" inner join \"vendor_pq_submissions\" on \"vendor_pq_submissions\".\"vendor_id\" = \"vendors\".\"id\" inner join \"projects\" on \"vendor_pq_submissions\".\"project_id\" = \"projects\".\"id\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\" where \"vendor_pq_submissions\".\"status\" = 'APPROVED'", + "name": "project_approved_vendors", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_investigations_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"vendor_id\", \"vendor_investigations\".\"pq_submission_id\", \"vendor_investigations\".\"requester_id\", \"vendor_investigations\".\"qm_manager_id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"evaluation_type\", \"vendor_investigations\".\"investigation_address\", \"vendor_investigations\".\"investigation_method\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"forecasted_at\", \"vendor_investigations\".\"requested_at\", \"vendor_investigations\".\"confirmed_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"evaluation_score\", \"vendor_investigations\".\"evaluation_result\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", requester.name as \"requesterName\", requester.email as \"requesterEmail\", qm_manager.name as \"qmManagerName\", qm_manager.email as \"qmManagerEmail\", (\n CASE \n WHEN EXISTS (\n SELECT 1 FROM vendor_investigation_attachments via \n WHERE via.investigation_id = \"vendor_investigations\".\"id\"\n ) \n THEN true \n ELSE false \n END\n ) as \"hasAttachments\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\" left join users AS requester on \"vendor_investigations\".\"requester_id\" = requester.id left join users AS qm_manager on \"vendor_investigations\".\"qm_manager_id\" = qm_manager.id", + "name": "vendor_investigations_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.cbe_view": { + "columns": {}, + "definition": "select \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"rfq_id\" as \"rfq_id\", \"cbe_evaluations\".\"vendor_id\" as \"vendor_id\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"result\" as \"result\", \"cbe_evaluations\".\"notes\" as \"notes\", \"cbe_evaluations\".\"evaluated_by\" as \"evaluated_by\", \"cbe_evaluations\".\"evaluated_at\" as \"evaluated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"name\" as \"evaluator_name\", \"users\".\"email\" as \"evaluator_email\" from \"cbe_evaluations\" inner join \"rfqs\" on \"cbe_evaluations\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"cbe_evaluations\".\"evaluated_by\" = \"users\".\"id\"", + "name": "cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.rfqs_view": { + "columns": {}, + "definition": "select \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"rfqs\".\"parent_rfq_id\" as \"parent_rfq_id\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"email\" as \"user_email\", \"users\".\"name\" as \"user_name\", (\n SELECT COUNT(*) \n FROM \"rfq_items\" \n WHERE \"rfq_items\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"item_count\", (\n SELECT COUNT(*) \n FROM \"rfq_attachments\" \n WHERE \"rfq_attachments\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"attachment_count\" from \"rfqs\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"rfqs\".\"created_by\" = \"users\".\"id\"", + "name": "rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_cbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", \"cbe_evaluations\".\"notes\" as \"cbe_note\", \"cbe_evaluations\".\"updated_at\" as \"cbe_updated\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"delivery_schedule\" as \"delivery_schedule\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_response_cbe_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"notes\" as \"response_notes\", \"vendor_responses\".\"responded_by\" as \"responded_by\", \"vendor_responses\".\"responded_at\" as \"responded_at\", \"vendor_responses\".\"updated_at\" as \"response_updated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"status\" as \"vendor_status\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"response_status\" as \"commercial_response_status\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"vendor_commercial_responses\".\"payment_terms\" as \"payment_terms\", \"vendor_commercial_responses\".\"incoterms\" as \"incoterms\", \"vendor_commercial_responses\".\"delivery_period\" as \"delivery_period\", \"vendor_commercial_responses\".\"warranty_period\" as \"warranty_period\", \"vendor_commercial_responses\".\"validity_period\" as \"validity_period\", \"vendor_commercial_responses\".\"price_breakdown\" as \"price_breakdown\", \"vendor_commercial_responses\".\"commercial_notes\" as \"commercial_notes\", \"vendor_commercial_responses\".\"created_at\" as \"commercial_created_at\", \"vendor_commercial_responses\".\"updated_at\" as \"commercial_updated_at\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"commercial_response_id\" = \"vendor_commercial_responses\".\"id\"\n ) as \"commercial_attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n AND \"vendor_response_attachments\".\"attachment_type\" = 'TECHNICAL_SPEC'\n ) as \"technical_attachment_count\", (\n SELECT MAX(\"uploaded_at\") \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"latest_attachment_date\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\"", + "name": "vendor_response_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_responses_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"created_at\" as \"rfq_created_at\", \"rfqs\".\"updated_at\" as \"rfq_updated_at\", \"rfqs\".\"created_by\" as \"rfq_created_by\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"responded_at\" as \"responded_at\", CASE WHEN \"vendor_technical_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_technical_response\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", CASE WHEN \"vendor_commercial_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_commercial_response\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"rfq_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE') left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"cbe_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\")", + "name": "vendor_responses_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_rfq_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", + "name": "vendor_rfq_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_tbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", \"vendor_technical_responses\".\"response_status\" as \"technical_response_status\", \"vendor_technical_responses\".\"summary\" as \"technical_summary\", \"vendor_technical_responses\".\"notes\" as \"technical_notes\", \"vendor_technical_responses\".\"updated_at\" as \"technical_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"rfq_evaluations\".\"notes\" as \"tbe_note\", \"rfq_evaluations\".\"updated_at\" as \"tbe_updated\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_tbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.role_view": { + "columns": {}, + "definition": "select \"roles\".\"id\" as \"id\", \"roles\".\"name\" as \"name\", \"roles\".\"description\" as \"description\", \"roles\".\"domain\" as \"domain\", \"roles\".\"created_at\" as \"created_at\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", COUNT(\"users\".\"id\") as \"user_count\" from \"roles\" left join \"user_roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" left join \"users\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"vendors\" on \"roles\".\"company_id\" = \"vendors\".\"id\" group by \"roles\".\"id\", \"vendors\".\"id\"", + "name": "role_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.user_view": { + "columns": {}, + "definition": "select \"users\".\"id\" as \"user_id\", \"users\".\"name\" as \"user_name\", \"users\".\"email\" as \"user_email\", \"users\".\"domain\" as \"user_domain\", \"users\".\"image_url\" as \"user_image\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"vendors\" on \"users\".\"company_id\" = \"vendors\".\"id\" left join \"user_roles\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" group by \"users\".\"id\", \"vendors\".\"id\"", + "name": "user_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.form_lists_view": { + "columns": {}, + "definition": "select \"tag_type_class_form_mappings\".\"id\" as \"id\", \"tag_type_class_form_mappings\".\"project_id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"tag_type_class_form_mappings\".\"tag_type_label\" as \"tag_type_label\", \"tag_type_class_form_mappings\".\"class_label\" as \"class_label\", \"tag_type_class_form_mappings\".\"form_code\" as \"form_code\", \"tag_type_class_form_mappings\".\"form_name\" as \"form_name\", \"tag_type_class_form_mappings\".\"ep\" as \"ep\", \"tag_type_class_form_mappings\".\"remark\" as \"remark\", \"tag_type_class_form_mappings\".\"created_at\" as \"created_at\", \"tag_type_class_form_mappings\".\"updated_at\" as \"updated_at\" from \"tag_type_class_form_mappings\" inner join \"projects\" on \"tag_type_class_form_mappings\".\"project_id\" = \"projects\".\"id\"", + "name": "form_lists_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.view_tag_subfields": { + "columns": { + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "definition": "select \"tag_subfields\".\"id\" as \"id\", \"tag_subfields\".\"tag_type_code\", \"tag_types\".\"description\", \"tag_subfields\".\"attributes_id\", \"tag_subfields\".\"attributes_description\", \"tag_subfields\".\"expression\", \"tag_subfields\".\"delimiter\", \"tag_subfields\".\"sort_order\", \"tag_subfields\".\"created_at\", \"tag_subfields\".\"updated_at\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\", \"projects\".\"name\" from \"tag_subfields\" inner join \"tag_types\" on (\"tag_subfields\".\"tag_type_code\" = \"tag_types\".\"code\" and \"tag_subfields\".\"project_id\" = \"tag_types\".\"project_id\") inner join \"projects\" on \"tag_subfields\".\"project_id\" = \"projects\".\"id\"", + "name": "view_tag_subfields", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.document_stages_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_count": { + "name": "stage_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_list": { + "name": "stage_list", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT\n d.id AS document_id,\n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n d.contract_id,\n (SELECT COUNT(*) FROM issue_stages WHERE document_id = d.id) AS stage_count,\n COALESCE( \n (SELECT json_agg(i.stage_name) FROM issue_stages i WHERE i.document_id = d.id), \n '[]'\n ) AS stage_list,\n d.created_at,\n d.updated_at\n FROM documents d\n", + "name": "document_stages_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.enhanced_documents_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_id": { + "name": "current_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_name": { + "name": "current_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_status": { + "name": "current_stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_order": { + "name": "current_stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_plan_date": { + "name": "current_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_actual_date": { + "name": "current_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_assignee_name": { + "name": "current_stage_assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_priority": { + "name": "current_stage_priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "days_until_due": { + "name": "days_until_due", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_overdue": { + "name": "is_overdue", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "days_difference": { + "name": "days_difference", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "total_stages": { + "name": "total_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "completed_stages": { + "name": "completed_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "progress_percentage": { + "name": "progress_percentage", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_status": { + "name": "latest_revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_submitted_date": { + "name": "latest_submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "all_stages": { + "name": "all_stages", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n WITH document_stats AS (\n SELECT \n d.id as document_id,\n COUNT(ist.id) as total_stages,\n COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) as completed_stages,\n CASE \n WHEN COUNT(ist.id) > 0 \n THEN ROUND((COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) * 100.0) / COUNT(ist.id))\n ELSE 0 \n END as progress_percentage\n FROM documents d\n LEFT JOIN issue_stages ist ON d.id = ist.document_id\n GROUP BY d.id\n ),\n current_stage_info AS (\n SELECT DISTINCT ON (document_id)\n document_id,\n id as current_stage_id,\n stage_name as current_stage_name,\n stage_status as current_stage_status,\n stage_order as current_stage_order,\n plan_date as current_stage_plan_date,\n actual_date as current_stage_actual_date,\n assignee_name as current_stage_assignee_name,\n priority as current_stage_priority,\n CASE \n WHEN actual_date IS NULL AND plan_date IS NOT NULL \n THEN plan_date - CURRENT_DATE\n ELSE NULL \n END as days_until_due,\n CASE \n WHEN actual_date IS NULL AND plan_date < CURRENT_DATE \n THEN true\n WHEN actual_date IS NOT NULL AND actual_date > plan_date \n THEN true\n ELSE false \n END as is_overdue,\n CASE \n WHEN actual_date IS NOT NULL AND plan_date IS NOT NULL \n THEN actual_date - plan_date\n ELSE NULL \n END as days_difference\n FROM issue_stages\n WHERE stage_status NOT IN ('COMPLETED', 'APPROVED')\n ORDER BY document_id, stage_order ASC, priority DESC\n ),\n latest_revision_info AS (\n SELECT DISTINCT ON (ist.document_id)\n ist.document_id,\n r.id as latest_revision_id,\n r.revision as latest_revision,\n r.revision_status as latest_revision_status,\n r.uploader_name as latest_revision_uploader_name,\n r.submitted_date as latest_submitted_date\n FROM revisions r\n JOIN issue_stages ist ON r.issue_stage_id = ist.id\n ORDER BY ist.document_id, r.created_at DESC\n ),\n -- 리비전별 첨부파일 집계\n revision_attachments AS (\n SELECT \n r.id as revision_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', da.id,\n 'revisionId', da.revision_id,\n 'fileName', da.file_name,\n 'filePath', da.file_path,\n 'fileSize', da.file_size,\n 'fileType', da.file_type,\n 'createdAt', da.created_at,\n 'updatedAt', da.updated_at\n ) ORDER BY da.created_at\n ) FILTER (WHERE da.id IS NOT NULL),\n '[]'::json\n ) as attachments\n FROM revisions r\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY r.id\n ),\n -- 스테이지별 리비전 집계 (첨부파일 포함)\n stage_revisions AS (\n SELECT \n ist.id as stage_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', r.id,\n 'issueStageId', r.issue_stage_id,\n 'revision', r.revision,\n 'uploaderType', r.uploader_type,\n 'uploaderId', r.uploader_id,\n 'uploaderName', r.uploader_name,\n 'comment', r.comment,\n 'usage', r.usage,\n 'revisionStatus', r.revision_status,\n 'submittedDate', r.submitted_date,\n 'uploadedAt', r.uploaded_at,\n 'approvedDate', r.approved_date,\n 'reviewStartDate', r.review_start_date,\n 'rejectedDate', r.rejected_date,\n 'reviewerId', r.reviewer_id,\n 'reviewerName', r.reviewer_name,\n 'reviewComments', r.review_comments,\n 'createdAt', r.created_at,\n 'updatedAt', r.updated_at,\n 'attachments', ra.attachments\n ) ORDER BY r.created_at\n ) FILTER (WHERE r.id IS NOT NULL),\n '[]'::json\n ) as revisions\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN revision_attachments ra ON r.id = ra.revision_id\n GROUP BY ist.id\n ),\n -- 문서별 스테이지 집계 (리비전 포함)\n stage_aggregation AS (\n SELECT \n ist.document_id,\n json_agg(\n json_build_object(\n 'id', ist.id,\n 'stageName', ist.stage_name,\n 'stageStatus', ist.stage_status,\n 'stageOrder', ist.stage_order,\n 'planDate', ist.plan_date,\n 'actualDate', ist.actual_date,\n 'assigneeName', ist.assignee_name,\n 'priority', ist.priority,\n 'revisions', sr.revisions\n ) ORDER BY ist.stage_order\n ) as all_stages\n FROM issue_stages ist\n LEFT JOIN stage_revisions sr ON ist.id = sr.stage_id\n GROUP BY ist.document_id\n ),\n attachment_counts AS (\n SELECT \n ist.document_id,\n COUNT(da.id) as attachment_count\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY ist.document_id\n )\n \n SELECT \n d.id as document_id,\n d.doc_number,\n d.drawing_kind,\n d.vendor_doc_number, -- ✅ 벤더 문서 번호 추가\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n -- ✅ 프로젝트 및 벤더 정보 추가\n p.code as project_code,\n v.vendor_name as vendor_name,\n v.vendor_code as vendor_code,\n \n -- 현재 스테이지 정보\n csi.current_stage_id,\n csi.current_stage_name,\n csi.current_stage_status,\n csi.current_stage_order,\n csi.current_stage_plan_date,\n csi.current_stage_actual_date,\n csi.current_stage_assignee_name,\n csi.current_stage_priority,\n \n -- 계산 필드\n csi.days_until_due,\n csi.is_overdue,\n csi.days_difference,\n \n -- 진행률 정보\n ds.total_stages,\n ds.completed_stages,\n ds.progress_percentage,\n \n -- 최신 리비전 정보\n lri.latest_revision_id,\n lri.latest_revision,\n lri.latest_revision_status,\n lri.latest_revision_uploader_name,\n lri.latest_submitted_date,\n \n -- 전체 스테이지 (리비전 및 첨부파일 포함)\n COALESCE(sa.all_stages, '[]'::json) as all_stages,\n \n -- 기타\n COALESCE(ac.attachment_count, 0) as attachment_count,\n d.created_at,\n d.updated_at\n \n FROM documents d\n -- ✅ contracts, projects, vendors 테이블 JOIN 추가\n LEFT JOIN contracts c ON d.contract_id = c.id\n LEFT JOIN projects p ON c.project_id = p.id\n LEFT JOIN vendors v ON c.vendor_id = v.id\n \n LEFT JOIN document_stats ds ON d.id = ds.document_id\n LEFT JOIN current_stage_info csi ON d.id = csi.document_id\n LEFT JOIN latest_revision_info lri ON d.id = lri.document_id\n LEFT JOIN stage_aggregation sa ON d.id = sa.document_id\n LEFT JOIN attachment_counts ac ON d.id = ac.document_id\n \n ORDER BY d.created_at DESC\n", + "name": "enhanced_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.sync_status_view": { + "columns": { + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "total_changes": { + "name": "total_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pending_changes": { + "name": "pending_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "synced_changes": { + "name": "synced_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "failed_changes": { + "name": "failed_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "last_sync_at": { + "name": "last_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_sync_at": { + "name": "next_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n WITH change_stats AS (\n SELECT \n cl.contract_id,\n sc.target_system,\n COUNT(*) as total_changes,\n COUNT(CASE WHEN cl.is_synced = false AND cl.sync_attempts < sc.retry_max_attempts THEN 1 END) as pending_changes,\n COUNT(CASE WHEN cl.is_synced = true THEN 1 END) as synced_changes,\n COUNT(CASE WHEN cl.sync_attempts >= sc.retry_max_attempts AND cl.is_synced = false THEN 1 END) as failed_changes,\n MAX(cl.synced_at) as last_sync_at\n FROM change_logs cl\n CROSS JOIN sync_configs sc \n WHERE cl.contract_id = sc.contract_id\n AND (cl.target_systems IS NULL OR cl.target_systems @> to_jsonb(sc.target_system))\n GROUP BY cl.contract_id, sc.target_system\n )\n SELECT \n cs.contract_id,\n cs.target_system,\n COALESCE(cs.total_changes, 0) as total_changes,\n COALESCE(cs.pending_changes, 0) as pending_changes,\n COALESCE(cs.synced_changes, 0) as synced_changes,\n COALESCE(cs.failed_changes, 0) as failed_changes,\n cs.last_sync_at,\n CASE \n WHEN sc.sync_enabled = true AND sc.last_successful_sync IS NOT NULL \n THEN sc.last_successful_sync + (sc.sync_interval_minutes || ' minutes')::interval\n ELSE NULL\n END as next_sync_at,\n sc.sync_enabled\n FROM sync_configs sc\n LEFT JOIN change_stats cs ON sc.contract_id = cs.contract_id AND sc.target_system = cs.target_system\n", + "name": "sync_status_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_documents_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "latest_stage_id": { + "name": "latest_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_stage_name": { + "name": "latest_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_stage_plan_date": { + "name": "latest_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_stage_actual_date": { + "name": "latest_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_type": { + "name": "latest_revision_uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT \n d.id, \n d.doc_number,\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n (SELECT id FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_id,\n (SELECT stage_name FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_name,\n (SELECT plan_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_plan_date,\n (SELECT actual_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_actual_date,\n \n (SELECT r.id FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_id,\n (SELECT r.revision FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision,\n (SELECT r.uploader_type FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_type,\n (SELECT r.uploader_name FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_name,\n \n (SELECT COUNT(*) FROM document_attachments a JOIN revisions r ON a.revision_id = r.id JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id) AS attachment_count,\n \n d.created_at,\n d.updated_at\n FROM documents d\n JOIN contracts c ON d.contract_id = c.id\n ", + "name": "vendor_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_candidates_with_vendor_info": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_candidates\".\"id\", \"vendor_candidates\".\"company_name\", \"vendor_candidates\".\"contact_email\", \"vendor_candidates\".\"contact_phone\", \"vendor_candidates\".\"tax_id\", \"vendor_candidates\".\"address\", \"vendor_candidates\".\"country\", \"vendor_candidates\".\"source\", \"vendor_candidates\".\"status\", \"vendor_candidates\".\"items\", \"vendor_candidates\".\"remark\", \"vendor_candidates\".\"created_at\", \"vendor_candidates\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"created_at\" as \"vendor_created_at\", (\n SELECT l2.\"created_at\"\n FROM \"vendor_candidate_logs\" l2\n WHERE l2.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l2.\"action\" = 'status_change'\n ORDER BY l2.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_at\", (\n SELECT u.\"name\"\n FROM \"users\" u\n JOIN \"vendor_candidate_logs\" l3\n ON l3.\"user_id\" = u.\"id\"\n WHERE l3.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l3.\"action\" = 'status_change'\n ORDER BY l3.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_by\", (\n SELECT l4.\"created_at\"\n FROM \"vendor_candidate_logs\" l4\n WHERE l4.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l4.\"action\" = 'invite_sent'\n ORDER BY l4.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_at\", (\n SELECT u2.\"name\"\n FROM \"users\" u2\n JOIN \"vendor_candidate_logs\" l5\n ON l5.\"user_id\" = u2.\"id\"\n WHERE l5.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l5.\"action\" = 'invite_sent'\n ORDER BY l5.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_by\" from \"vendor_candidates\" left join \"vendors\" on \"vendor_candidates\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "vendor_candidates_with_vendor_info", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"business_size\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"", + "name": "vendor_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", + "name": "vendor_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_materials_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_materials\".\"id\", \"vendor_possible_materials\".\"vendor_id\", \"materials\".\"item_name\", \"materials\".\"item_code\", \"materials\".\"description\", \"materials\".\"unit_of_measure\", \"materials\".\"steel_type\", \"materials\".\"grade_material\", \"vendor_possible_materials\".\"created_at\", \"vendor_possible_materials\".\"updated_at\" from \"vendor_possible_materials\" left join \"materials\" on \"vendor_possible_materials\".\"item_code\" = \"materials\".\"item_code\"", + "name": "vendor_materials_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendors_with_types": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"tax_id\" as \"tax_id\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"phone\" as \"phone\", \"vendors\".\"email\" as \"email\", \"vendors\".\"business_size\" as \"business_size\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"status\", \"vendors\".\"vendor_type_id\" as \"vendor_type_id\", \"vendors\".\"representative_name\" as \"representative_name\", \"vendors\".\"representative_birth\" as \"representative_birth\", \"vendors\".\"representative_email\" as \"representative_email\", \"vendors\".\"representative_phone\" as \"representative_phone\", \"vendors\".\"corporate_registration_number\" as \"corporate_registration_number\", \"vendors\".\"items\" as \"items\", \"vendors\".\"credit_agency\" as \"credit_agency\", \"vendors\".\"credit_rating\" as \"credit_rating\", \"vendors\".\"cash_flow_rating\" as \"cash_flow_rating\", \"vendors\".\"created_at\" as \"created_at\", \"vendors\".\"updated_at\" as \"updated_at\", \"vendor_types\".\"name_ko\" as \"vendor_type_name\", \"vendor_types\".\"name_en\" as \"vendor_type_name_en\", \"vendor_types\".\"code\" as \"vendor_type_code\", \n CASE\n WHEN \"vendors\".\"status\" = 'ACTIVE' THEN '정규업체'\n WHEN \"vendors\".\"status\" IN ('INACTIVE', 'BLACKLISTED', 'REJECTED') THEN ''\n ELSE '잠재업체'\n END\n as \"vendor_category\" from \"vendors\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\"", + "name": "vendors_with_types", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.basic_contract_view": { + "columns": {}, + "definition": "select \"basic_contract\".\"id\" as \"id\", \"basic_contract\".\"template_id\" as \"template_id\", \"basic_contract\".\"vendor_id\" as \"vendor_id\", \"basic_contract\".\"requested_by\" as \"requested_by\", \"basic_contract\".\"status\" as \"basic_contract_status\", \"basic_contract\".\"created_at\" as \"created_at\", \"basic_contract\".\"updated_at\" as \"updated_at\", \"basic_contract\".\"updated_at\" as \"completed_at\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"email\" as \"vendor_email\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"users\".\"name\" as \"user_name\", \"basic_contract_templates\".\"template_name\" as \"template_name\", \"basic_contract_templates\".\"validity_period\" as \"validityPeriod\", \"basic_contract_templates\".\"file_path\" as \"file_path\", \"basic_contract_templates\".\"file_name\" as \"file_name\", \"basic_contract\".\"file_path\" as \"signed_file_path\" from \"basic_contract\" left join \"vendors\" on \"basic_contract\".\"vendor_id\" = \"vendors\".\"id\" left join \"users\" on \"basic_contract\".\"requested_by\" = \"users\".\"id\" left join \"basic_contract_templates\" on \"basic_contract\".\"template_id\" = \"basic_contract_templates\".\"id\"", + "name": "basic_contract_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.pr_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"pr_items\".\"id\", \"pr_items\".\"procurement_rfqs_id\", \"pr_items\".\"rfq_item\", \"pr_items\".\"pr_item\", \"pr_items\".\"pr_no\", \"pr_items\".\"material_code\", \"pr_items\".\"material_category\", \"pr_items\".\"acc\", \"pr_items\".\"material_description\", \"pr_items\".\"size\", \"pr_items\".\"delivery_date\", \"pr_items\".\"quantity\", \"pr_items\".\"uom\", \"pr_items\".\"gross_weight\", \"pr_items\".\"gw_uom\", \"pr_items\".\"spec_no\", \"pr_items\".\"spec_url\", \"pr_items\".\"tracking_no\", \"pr_items\".\"major_yn\", \"pr_items\".\"project_def\", \"pr_items\".\"project_sc\", \"pr_items\".\"project_kl\", \"pr_items\".\"project_lc\", \"pr_items\".\"project_dl\", \"pr_items\".\"remark\", \"procurement_rfqs\".\"rfq_code\", \"procurement_rfqs\".\"item_code\", \"procurement_rfqs\".\"item_name\" from \"pr_items\" left join \"procurement_rfqs\" on \"pr_items\".\"procurement_rfqs_id\" = \"procurement_rfqs\".\"id\"", + "name": "pr_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfq_details_view": { + "columns": {}, + "definition": "select \"rfq_details\".\"id\" as \"detail_id\", \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfqs\".\"item_code\" as \"item_code\", \"rfqs\".\"item_name\" as \"item_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"country\" as \"vendor_country\", \"rfq_details\".\"currency\" as \"currency\", \"payment_terms\".\"code\" as \"payment_terms_code\", \"payment_terms\".\"description\" as \"payment_terms_description\", \"incoterms\".\"code\" as \"incoterms_code\", \"incoterms\".\"description\" as \"incoterms_description\", \"rfq_details\".\"incoterms_detail\" as \"incoterms_detail\", \"rfq_details\".\"delivery_date\" as \"delivery_date\", \"rfq_details\".\"tax_code\" as \"tax_code\", \"rfq_details\".\"place_of_shipping\" as \"place_of_shipping\", \"rfq_details\".\"place_of_destination\" as \"place_of_destination\", \"rfq_details\".\"material_price_related_yn\" as \"material_price_related_yn\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"rfq_details\".\"updated_at\" as \"updated_at\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\"\n ) as \"pr_items_count\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\" \n AND major_yn = true\n ) as \"major_items_count\", (\n SELECT COUNT(*) \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"comment_count\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_comment_date\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\" AND is_vendor_comment = true\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_vendor_comment_date\", (\n SELECT COUNT(*) \n FROM procurement_rfq_attachments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) > 0\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"has_quotation\", (\n SELECT status\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_status\", (\n SELECT total_price\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_total_price\", (\n SELECT quotation_version\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"quotation_version\", (\n SELECT COUNT(DISTINCT quotation_version)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"quotation_version_count\", (\n SELECT created_at\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"last_quotation_date\" from \"procurement_rfq_details\" \"rfq_details\" left join \"procurement_rfqs\" \"rfqs\" on \"rfq_details\".\"procurement_rfqs_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"rfq_details\".\"vendors_id\" = \"vendors\".\"id\" left join \"payment_terms\" on \"rfq_details\".\"payment_terms_code\" = \"payment_terms\".\"code\" left join \"incoterms\" on \"rfq_details\".\"incoterms_code\" = \"incoterms\".\"code\" left join \"users\" \"updated_by_user\" on \"rfq_details\".\"updated_by\" = \"updated_by_user\".\"id\"", + "name": "procurement_rfq_details_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfqs_view": { + "columns": {}, + "definition": "select \"procurement_rfqs\".\"id\" as \"id\", \"procurement_rfqs\".\"rfq_code\" as \"rfq_code\", \"procurement_rfqs\".\"series\" as \"series\", \"procurement_rfqs\".\"rfq_sealed_yn\" as \"rfq_sealed_yn\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"procurement_rfqs\".\"item_code\" as \"item_code\", \"procurement_rfqs\".\"item_name\" as \"item_name\", \"procurement_rfqs\".\"status\" as \"status\", \"procurement_rfqs\".\"pic_code\" as \"pic_code\", \"procurement_rfqs\".\"rfq_send_date\" as \"rfq_send_date\", \"procurement_rfqs\".\"due_date\" as \"due_date\", (\n SELECT MIN(submitted_at)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"procurement_rfqs\".\"id\"\n AND submitted_at IS NOT NULL\n ) as \"earliest_quotation_submitted_at\", \"created_by_user\".\"name\" as \"created_by_user_name\", \"sent_by_user\".\"name\" as \"sent_by_user_name\", \"procurement_rfqs\".\"updated_at\" as \"updated_at\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"procurement_rfqs\".\"remark\" as \"remark\", (\n SELECT material_code \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"major_item_material_code\", (\n SELECT pr_no \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"po_no\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n ) as \"pr_items_count\" from \"procurement_rfqs\" left join \"projects\" on \"procurement_rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" \"created_by_user\" on \"procurement_rfqs\".\"created_by\" = \"created_by_user\".\"id\" left join \"users\" \"updated_by_user\" on \"procurement_rfqs\".\"updated_by\" = \"updated_by_user\".\"id\" left join \"users\" \"sent_by_user\" on \"procurement_rfqs\".\"sent_by\" = \"sent_by_user\".\"id\"", + "name": "procurement_rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + } + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db/migrations/meta/0120_snapshot.json b/db/migrations/meta/0120_snapshot.json new file mode 100644 index 00000000..4d77786d --- /dev/null +++ b/db/migrations/meta/0120_snapshot.json @@ -0,0 +1,12052 @@ +{ + "id": "2776f234-d78d-40f0-9600-fcfbd546b6ab", + "prevId": "6148230e-f179-4b94-a283-dae33f27b4a1", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.companies": { + "name": "companies", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "companies_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "taxID": { + "name": "taxID", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_envelopes": { + "name": "contract_envelopes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_envelopes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "envelope_id": { + "name": "envelope_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": true + }, + "document_id": { + "name": "document_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": false + }, + "envelope_status": { + "name": "envelope_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_envelopes_contract_id_contracts_id_fk": { + "name": "contract_envelopes_contract_id_contracts_id_fk", + "tableFrom": "contract_envelopes", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_items": { + "name": "contract_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_items_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_id": { + "name": "item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "unit_price": { + "name": "unit_price", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "total_line_amount": { + "name": "total_line_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_items_contract_item_idx": { + "name": "contract_items_contract_item_idx", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "contract_items_contract_id_contracts_id_fk": { + "name": "contract_items_contract_id_contracts_id_fk", + "tableFrom": "contract_items", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_items_item_id_items_id_fk": { + "name": "contract_items_item_id_items_id_fk", + "tableFrom": "contract_items", + "tableTo": "items", + "columnsFrom": [ + "item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_items_contract_id_item_id_unique": { + "name": "contract_items_contract_id_item_id_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_id", + "item_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_signers": { + "name": "contract_signers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_signers_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "envelope_id": { + "name": "envelope_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_contact_id": { + "name": "vendor_contact_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "signer_type": { + "name": "signer_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'VENDOR'" + }, + "signer_email": { + "name": "signer_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "signer_name": { + "name": "signer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "signer_position": { + "name": "signer_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "signer_status": { + "name": "signer_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "signed_at": { + "name": "signed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_signers_envelope_id_contract_envelopes_id_fk": { + "name": "contract_signers_envelope_id_contract_envelopes_id_fk", + "tableFrom": "contract_signers", + "tableTo": "contract_envelopes", + "columnsFrom": [ + "envelope_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_signers_vendor_contact_id_vendor_contacts_id_fk": { + "name": "contract_signers_vendor_contact_id_vendor_contacts_id_fk", + "tableFrom": "contract_signers", + "tableTo": "vendor_contacts", + "columnsFrom": [ + "vendor_contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contracts": { + "name": "contracts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contracts_project_id_projects_id_fk": { + "name": "contracts_project_id_projects_id_fk", + "tableFrom": "contracts", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contracts_vendor_id_vendors_id_fk": { + "name": "contracts_vendor_id_vendors_id_fk", + "tableFrom": "contracts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contracts_contract_no_unique": { + "name": "contracts_contract_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.poa": { + "name": "poa", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "original_contract_no": { + "name": "original_contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "original_contract_name": { + "name": "original_contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_status": { + "name": "original_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "poa_original_contract_no_contracts_contract_no_fk": { + "name": "poa_original_contract_no_contracts_contract_no_fk", + "tableFrom": "poa", + "tableTo": "contracts", + "columnsFrom": [ + "original_contract_no" + ], + "columnsTo": [ + "contract_no" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_project_id_projects_id_fk": { + "name": "poa_project_id_projects_id_fk", + "tableFrom": "poa", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_vendor_id_vendors_id_fk": { + "name": "poa_vendor_id_vendors_id_fk", + "tableFrom": "poa", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_hull": { + "name": "item_offshore_hull", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_hull_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_hull_item_code_items_item_code_fk": { + "name": "item_offshore_hull_item_code_items_item_code_fk", + "tableFrom": "item_offshore_hull", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_top": { + "name": "item_offshore_top", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_top_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_top_item_code_items_item_code_fk": { + "name": "item_offshore_top_item_code_items_item_code_fk", + "tableFrom": "item_offshore_top", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_shipbuilding": { + "name": "item_shipbuilding", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ship_types": { + "name": "ship_types", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'OPTION'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_shipbuilding_item_code_items_item_code_fk": { + "name": "item_shipbuilding_item_code_items_item_code_fk", + "tableFrom": "item_shipbuilding", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.items": { + "name": "items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_no": { + "name": "project_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "package_code": { + "name": "package_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "sm_code": { + "name": "sm_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "items_item_code_unique": { + "name": "items_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.materials": { + "name": "materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "materials_item_code_unique": { + "name": "materials_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias": { + "name": "pq_criterias", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "check_point": { + "name": "check_point", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "group_name": { + "name": "group_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias_extension": { + "name": "pq_criterias_extension", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_criteria_id": { + "name": "pq_criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_info": { + "name": "contract_info", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "additional_requirement": { + "name": "additional_requirement", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk": { + "name": "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "pq_criterias", + "columnsFrom": [ + "pq_criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "pq_criterias_extension_project_id_projects_id_fk": { + "name": "pq_criterias_extension_project_id_projects_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_criteria_attachments": { + "name": "vendor_criteria_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_criteria_answer_id": { + "name": "vendor_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_criteria_attachments", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigation_attachments": { + "name": "vendor_investigation_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "investigation_id": { + "name": "investigation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'REPORT'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { + "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", + "tableFrom": "vendor_investigation_attachments", + "tableTo": "vendor_investigations", + "columnsFrom": [ + "investigation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigations": { + "name": "vendor_investigations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigations_vendor_id_vendors_id_fk": { + "name": "vendor_investigations_vendor_id_vendors_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk": { + "name": "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendor_pq_submissions", + "columnsFrom": [ + "pq_submission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "vendor_investigations_requester_id_users_id_fk": { + "name": "vendor_investigations_requester_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_qm_manager_id_users_id_fk": { + "name": "vendor_investigations_qm_manager_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "qm_manager_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_submissions": { + "name": "vendor_pq_submissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_number": { + "name": "pq_number", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_pq_submission": { + "name": "unique_pq_submission", + "columns": [ + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_pq_submissions_requester_id_users_id_fk": { + "name": "vendor_pq_submissions_requester_id_users_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_pq_submissions_vendor_id_vendors_id_fk": { + "name": "vendor_pq_submissions_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_submissions_project_id_projects_id_fk": { + "name": "vendor_pq_submissions_project_id_projects_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_pq_submissions_pq_number_unique": { + "name": "vendor_pq_submissions_pq_number_unique", + "nullsNotDistinct": false, + "columns": [ + "pq_number" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_criteria_answers": { + "name": "vendor_pq_criteria_answers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "criteria_id": { + "name": "criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "answer": { + "name": "answer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_criteria_answers_vendor_id_vendors_id_fk": { + "name": "vendor_pq_criteria_answers_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": { + "name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "pq_criterias", + "columnsFrom": [ + "criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_project_id_projects_id_fk": { + "name": "vendor_pq_criteria_answers_project_id_projects_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_review_logs": { + "name": "vendor_pq_review_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_pq_criteria_answer_id": { + "name": "vendor_pq_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "reviewer_comment": { + "name": "reviewer_comment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_pq_review_logs", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_pq_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_project_pqs": { + "name": "vendor_project_pqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_project_pqs_vendor_id_vendors_id_fk": { + "name": "vendor_project_pqs_vendor_id_vendors_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_project_pqs_project_id_projects_id_fk": { + "name": "vendor_project_pqs_project_id_projects_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bidding_projects": { + "name": "bidding_projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "proj_nm": { + "name": "proj_nm", + "type": "varchar(90)", + "primaryKey": false, + "notNull": false + }, + "sector": { + "name": "sector", + "type": "char(1)", + "primaryKey": false, + "notNull": false + }, + "proj_msrm": { + "name": "proj_msrm", + "type": "numeric(3, 0)", + "primaryKey": false, + "notNull": false + }, + "kunnr": { + "name": "kunnr", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "kunnr_nm": { + "name": "kunnr_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "cls_1": { + "name": "cls_1", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "cls1_nm": { + "name": "cls1_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "ptype": { + "name": "ptype", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "ptype_nm": { + "name": "ptype_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_cd": { + "name": "pmodel_cd", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "pmodel_nm": { + "name": "pmodel_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_sz": { + "name": "pmodel_sz", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "pmodel_uom": { + "name": "pmodel_uom", + "type": "char(5)", + "primaryKey": false, + "notNull": false + }, + "txt04": { + "name": "txt04", + "type": "char(4)", + "primaryKey": false, + "notNull": false + }, + "txt30": { + "name": "txt30", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "estm_pm": { + "name": "estm_pm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "bidding_projects_pspid_unique": { + "name": "bidding_projects_pspid_unique", + "nullsNotDistinct": false, + "columns": [ + "pspid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_series": { + "name": "project_series", + "schema": "", + "columns": { + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "sers_no": { + "name": "sers_no", + "type": "char(3)", + "primaryKey": false, + "notNull": true + }, + "sc_dt": { + "name": "sc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "kl_dt": { + "name": "kl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "lc_dt": { + "name": "lc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dl_dt": { + "name": "dl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dock_no": { + "name": "dock_no", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "dock_nm": { + "name": "dock_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "proj_no": { + "name": "proj_no", + "type": "char(24)", + "primaryKey": false, + "notNull": false + }, + "post1": { + "name": "post1", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "project_sersNo_unique": { + "name": "project_sersNo_unique", + "columns": [ + { + "expression": "pspid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sers_no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "project_series_pspid_bidding_projects_pspid_fk": { + "name": "project_series_pspid_bidding_projects_pspid_fk", + "tableFrom": "project_series", + "tableTo": "bidding_projects", + "columnsFrom": [ + "pspid" + ], + "columnsTo": [ + "pspid" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projects": { + "name": "projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cbe_evaluations": { + "name": "cbe_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluated_by": { + "name": "evaluated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluated_at": { + "name": "evaluated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "result": { + "name": "result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "total_cost": { + "name": "total_cost", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_schedule": { + "name": "delivery_schedule", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "cbe_evaluations_rfq_id_rfqs_id_fk": { + "name": "cbe_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_vendor_id_vendors_id_fk": { + "name": "cbe_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_evaluated_by_users_id_fk": { + "name": "cbe_evaluations_evaluated_by_users_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "users", + "columnsFrom": [ + "evaluated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_attachments": { + "name": "rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_attachments_rfq_id_rfqs_id_fk": { + "name": "rfq_attachments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_vendor_id_vendors_id_fk": { + "name": "rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_attachments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_cbe_id_cbe_evaluations_id_fk": { + "name": "rfq_attachments_cbe_id_cbe_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "cbe_evaluations", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_comment_id_rfq_comments_id_fk": { + "name": "rfq_attachments_comment_id_rfq_comments_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_comments": { + "name": "rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "comment_text": { + "name": "comment_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "commented_by": { + "name": "commented_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_comments_rfq_id_rfqs_id_fk": { + "name": "rfq_comments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_vendor_id_vendors_id_fk": { + "name": "rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_commented_by_users_id_fk": { + "name": "rfq_comments_commented_by_users_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "commented_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_comments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_cbe_id_vendor_responses_id_fk": { + "name": "rfq_comments_cbe_id_vendor_responses_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_evaluations": { + "name": "rfq_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "eval_type": { + "name": "eval_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "result": { + "name": "result", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_evaluations_rfq_id_rfqs_id_fk": { + "name": "rfq_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_evaluations_vendor_id_vendors_id_fk": { + "name": "rfq_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_items": { + "name": "rfq_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_items_rfq_id_rfqs_id_fk": { + "name": "rfq_items_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_items", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "rfq_items_item_code_items_item_code_fk": { + "name": "rfq_items_item_code_items_item_code_fk", + "tableFrom": "rfq_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfqs": { + "name": "rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "bid_project_id": { + "name": "bid_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false, + "default": "'PURCHASE'" + }, + "parent_rfq_id": { + "name": "parent_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfqs_project_id_projects_id_fk": { + "name": "rfqs_project_id_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_bid_project_id_bidding_projects_id_fk": { + "name": "rfqs_bid_project_id_bidding_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bid_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_created_by_users_id_fk": { + "name": "rfqs_created_by_users_id_fk", + "tableFrom": "rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_parent_rfq_id_rfqs_id_fk": { + "name": "rfqs_parent_rfq_id_rfqs_id_fk", + "tableFrom": "rfqs", + "tableTo": "rfqs", + "columnsFrom": [ + "parent_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "rfqs_rfq_code_unique": { + "name": "rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_commercial_responses": { + "name": "vendor_commercial_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "total_price": { + "name": "total_price", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_period": { + "name": "delivery_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "warranty_period": { + "name": "warranty_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "validity_period": { + "name": "validity_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "price_breakdown": { + "name": "price_breakdown", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "commercial_notes": { + "name": "commercial_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_commercial_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_commercial_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_commercial_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_attachments": { + "name": "vendor_response_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "technical_response_id": { + "name": "technical_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "commercial_response_id": { + "name": "commercial_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_attachments_response_id_vendor_responses_id_fk": { + "name": "vendor_response_attachments_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk": { + "name": "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_technical_responses", + "columnsFrom": [ + "technical_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk": { + "name": "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_commercial_responses", + "columnsFrom": [ + "commercial_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_responses": { + "name": "vendor_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'REVIEWING'" + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "responded_by": { + "name": "responded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "responded_at": { + "name": "responded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "vendor_response_unique": { + "name": "vendor_response_unique", + "columns": [ + { + "expression": "rfq_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_responses_rfq_id_rfqs_id_fk": { + "name": "vendor_responses_rfq_id_rfqs_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_responses_vendor_id_vendors_id_fk": { + "name": "vendor_responses_vendor_id_vendors_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_technical_responses": { + "name": "vendor_technical_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_technical_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_technical_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_technical_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.otps": { + "name": "otps", + "schema": "", + "columns": { + "email": { + "name": "email", + "type": "varchar(256)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(6)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "otpToken": { + "name": "otpToken", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "otp_expires": { + "name": "otp_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permissions": { + "name": "permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "permissions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "permission_key": { + "name": "permission_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.role_permissions": { + "name": "role_permissions", + "schema": "", + "columns": { + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "permission_id": { + "name": "permission_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "role_permissions_role_id_roles_id_fk": { + "name": "role_permissions_role_id_roles_id_fk", + "tableFrom": "role_permissions", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "role_permissions_permission_id_permissions_id_fk": { + "name": "role_permissions_permission_id_permissions_id_fk", + "tableFrom": "role_permissions", + "tableTo": "permissions", + "columnsFrom": [ + "permission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.roles": { + "name": "roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "roles_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "roles_company_id_vendors_id_fk": { + "name": "roles_company_id_vendors_id_fk", + "tableFrom": "roles", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_roles": { + "name": "user_roles", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_roles_user_id_users_id_fk": { + "name": "user_roles_user_id_users_id_fk", + "tableFrom": "user_roles", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_roles_role_id_roles_id_fk": { + "name": "user_roles_role_id_roles_id_fk", + "tableFrom": "user_roles", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "users_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'partners'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "image_url": { + "name": "image_url", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "language": { + "name": "language", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'en'" + } + }, + "indexes": {}, + "foreignKeys": { + "users_company_id_vendors_id_fk": { + "name": "users_company_id_vendors_id_fk", + "tableFrom": "users", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_entries": { + "name": "form_entries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_entries_contract_item_id_contract_items_id_fk": { + "name": "form_entries_contract_item_id_contract_items_id_fk", + "tableFrom": "form_entries", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_metas": { + "name": "form_metas", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "columns": { + "name": "columns", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_metas_project_id_projects_id_fk": { + "name": "form_metas_project_id_projects_id_fk", + "tableFrom": "form_metas", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "form_code_project_unique": { + "name": "form_code_project_unique", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.forms": { + "name": "forms", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "forms_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "eng": { + "name": "eng", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "im": { + "name": "im", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_item_form_code_unique": { + "name": "contract_item_form_code_unique", + "columns": [ + { + "expression": "contract_item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "form_code", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "forms_contract_item_id_contract_items_id_fk": { + "name": "forms_contract_item_id_contract_items_id_fk", + "tableFrom": "forms", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_class_attributes": { + "name": "tag_class_attributes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_class_attributes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "tag_class_id": { + "name": "tag_class_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "att_id": { + "name": "att_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "def_val": { + "name": "def_val", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uom_id": { + "name": "uom_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "seq": { + "name": "seq", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "tag_class_attributes_seq_idx": { + "name": "tag_class_attributes_seq_idx", + "columns": [ + { + "expression": "seq", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "tag_class_attributes_tag_class_id_tag_classes_id_fk": { + "name": "tag_class_attributes_tag_class_id_tag_classes_id_fk", + "tableFrom": "tag_class_attributes", + "tableTo": "tag_classes", + "columnsFrom": [ + "tag_class_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_att_id_in_tag_class": { + "name": "uniq_att_id_in_tag_class", + "nullsNotDistinct": false, + "columns": [ + "tag_class_id", + "att_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_classes": { + "name": "tag_classes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_classes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_classes_project_id_projects_id_fk": { + "name": "tag_classes_project_id_projects_id_fk", + "tableFrom": "tag_classes", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk": { + "name": "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk", + "tableFrom": "tag_classes", + "tableTo": "tag_types", + "columnsFrom": [ + "tag_type_code", + "project_id" + ], + "columnsTo": [ + "code", + "project_id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_code_in_project": { + "name": "uniq_code_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfield_options": { + "name": "tag_subfield_options", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfield_options_project_id_projects_id_fk": { + "name": "tag_subfield_options_project_id_projects_id_fk", + "tableFrom": "tag_subfield_options", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_attribute_project_code": { + "name": "uniq_attribute_project_code", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "attributes_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfields": { + "name": "tag_subfields", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfields_project_id_projects_id_fk": { + "name": "tag_subfields_project_id_projects_id_fk", + "tableFrom": "tag_subfields", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_tag_type_attribute": { + "name": "uniq_tag_type_attribute", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_code", + "attributes_id" + ] + }, + "uniq_attribute_id_project": { + "name": "uniq_attribute_id_project", + "nullsNotDistinct": false, + "columns": [ + "attributes_id", + "project_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_type_class_form_mappings": { + "name": "tag_type_class_form_mappings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_label": { + "name": "tag_type_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "class_label": { + "name": "class_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "ep": { + "name": "ep", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_mapping_in_project": { + "name": "uniq_mapping_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_label", + "class_label", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_types": { + "name": "tag_types", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_types_project_id_projects_id_fk": { + "name": "tag_types_project_id_projects_id_fk", + "tableFrom": "tag_types", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "tag_types_code_project_id_pk": { + "name": "tag_types_code_project_id_pk", + "columns": [ + "code", + "project_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tags": { + "name": "tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tags_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "tag_type": { + "name": "tag_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "class": { + "name": "class", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tags_contract_item_id_contract_items_id_fk": { + "name": "tags_contract_item_id_contract_items_id_fk", + "tableFrom": "tags", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_form_id_forms_id_fk": { + "name": "tags_form_id_forms_id_fk", + "tableFrom": "tags", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_item_tag_no_unique": { + "name": "contract_item_tag_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_item_id", + "tag_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_data_report_temps": { + "name": "vendor_data_report_temps", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_data_report_temps_contract_item_id_contract_items_id_fk": { + "name": "vendor_data_report_temps_contract_item_id_contract_items_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_data_report_temps_form_id_forms_id_fk": { + "name": "vendor_data_report_temps_form_id_forms_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.change_logs": { + "name": "change_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "changed_fields": { + "name": "changed_fields", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "old_values": { + "name": "old_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "new_values": { + "name": "new_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_name": { + "name": "user_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_synced": { + "name": "is_synced", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "sync_attempts": { + "name": "sync_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_sync_error": { + "name": "last_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "synced_at": { + "name": "synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "target_systems": { + "name": "target_systems", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + } + }, + "indexes": { + "idx_change_logs_contract_synced": { + "name": "idx_change_logs_contract_synced", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_synced", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_created_at": { + "name": "idx_change_logs_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_entity": { + "name": "idx_change_logs_entity", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_sync_attempts": { + "name": "idx_change_logs_sync_attempts", + "columns": [ + { + "expression": "sync_attempts", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.document_attachments": { + "name": "document_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "document_attachments_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "revision_id": { + "name": "revision_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "upload_id": { + "name": "upload_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "file_id": { + "name": "file_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "dolce_file_path": { + "name": "dolce_file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "document_attachments_revision_id_revisions_id_fk": { + "name": "document_attachments_revision_id_revisions_id_fk", + "tableFrom": "document_attachments", + "tableTo": "revisions", + "columnsFrom": [ + "revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.documents": { + "name": "documents", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "documents_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "drawing_move_gbn": { + "name": "drawing_move_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "discipline": { + "name": "discipline", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "external_document_id": { + "name": "external_document_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "external_system_type": { + "name": "external_system_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "external_synced_at": { + "name": "external_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "shi_drawing_no": { + "name": "shi_drawing_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager": { + "name": "manager", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_enm": { + "name": "manager_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_no": { + "name": "manager_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "register_group": { + "name": "register_group", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "register_group_id": { + "name": "register_group_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "create_user_no": { + "name": "create_user_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "create_user_id": { + "name": "create_user_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "create_user_enm": { + "name": "create_user_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_contract_doc_status": { + "name": "unique_contract_doc_status", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_contract_vendor_doc": { + "name": "unique_contract_vendor_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"vendor_doc_number\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_external_doc": { + "name": "unique_external_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_system_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"external_document_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "drawing_kind_idx": { + "name": "drawing_kind_idx", + "columns": [ + { + "expression": "drawing_kind", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "documents_contract_id_contracts_id_fk": { + "name": "documents_contract_id_contracts_id_fk", + "tableFrom": "documents", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.issue_stages": { + "name": "issue_stages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "issue_stages_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_name": { + "name": "stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "plan_date": { + "name": "plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "actual_date": { + "name": "actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "stage_status": { + "name": "stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "stage_order": { + "name": "stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "priority": { + "name": "priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'MEDIUM'" + }, + "assignee_id": { + "name": "assignee_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "assignee_name": { + "name": "assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "reminder_days": { + "name": "reminder_days", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_document_stage": { + "name": "unique_document_stage", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_stage_order": { + "name": "document_stage_order", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "issue_stages_document_id_documents_id_fk": { + "name": "issue_stages_document_id_documents_id_fk", + "tableFrom": "issue_stages", + "tableTo": "documents", + "columnsFrom": [ + "document_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.revisions": { + "name": "revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "revisions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "issue_stage_id": { + "name": "issue_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "revision": { + "name": "revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "uploader_type": { + "name": "uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'vendor'" + }, + "uploader_id": { + "name": "uploader_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploader_name": { + "name": "uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "usage": { + "name": "usage", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "revision_status": { + "name": "revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'SUBMITTED'" + }, + "submitted_date": { + "name": "submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "review_start_date": { + "name": "review_start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "approved_date": { + "name": "approved_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "rejected_date": { + "name": "rejected_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "reviewer_id": { + "name": "reviewer_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "review_comments": { + "name": "review_comments", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "external_upload_id": { + "name": "external_upload_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_stage_rev": { + "name": "unique_stage_rev", + "columns": [ + { + "expression": "issue_stage_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "revision", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_batches": { + "name": "sync_batches", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "batch_size": { + "name": "batch_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "retry_count": { + "name": "retry_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "change_log_ids": { + "name": "change_log_ids", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "success_count": { + "name": "success_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "failure_count": { + "name": "failure_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sync_metadata": { + "name": "sync_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_batches_contract_system": { + "name": "idx_sync_batches_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_status": { + "name": "idx_sync_batches_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_created_at": { + "name": "idx_sync_batches_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_configs": { + "name": "sync_configs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "sync_interval_minutes": { + "name": "sync_interval_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 30 + }, + "last_successful_sync": { + "name": "last_successful_sync", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_sync_attempt": { + "name": "last_sync_attempt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "endpoint_url": { + "name": "endpoint_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "auth_token": { + "name": "auth_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "api_version": { + "name": "api_version", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'v1'" + }, + "max_batch_size": { + "name": "max_batch_size", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 100 + }, + "retry_max_attempts": { + "name": "retry_max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_configs_contract_system": { + "name": "idx_sync_configs_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sync_configs_contract_id_contracts_id_fk": { + "name": "sync_configs_contract_id_contracts_id_fk", + "tableFrom": "sync_configs", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_attachments": { + "name": "vendor_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'GENERAL'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_attachments_vendor_id_vendors_id_fk": { + "name": "vendor_attachments_vendor_id_vendors_id_fk", + "tableFrom": "vendor_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidates": { + "name": "vendor_candidates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidates_vendor_id_vendors_id_fk": { + "name": "vendor_candidates_vendor_id_vendors_id_fk", + "tableFrom": "vendor_candidates", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_contacts": { + "name": "vendor_contacts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contact_name": { + "name": "contact_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_position": { + "name": "contact_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "is_primary": { + "name": "is_primary", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_contacts_vendor_id_vendors_id_fk": { + "name": "vendor_contacts_vendor_id_vendors_id_fk", + "tableFrom": "vendor_contacts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_items": { + "name": "vendor_possible_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_items_vendor_id_vendors_id_fk": { + "name": "vendor_possible_items_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_items_item_code_items_item_code_fk": { + "name": "vendor_possible_items_item_code_items_item_code_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_materials": { + "name": "vendor_possible_materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_materials_vendor_id_vendors_id_fk": { + "name": "vendor_possible_materials_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_materials_item_code_materials_item_code_fk": { + "name": "vendor_possible_materials_item_code_materials_item_code_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "materials", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_types": { + "name": "vendor_types", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_types_code_unique": { + "name": "vendor_types_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors": { + "name": "vendors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "vendor_type_id": { + "name": "vendor_type_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_vendor_type_id_vendor_types_id_fk": { + "name": "vendors_vendor_type_id_vendor_types_id_fk", + "tableFrom": "vendors", + "tableTo": "vendor_types", + "columnsFrom": [ + "vendor_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tasks": { + "name": "tasks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'todo'" + }, + "label": { + "name": "label", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'bug'" + }, + "priority": { + "name": "priority", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'low'" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "current_timestamp" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tasks_code_unique": { + "name": "tasks_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidate_logs": { + "name": "vendor_candidate_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_candidate_id": { + "name": "vendor_candidate_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk": { + "name": "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "vendor_candidates", + "columnsFrom": [ + "vendor_candidate_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_candidate_logs_user_id_users_id_fk": { + "name": "vendor_candidate_logs_user_id_users_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors_logs": { + "name": "vendors_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_logs_vendor_id_vendors_id_fk": { + "name": "vendors_logs_vendor_id_vendors_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendors_logs_user_id_users_id_fk": { + "name": "vendors_logs_user_id_users_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract": { + "name": "basic_contract", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_id": { + "name": "template_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requested_by": { + "name": "requested_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "basic_contract_template_id_basic_contract_templates_id_fk": { + "name": "basic_contract_template_id_basic_contract_templates_id_fk", + "tableFrom": "basic_contract", + "tableTo": "basic_contract_templates", + "columnsFrom": [ + "template_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_vendor_id_vendors_id_fk": { + "name": "basic_contract_vendor_id_vendors_id_fk", + "tableFrom": "basic_contract", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_requested_by_users_id_fk": { + "name": "basic_contract_requested_by_users_id_fk", + "tableFrom": "basic_contract", + "tableTo": "users", + "columnsFrom": [ + "requested_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract_templates": { + "name": "basic_contract_templates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_templates_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_name": { + "name": "template_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "validity_period": { + "name": "validity_period", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.incoterms": { + "name": "incoterms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(20)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "incoterms_created_by_users_id_fk": { + "name": "incoterms_created_by_users_id_fk", + "tableFrom": "incoterms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payment_terms": { + "name": "payment_terms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "payment_terms_created_by_users_id_fk": { + "name": "payment_terms_created_by_users_id_fk", + "tableFrom": "payment_terms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pr_items": { + "name": "pr_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "pr_items", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_attachments": { + "name": "procurement_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "procurement_rfq_details_id": { + "name": "procurement_rfq_details_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk": { + "name": "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfq_details", + "columnsFrom": [ + "procurement_rfq_details_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_created_by_users_id_fk": { + "name": "procurement_attachments_created_by_users_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "attachment_type_check": { + "name": "attachment_type_check", + "value": "\"procurement_attachments\".\"procurement_rfqs_id\" IS NOT NULL OR \"procurement_attachments\".\"procurement_rfq_details_id\" IS NOT NULL" + } + }, + "isRLSEnabled": false + }, + "public.procurement_quotation_items": { + "name": "procurement_quotation_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pr_item_id": { + "name": "pr_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "material_code": { + "name": "material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "uom": { + "name": "uom", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "unit_price": { + "name": "unit_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "vendor_material_code": { + "name": "vendor_material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_material_description": { + "name": "vendor_material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "lead_time_in_days": { + "name": "lead_time_in_days", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_rate": { + "name": "discount_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_amount": { + "name": "discount_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_alternative": { + "name": "is_alternative", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_recommended": { + "name": "is_recommended", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_quotation_items_pr_item_id_pr_items_id_fk": { + "name": "procurement_quotation_items_pr_item_id_pr_items_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "pr_items", + "columnsFrom": [ + "pr_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_attachments": { + "name": "procurement_rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_uploaded_by_users_id_fk": { + "name": "procurement_rfq_attachments_uploaded_by_users_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_comments": { + "name": "procurement_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_comments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_user_id_users_id_fk": { + "name": "procurement_rfq_comments_user_id_users_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_details": { + "name": "procurement_rfq_details", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendors_id": { + "name": "vendors_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'VV'" + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_vendors_id_vendors_id_fk": { + "name": "procurement_rfq_details_vendors_id_vendors_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "vendors", + "columnsFrom": [ + "vendors_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_rfq_details_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_incoterms_code_incoterms_code_fk": { + "name": "procurement_rfq_details_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_updated_by_users_id_fk": { + "name": "procurement_rfq_details_updated_by_users_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfqs": { + "name": "procurement_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "series": { + "name": "series", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "rfq_sealed_yn": { + "name": "rfq_sealed_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfqs_project_id_projects_id_fk": { + "name": "procurement_rfqs_project_id_projects_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_sent_by_users_id_fk": { + "name": "procurement_rfqs_sent_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_created_by_users_id_fk": { + "name": "procurement_rfqs_created_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_updated_by_users_id_fk": { + "name": "procurement_rfqs_updated_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "procurement_rfqs_rfq_code_unique": { + "name": "procurement_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_vendor_quotations": { + "name": "procurement_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_items_count": { + "name": "total_items_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sub_total": { + "name": "sub_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "tax_total": { + "name": "tax_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "discount_total": { + "name": "discount_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "estimated_delivery_date": { + "name": "estimated_delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "procurement_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_incoterms_code_incoterms_code_fk": { + "name": "procurement_vendor_quotations_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.preset_shares": { + "name": "preset_shares", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "preset_id": { + "name": "preset_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "shared_with_user_id": { + "name": "shared_with_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'read'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "preset_shares_preset_id_table_presets_id_fk": { + "name": "preset_shares_preset_id_table_presets_id_fk", + "tableFrom": "preset_shares", + "tableTo": "table_presets", + "columnsFrom": [ + "preset_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_presets": { + "name": "table_presets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_shared": { + "name": "is_shared", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_attachments": { + "name": "tech_sales_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "tech_sales_rfq_id": { + "name": "tech_sales_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "tech_sales_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_attachments_created_by_users_id_fk": { + "name": "tech_sales_attachments_created_by_users_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comment_attachments": { + "name": "tech_sales_rfq_comment_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk": { + "name": "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk": { + "name": "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comments": { + "name": "tech_sales_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_user_id_users_id_fk": { + "name": "tech_sales_rfq_comments_user_id_users_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfqs": { + "name": "tech_sales_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_shipbuilding_id": { + "name": "item_shipbuilding_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "bidding_project_id": { + "name": "bidding_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_snapshot": { + "name": "project_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "series_snapshot": { + "name": "series_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk": { + "name": "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "item_shipbuilding", + "columnsFrom": [ + "item_shipbuilding_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk": { + "name": "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bidding_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_sent_by_users_id_fk": { + "name": "tech_sales_rfqs_sent_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_created_by_users_id_fk": { + "name": "tech_sales_rfqs_created_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_updated_by_users_id_fk": { + "name": "tech_sales_rfqs_updated_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tech_sales_rfqs_rfq_code_unique": { + "name": "tech_sales_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_vendor_quotations": { + "name": "tech_sales_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "tech_sales_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rotation_attempts": { + "name": "ocr_rotation_attempts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "rotation": { + "name": "rotation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "tables_found": { + "name": "tables_found", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "text_quality": { + "name": "text_quality", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "keyword_count": { + "name": "keyword_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "score": { + "name": "score", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "extracted_rows_count": { + "name": "extracted_rows_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_rotation_attempts_session_id_ocr_sessions_id_fk": { + "name": "ocr_rotation_attempts_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rotation_attempts", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rows": { + "name": "ocr_rows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "table_id": { + "name": "table_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "row_index": { + "name": "row_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "report_no": { + "name": "report_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "no": { + "name": "no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "identification_no": { + "name": "identification_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_no": { + "name": "joint_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_type": { + "name": "joint_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "welding_date": { + "name": "welding_date", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "source_table": { + "name": "source_table", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "source_row": { + "name": "source_row", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_ocr_report_no_unique": { + "name": "idx_ocr_report_no_unique", + "columns": [ + { + "expression": "report_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "tag_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "joint_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "joint_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "ocr_rows_table_id_ocr_tables_id_fk": { + "name": "ocr_rows_table_id_ocr_tables_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_tables", + "columnsFrom": [ + "table_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_session_id_ocr_sessions_id_fk": { + "name": "ocr_rows_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_user_id_users_id_fk": { + "name": "ocr_rows_user_id_users_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_sessions": { + "name": "ocr_sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "processing_time": { + "name": "processing_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "best_rotation": { + "name": "best_rotation", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_tables": { + "name": "total_tables", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_rows": { + "name": "total_rows", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "image_enhanced": { + "name": "image_enhanced", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pdf_converted": { + "name": "pdf_converted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "success": { + "name": "success", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "warnings": { + "name": "warnings", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_tables": { + "name": "ocr_tables", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "table_index": { + "name": "table_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "row_count": { + "name": "row_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_tables_session_id_ocr_sessions_id_fk": { + "name": "ocr_tables_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_tables", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.offshore_hull_work_type": { + "name": "offshore_hull_work_type", + "schema": "public", + "values": [ + "HA", + "HE", + "HH", + "HM", + "NC" + ] + }, + "public.offshore_top_work_type": { + "name": "offshore_top_work_type", + "schema": "public", + "values": [ + "TM", + "TS", + "TE", + "TP" + ] + }, + "public.work_type": { + "name": "work_type", + "schema": "public", + "values": [ + "기장", + "전장", + "선실", + "배관", + "철의" + ] + }, + "public.user_domain": { + "name": "user_domain", + "schema": "public", + "values": [ + "evcp", + "partners" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": { + "public.contracts_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"contracts\".\"id\", \"contracts\".\"contract_no\", \"contracts\".\"contract_name\", \"contracts\".\"status\", \"contracts\".\"start_date\", \"contracts\".\"end_date\", \"contracts\".\"project_id\", \"projects\".\"code\", \"projects\".\"name\", \"contracts\".\"vendor_id\", \"vendors\".\"vendor_name\", \"contracts\".\"payment_terms\", \"contracts\".\"delivery_terms\", \"contracts\".\"delivery_date\", \"contracts\".\"delivery_location\", \"contracts\".\"currency\", \"contracts\".\"total_amount\", \"contracts\".\"discount\", \"contracts\".\"tax\", \"contracts\".\"shipping_fee\", \"contracts\".\"net_total\", \"contracts\".\"partial_shipping_allowed\", \"contracts\".\"partial_payment_allowed\", \"contracts\".\"remarks\", \"contracts\".\"version\", \"contracts\".\"created_at\", \"contracts\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"contracts\".\"id\"\n ) as \"has_signature\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "contracts_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.poa_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", + "name": "poa_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.project_approved_vendors": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"status\", \"vendor_types\".\"name_ko\", \"vendor_types\".\"name_en\", \"projects\".\"code\", \"projects\".\"name\", \"projects\".\"type\", \"vendor_pq_submissions\".\"submitted_at\", \"vendor_pq_submissions\".\"approved_at\" from \"vendors\" inner join \"vendor_pq_submissions\" on \"vendor_pq_submissions\".\"vendor_id\" = \"vendors\".\"id\" inner join \"projects\" on \"vendor_pq_submissions\".\"project_id\" = \"projects\".\"id\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\" where \"vendor_pq_submissions\".\"status\" = 'APPROVED'", + "name": "project_approved_vendors", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_investigations_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"vendor_id\", \"vendor_investigations\".\"pq_submission_id\", \"vendor_investigations\".\"requester_id\", \"vendor_investigations\".\"qm_manager_id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"evaluation_type\", \"vendor_investigations\".\"investigation_address\", \"vendor_investigations\".\"investigation_method\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"forecasted_at\", \"vendor_investigations\".\"requested_at\", \"vendor_investigations\".\"confirmed_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"evaluation_score\", \"vendor_investigations\".\"evaluation_result\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", requester.name as \"requesterName\", requester.email as \"requesterEmail\", qm_manager.name as \"qmManagerName\", qm_manager.email as \"qmManagerEmail\", (\n CASE \n WHEN EXISTS (\n SELECT 1 FROM vendor_investigation_attachments via \n WHERE via.investigation_id = \"vendor_investigations\".\"id\"\n ) \n THEN true \n ELSE false \n END\n ) as \"hasAttachments\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\" left join users AS requester on \"vendor_investigations\".\"requester_id\" = requester.id left join users AS qm_manager on \"vendor_investigations\".\"qm_manager_id\" = qm_manager.id", + "name": "vendor_investigations_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.cbe_view": { + "columns": {}, + "definition": "select \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"rfq_id\" as \"rfq_id\", \"cbe_evaluations\".\"vendor_id\" as \"vendor_id\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"result\" as \"result\", \"cbe_evaluations\".\"notes\" as \"notes\", \"cbe_evaluations\".\"evaluated_by\" as \"evaluated_by\", \"cbe_evaluations\".\"evaluated_at\" as \"evaluated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"name\" as \"evaluator_name\", \"users\".\"email\" as \"evaluator_email\" from \"cbe_evaluations\" inner join \"rfqs\" on \"cbe_evaluations\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"cbe_evaluations\".\"evaluated_by\" = \"users\".\"id\"", + "name": "cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.rfqs_view": { + "columns": {}, + "definition": "select \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"rfqs\".\"parent_rfq_id\" as \"parent_rfq_id\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"email\" as \"user_email\", \"users\".\"name\" as \"user_name\", (\n SELECT COUNT(*) \n FROM \"rfq_items\" \n WHERE \"rfq_items\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"item_count\", (\n SELECT COUNT(*) \n FROM \"rfq_attachments\" \n WHERE \"rfq_attachments\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"attachment_count\" from \"rfqs\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"rfqs\".\"created_by\" = \"users\".\"id\"", + "name": "rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_cbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", \"cbe_evaluations\".\"notes\" as \"cbe_note\", \"cbe_evaluations\".\"updated_at\" as \"cbe_updated\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"delivery_schedule\" as \"delivery_schedule\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_response_cbe_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"notes\" as \"response_notes\", \"vendor_responses\".\"responded_by\" as \"responded_by\", \"vendor_responses\".\"responded_at\" as \"responded_at\", \"vendor_responses\".\"updated_at\" as \"response_updated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"status\" as \"vendor_status\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"response_status\" as \"commercial_response_status\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"vendor_commercial_responses\".\"payment_terms\" as \"payment_terms\", \"vendor_commercial_responses\".\"incoterms\" as \"incoterms\", \"vendor_commercial_responses\".\"delivery_period\" as \"delivery_period\", \"vendor_commercial_responses\".\"warranty_period\" as \"warranty_period\", \"vendor_commercial_responses\".\"validity_period\" as \"validity_period\", \"vendor_commercial_responses\".\"price_breakdown\" as \"price_breakdown\", \"vendor_commercial_responses\".\"commercial_notes\" as \"commercial_notes\", \"vendor_commercial_responses\".\"created_at\" as \"commercial_created_at\", \"vendor_commercial_responses\".\"updated_at\" as \"commercial_updated_at\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"commercial_response_id\" = \"vendor_commercial_responses\".\"id\"\n ) as \"commercial_attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n AND \"vendor_response_attachments\".\"attachment_type\" = 'TECHNICAL_SPEC'\n ) as \"technical_attachment_count\", (\n SELECT MAX(\"uploaded_at\") \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"latest_attachment_date\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\"", + "name": "vendor_response_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_responses_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"created_at\" as \"rfq_created_at\", \"rfqs\".\"updated_at\" as \"rfq_updated_at\", \"rfqs\".\"created_by\" as \"rfq_created_by\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"responded_at\" as \"responded_at\", CASE WHEN \"vendor_technical_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_technical_response\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", CASE WHEN \"vendor_commercial_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_commercial_response\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"rfq_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE') left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"cbe_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\")", + "name": "vendor_responses_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_rfq_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", + "name": "vendor_rfq_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_tbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", \"vendor_technical_responses\".\"response_status\" as \"technical_response_status\", \"vendor_technical_responses\".\"summary\" as \"technical_summary\", \"vendor_technical_responses\".\"notes\" as \"technical_notes\", \"vendor_technical_responses\".\"updated_at\" as \"technical_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"rfq_evaluations\".\"notes\" as \"tbe_note\", \"rfq_evaluations\".\"updated_at\" as \"tbe_updated\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_tbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.role_view": { + "columns": {}, + "definition": "select \"roles\".\"id\" as \"id\", \"roles\".\"name\" as \"name\", \"roles\".\"description\" as \"description\", \"roles\".\"domain\" as \"domain\", \"roles\".\"created_at\" as \"created_at\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", COUNT(\"users\".\"id\") as \"user_count\" from \"roles\" left join \"user_roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" left join \"users\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"vendors\" on \"roles\".\"company_id\" = \"vendors\".\"id\" group by \"roles\".\"id\", \"vendors\".\"id\"", + "name": "role_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.user_view": { + "columns": {}, + "definition": "select \"users\".\"id\" as \"user_id\", \"users\".\"name\" as \"user_name\", \"users\".\"email\" as \"user_email\", \"users\".\"domain\" as \"user_domain\", \"users\".\"image_url\" as \"user_image\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"vendors\" on \"users\".\"company_id\" = \"vendors\".\"id\" left join \"user_roles\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" group by \"users\".\"id\", \"vendors\".\"id\"", + "name": "user_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.form_lists_view": { + "columns": {}, + "definition": "select \"tag_type_class_form_mappings\".\"id\" as \"id\", \"tag_type_class_form_mappings\".\"project_id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"tag_type_class_form_mappings\".\"tag_type_label\" as \"tag_type_label\", \"tag_type_class_form_mappings\".\"class_label\" as \"class_label\", \"tag_type_class_form_mappings\".\"form_code\" as \"form_code\", \"tag_type_class_form_mappings\".\"form_name\" as \"form_name\", \"tag_type_class_form_mappings\".\"ep\" as \"ep\", \"tag_type_class_form_mappings\".\"remark\" as \"remark\", \"tag_type_class_form_mappings\".\"created_at\" as \"created_at\", \"tag_type_class_form_mappings\".\"updated_at\" as \"updated_at\" from \"tag_type_class_form_mappings\" inner join \"projects\" on \"tag_type_class_form_mappings\".\"project_id\" = \"projects\".\"id\"", + "name": "form_lists_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.view_tag_subfields": { + "columns": { + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "definition": "select \"tag_subfields\".\"id\" as \"id\", \"tag_subfields\".\"tag_type_code\", \"tag_types\".\"description\", \"tag_subfields\".\"attributes_id\", \"tag_subfields\".\"attributes_description\", \"tag_subfields\".\"expression\", \"tag_subfields\".\"delimiter\", \"tag_subfields\".\"sort_order\", \"tag_subfields\".\"created_at\", \"tag_subfields\".\"updated_at\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\", \"projects\".\"name\" from \"tag_subfields\" inner join \"tag_types\" on (\"tag_subfields\".\"tag_type_code\" = \"tag_types\".\"code\" and \"tag_subfields\".\"project_id\" = \"tag_types\".\"project_id\") inner join \"projects\" on \"tag_subfields\".\"project_id\" = \"projects\".\"id\"", + "name": "view_tag_subfields", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.document_stages_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_count": { + "name": "stage_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_list": { + "name": "stage_list", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT\n d.id AS document_id,\n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n d.contract_id,\n (SELECT COUNT(*) FROM issue_stages WHERE document_id = d.id) AS stage_count,\n COALESCE( \n (SELECT json_agg(i.stage_name) FROM issue_stages i WHERE i.document_id = d.id), \n '[]'\n ) AS stage_list,\n d.created_at,\n d.updated_at\n FROM documents d\n", + "name": "document_stages_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.enhanced_documents_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_id": { + "name": "current_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_name": { + "name": "current_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_status": { + "name": "current_stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_order": { + "name": "current_stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_plan_date": { + "name": "current_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_actual_date": { + "name": "current_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_assignee_name": { + "name": "current_stage_assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_priority": { + "name": "current_stage_priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "days_until_due": { + "name": "days_until_due", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_overdue": { + "name": "is_overdue", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "days_difference": { + "name": "days_difference", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "total_stages": { + "name": "total_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "completed_stages": { + "name": "completed_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "progress_percentage": { + "name": "progress_percentage", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_status": { + "name": "latest_revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_submitted_date": { + "name": "latest_submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "all_stages": { + "name": "all_stages", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n WITH document_stats AS (\n SELECT \n d.id as document_id,\n COUNT(ist.id) as total_stages,\n COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) as completed_stages,\n CASE \n WHEN COUNT(ist.id) > 0 \n THEN ROUND((COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) * 100.0) / COUNT(ist.id))\n ELSE 0 \n END as progress_percentage\n FROM documents d\n LEFT JOIN issue_stages ist ON d.id = ist.document_id\n GROUP BY d.id\n ),\n current_stage_info AS (\n SELECT DISTINCT ON (document_id)\n document_id,\n id as current_stage_id,\n stage_name as current_stage_name,\n stage_status as current_stage_status,\n stage_order as current_stage_order,\n plan_date as current_stage_plan_date,\n actual_date as current_stage_actual_date,\n assignee_name as current_stage_assignee_name,\n priority as current_stage_priority,\n CASE \n WHEN actual_date IS NULL AND plan_date IS NOT NULL \n THEN plan_date - CURRENT_DATE\n ELSE NULL \n END as days_until_due,\n CASE \n WHEN actual_date IS NULL AND plan_date < CURRENT_DATE \n THEN true\n WHEN actual_date IS NOT NULL AND actual_date > plan_date \n THEN true\n ELSE false \n END as is_overdue,\n CASE \n WHEN actual_date IS NOT NULL AND plan_date IS NOT NULL \n THEN actual_date - plan_date\n ELSE NULL \n END as days_difference\n FROM issue_stages\n WHERE stage_status NOT IN ('COMPLETED', 'APPROVED')\n ORDER BY document_id, stage_order ASC, priority DESC\n ),\n latest_revision_info AS (\n SELECT DISTINCT ON (ist.document_id)\n ist.document_id,\n r.id as latest_revision_id,\n r.revision as latest_revision,\n r.revision_status as latest_revision_status,\n r.uploader_name as latest_revision_uploader_name,\n r.submitted_date as latest_submitted_date\n FROM revisions r\n JOIN issue_stages ist ON r.issue_stage_id = ist.id\n ORDER BY ist.document_id, r.created_at DESC\n ),\n -- 리비전별 첨부파일 집계\n revision_attachments AS (\n SELECT \n r.id as revision_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', da.id,\n 'revisionId', da.revision_id,\n 'fileName', da.file_name,\n 'filePath', da.file_path,\n 'fileSize', da.file_size,\n 'fileType', da.file_type,\n 'createdAt', da.created_at,\n 'updatedAt', da.updated_at\n ) ORDER BY da.created_at\n ) FILTER (WHERE da.id IS NOT NULL),\n '[]'::json\n ) as attachments\n FROM revisions r\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY r.id\n ),\n -- 스테이지별 리비전 집계 (첨부파일 포함)\n stage_revisions AS (\n SELECT \n ist.id as stage_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', r.id,\n 'issueStageId', r.issue_stage_id,\n 'revision', r.revision,\n 'uploaderType', r.uploader_type,\n 'uploaderId', r.uploader_id,\n 'uploaderName', r.uploader_name,\n 'comment', r.comment,\n 'usage', r.usage,\n 'revisionStatus', r.revision_status,\n 'submittedDate', r.submitted_date,\n 'uploadedAt', r.uploaded_at,\n 'approvedDate', r.approved_date,\n 'reviewStartDate', r.review_start_date,\n 'rejectedDate', r.rejected_date,\n 'reviewerId', r.reviewer_id,\n 'reviewerName', r.reviewer_name,\n 'reviewComments', r.review_comments,\n 'createdAt', r.created_at,\n 'updatedAt', r.updated_at,\n 'attachments', ra.attachments\n ) ORDER BY r.created_at\n ) FILTER (WHERE r.id IS NOT NULL),\n '[]'::json\n ) as revisions\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN revision_attachments ra ON r.id = ra.revision_id\n GROUP BY ist.id\n ),\n -- 문서별 스테이지 집계 (리비전 포함)\n stage_aggregation AS (\n SELECT \n ist.document_id,\n json_agg(\n json_build_object(\n 'id', ist.id,\n 'stageName', ist.stage_name,\n 'stageStatus', ist.stage_status,\n 'stageOrder', ist.stage_order,\n 'planDate', ist.plan_date,\n 'actualDate', ist.actual_date,\n 'assigneeName', ist.assignee_name,\n 'priority', ist.priority,\n 'revisions', sr.revisions\n ) ORDER BY ist.stage_order\n ) as all_stages\n FROM issue_stages ist\n LEFT JOIN stage_revisions sr ON ist.id = sr.stage_id\n GROUP BY ist.document_id\n ),\n attachment_counts AS (\n SELECT \n ist.document_id,\n COUNT(da.id) as attachment_count\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY ist.document_id\n )\n \n SELECT \n d.id as document_id,\n d.doc_number,\n d.drawing_kind,\n d.vendor_doc_number, -- ✅ 벤더 문서 번호 추가\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n -- ✅ 프로젝트 및 벤더 정보 추가\n p.code as project_code,\n v.vendor_name as vendor_name,\n v.vendor_code as vendor_code,\n \n -- 현재 스테이지 정보\n csi.current_stage_id,\n csi.current_stage_name,\n csi.current_stage_status,\n csi.current_stage_order,\n csi.current_stage_plan_date,\n csi.current_stage_actual_date,\n csi.current_stage_assignee_name,\n csi.current_stage_priority,\n \n -- 계산 필드\n csi.days_until_due,\n csi.is_overdue,\n csi.days_difference,\n \n -- 진행률 정보\n ds.total_stages,\n ds.completed_stages,\n ds.progress_percentage,\n \n -- 최신 리비전 정보\n lri.latest_revision_id,\n lri.latest_revision,\n lri.latest_revision_status,\n lri.latest_revision_uploader_name,\n lri.latest_submitted_date,\n \n -- 전체 스테이지 (리비전 및 첨부파일 포함)\n COALESCE(sa.all_stages, '[]'::json) as all_stages,\n \n -- 기타\n COALESCE(ac.attachment_count, 0) as attachment_count,\n d.created_at,\n d.updated_at\n \n FROM documents d\n -- ✅ contracts, projects, vendors 테이블 JOIN 추가\n LEFT JOIN contracts c ON d.contract_id = c.id\n LEFT JOIN projects p ON c.project_id = p.id\n LEFT JOIN vendors v ON c.vendor_id = v.id\n \n LEFT JOIN document_stats ds ON d.id = ds.document_id\n LEFT JOIN current_stage_info csi ON d.id = csi.document_id\n LEFT JOIN latest_revision_info lri ON d.id = lri.document_id\n LEFT JOIN stage_aggregation sa ON d.id = sa.document_id\n LEFT JOIN attachment_counts ac ON d.id = ac.document_id\n \n ORDER BY d.created_at DESC\n", + "name": "enhanced_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.sync_status_view": { + "columns": { + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "total_changes": { + "name": "total_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pending_changes": { + "name": "pending_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "synced_changes": { + "name": "synced_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "failed_changes": { + "name": "failed_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "last_sync_at": { + "name": "last_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_sync_at": { + "name": "next_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n WITH change_stats AS (\n SELECT \n cl.contract_id,\n sc.target_system,\n COUNT(*) as total_changes,\n COUNT(CASE WHEN cl.is_synced = false AND cl.sync_attempts < sc.retry_max_attempts THEN 1 END) as pending_changes,\n COUNT(CASE WHEN cl.is_synced = true THEN 1 END) as synced_changes,\n COUNT(CASE WHEN cl.sync_attempts >= sc.retry_max_attempts AND cl.is_synced = false THEN 1 END) as failed_changes,\n MAX(cl.synced_at) as last_sync_at\n FROM change_logs cl\n CROSS JOIN sync_configs sc \n WHERE cl.contract_id = sc.contract_id\n AND (cl.target_systems IS NULL OR cl.target_systems @> to_jsonb(sc.target_system))\n GROUP BY cl.contract_id, sc.target_system\n )\n SELECT \n cs.contract_id,\n cs.target_system,\n COALESCE(cs.total_changes, 0) as total_changes,\n COALESCE(cs.pending_changes, 0) as pending_changes,\n COALESCE(cs.synced_changes, 0) as synced_changes,\n COALESCE(cs.failed_changes, 0) as failed_changes,\n cs.last_sync_at,\n CASE \n WHEN sc.sync_enabled = true AND sc.last_successful_sync IS NOT NULL \n THEN sc.last_successful_sync + (sc.sync_interval_minutes || ' minutes')::interval\n ELSE NULL\n END as next_sync_at,\n sc.sync_enabled\n FROM sync_configs sc\n LEFT JOIN change_stats cs ON sc.contract_id = cs.contract_id AND sc.target_system = cs.target_system\n", + "name": "sync_status_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_documents_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "latest_stage_id": { + "name": "latest_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_stage_name": { + "name": "latest_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_stage_plan_date": { + "name": "latest_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_stage_actual_date": { + "name": "latest_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_type": { + "name": "latest_revision_uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT \n d.id, \n d.doc_number,\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n (SELECT id FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_id,\n (SELECT stage_name FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_name,\n (SELECT plan_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_plan_date,\n (SELECT actual_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_actual_date,\n \n (SELECT r.id FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_id,\n (SELECT r.revision FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision,\n (SELECT r.uploader_type FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_type,\n (SELECT r.uploader_name FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_name,\n \n (SELECT COUNT(*) FROM document_attachments a JOIN revisions r ON a.revision_id = r.id JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id) AS attachment_count,\n \n d.created_at,\n d.updated_at\n FROM documents d\n JOIN contracts c ON d.contract_id = c.id\n ", + "name": "vendor_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_candidates_with_vendor_info": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_candidates\".\"id\", \"vendor_candidates\".\"company_name\", \"vendor_candidates\".\"contact_email\", \"vendor_candidates\".\"contact_phone\", \"vendor_candidates\".\"tax_id\", \"vendor_candidates\".\"address\", \"vendor_candidates\".\"country\", \"vendor_candidates\".\"source\", \"vendor_candidates\".\"status\", \"vendor_candidates\".\"items\", \"vendor_candidates\".\"remark\", \"vendor_candidates\".\"created_at\", \"vendor_candidates\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"created_at\" as \"vendor_created_at\", (\n SELECT l2.\"created_at\"\n FROM \"vendor_candidate_logs\" l2\n WHERE l2.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l2.\"action\" = 'status_change'\n ORDER BY l2.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_at\", (\n SELECT u.\"name\"\n FROM \"users\" u\n JOIN \"vendor_candidate_logs\" l3\n ON l3.\"user_id\" = u.\"id\"\n WHERE l3.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l3.\"action\" = 'status_change'\n ORDER BY l3.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_by\", (\n SELECT l4.\"created_at\"\n FROM \"vendor_candidate_logs\" l4\n WHERE l4.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l4.\"action\" = 'invite_sent'\n ORDER BY l4.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_at\", (\n SELECT u2.\"name\"\n FROM \"users\" u2\n JOIN \"vendor_candidate_logs\" l5\n ON l5.\"user_id\" = u2.\"id\"\n WHERE l5.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l5.\"action\" = 'invite_sent'\n ORDER BY l5.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_by\" from \"vendor_candidates\" left join \"vendors\" on \"vendor_candidates\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "vendor_candidates_with_vendor_info", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"business_size\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"", + "name": "vendor_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", + "name": "vendor_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_materials_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_materials\".\"id\", \"vendor_possible_materials\".\"vendor_id\", \"materials\".\"item_name\", \"materials\".\"item_code\", \"materials\".\"description\", \"materials\".\"unit_of_measure\", \"materials\".\"steel_type\", \"materials\".\"grade_material\", \"vendor_possible_materials\".\"created_at\", \"vendor_possible_materials\".\"updated_at\" from \"vendor_possible_materials\" left join \"materials\" on \"vendor_possible_materials\".\"item_code\" = \"materials\".\"item_code\"", + "name": "vendor_materials_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendors_with_types": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"tax_id\" as \"tax_id\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"phone\" as \"phone\", \"vendors\".\"email\" as \"email\", \"vendors\".\"business_size\" as \"business_size\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"status\", \"vendors\".\"vendor_type_id\" as \"vendor_type_id\", \"vendors\".\"representative_name\" as \"representative_name\", \"vendors\".\"representative_birth\" as \"representative_birth\", \"vendors\".\"representative_email\" as \"representative_email\", \"vendors\".\"representative_phone\" as \"representative_phone\", \"vendors\".\"corporate_registration_number\" as \"corporate_registration_number\", \"vendors\".\"items\" as \"items\", \"vendors\".\"credit_agency\" as \"credit_agency\", \"vendors\".\"credit_rating\" as \"credit_rating\", \"vendors\".\"cash_flow_rating\" as \"cash_flow_rating\", \"vendors\".\"created_at\" as \"created_at\", \"vendors\".\"updated_at\" as \"updated_at\", \"vendor_types\".\"name_ko\" as \"vendor_type_name\", \"vendor_types\".\"name_en\" as \"vendor_type_name_en\", \"vendor_types\".\"code\" as \"vendor_type_code\", \n CASE\n WHEN \"vendors\".\"status\" = 'ACTIVE' THEN '정규업체'\n WHEN \"vendors\".\"status\" IN ('INACTIVE', 'BLACKLISTED', 'REJECTED') THEN ''\n ELSE '잠재업체'\n END\n as \"vendor_category\" from \"vendors\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\"", + "name": "vendors_with_types", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.basic_contract_view": { + "columns": {}, + "definition": "select \"basic_contract\".\"id\" as \"id\", \"basic_contract\".\"template_id\" as \"template_id\", \"basic_contract\".\"vendor_id\" as \"vendor_id\", \"basic_contract\".\"requested_by\" as \"requested_by\", \"basic_contract\".\"status\" as \"basic_contract_status\", \"basic_contract\".\"created_at\" as \"created_at\", \"basic_contract\".\"updated_at\" as \"updated_at\", \"basic_contract\".\"updated_at\" as \"completed_at\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"email\" as \"vendor_email\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"users\".\"name\" as \"user_name\", \"basic_contract_templates\".\"template_name\" as \"template_name\", \"basic_contract_templates\".\"validity_period\" as \"validityPeriod\", \"basic_contract_templates\".\"file_path\" as \"file_path\", \"basic_contract_templates\".\"file_name\" as \"file_name\", \"basic_contract\".\"file_path\" as \"signed_file_path\" from \"basic_contract\" left join \"vendors\" on \"basic_contract\".\"vendor_id\" = \"vendors\".\"id\" left join \"users\" on \"basic_contract\".\"requested_by\" = \"users\".\"id\" left join \"basic_contract_templates\" on \"basic_contract\".\"template_id\" = \"basic_contract_templates\".\"id\"", + "name": "basic_contract_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.pr_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"pr_items\".\"id\", \"pr_items\".\"procurement_rfqs_id\", \"pr_items\".\"rfq_item\", \"pr_items\".\"pr_item\", \"pr_items\".\"pr_no\", \"pr_items\".\"material_code\", \"pr_items\".\"material_category\", \"pr_items\".\"acc\", \"pr_items\".\"material_description\", \"pr_items\".\"size\", \"pr_items\".\"delivery_date\", \"pr_items\".\"quantity\", \"pr_items\".\"uom\", \"pr_items\".\"gross_weight\", \"pr_items\".\"gw_uom\", \"pr_items\".\"spec_no\", \"pr_items\".\"spec_url\", \"pr_items\".\"tracking_no\", \"pr_items\".\"major_yn\", \"pr_items\".\"project_def\", \"pr_items\".\"project_sc\", \"pr_items\".\"project_kl\", \"pr_items\".\"project_lc\", \"pr_items\".\"project_dl\", \"pr_items\".\"remark\", \"procurement_rfqs\".\"rfq_code\", \"procurement_rfqs\".\"item_code\", \"procurement_rfqs\".\"item_name\" from \"pr_items\" left join \"procurement_rfqs\" on \"pr_items\".\"procurement_rfqs_id\" = \"procurement_rfqs\".\"id\"", + "name": "pr_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfq_details_view": { + "columns": {}, + "definition": "select \"rfq_details\".\"id\" as \"detail_id\", \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfqs\".\"item_code\" as \"item_code\", \"rfqs\".\"item_name\" as \"item_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"country\" as \"vendor_country\", \"rfq_details\".\"currency\" as \"currency\", \"payment_terms\".\"code\" as \"payment_terms_code\", \"payment_terms\".\"description\" as \"payment_terms_description\", \"incoterms\".\"code\" as \"incoterms_code\", \"incoterms\".\"description\" as \"incoterms_description\", \"rfq_details\".\"incoterms_detail\" as \"incoterms_detail\", \"rfq_details\".\"delivery_date\" as \"delivery_date\", \"rfq_details\".\"tax_code\" as \"tax_code\", \"rfq_details\".\"place_of_shipping\" as \"place_of_shipping\", \"rfq_details\".\"place_of_destination\" as \"place_of_destination\", \"rfq_details\".\"material_price_related_yn\" as \"material_price_related_yn\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"rfq_details\".\"updated_at\" as \"updated_at\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\"\n ) as \"pr_items_count\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\" \n AND major_yn = true\n ) as \"major_items_count\", (\n SELECT COUNT(*) \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"comment_count\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_comment_date\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\" AND is_vendor_comment = true\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_vendor_comment_date\", (\n SELECT COUNT(*) \n FROM procurement_rfq_attachments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) > 0\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"has_quotation\", (\n SELECT status\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_status\", (\n SELECT total_price\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_total_price\", (\n SELECT quotation_version\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"quotation_version\", (\n SELECT COUNT(DISTINCT quotation_version)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"quotation_version_count\", (\n SELECT created_at\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"last_quotation_date\" from \"procurement_rfq_details\" \"rfq_details\" left join \"procurement_rfqs\" \"rfqs\" on \"rfq_details\".\"procurement_rfqs_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"rfq_details\".\"vendors_id\" = \"vendors\".\"id\" left join \"payment_terms\" on \"rfq_details\".\"payment_terms_code\" = \"payment_terms\".\"code\" left join \"incoterms\" on \"rfq_details\".\"incoterms_code\" = \"incoterms\".\"code\" left join \"users\" \"updated_by_user\" on \"rfq_details\".\"updated_by\" = \"updated_by_user\".\"id\"", + "name": "procurement_rfq_details_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfqs_view": { + "columns": {}, + "definition": "select \"procurement_rfqs\".\"id\" as \"id\", \"procurement_rfqs\".\"rfq_code\" as \"rfq_code\", \"procurement_rfqs\".\"series\" as \"series\", \"procurement_rfqs\".\"rfq_sealed_yn\" as \"rfq_sealed_yn\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"procurement_rfqs\".\"item_code\" as \"item_code\", \"procurement_rfqs\".\"item_name\" as \"item_name\", \"procurement_rfqs\".\"status\" as \"status\", \"procurement_rfqs\".\"pic_code\" as \"pic_code\", \"procurement_rfqs\".\"rfq_send_date\" as \"rfq_send_date\", \"procurement_rfqs\".\"due_date\" as \"due_date\", (\n SELECT MIN(submitted_at)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"procurement_rfqs\".\"id\"\n AND submitted_at IS NOT NULL\n ) as \"earliest_quotation_submitted_at\", \"created_by_user\".\"name\" as \"created_by_user_name\", \"sent_by_user\".\"name\" as \"sent_by_user_name\", \"procurement_rfqs\".\"updated_at\" as \"updated_at\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"procurement_rfqs\".\"remark\" as \"remark\", (\n SELECT material_code \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"major_item_material_code\", (\n SELECT pr_no \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"po_no\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n ) as \"pr_items_count\" from \"procurement_rfqs\" left join \"projects\" on \"procurement_rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" \"created_by_user\" on \"procurement_rfqs\".\"created_by\" = \"created_by_user\".\"id\" left join \"users\" \"updated_by_user\" on \"procurement_rfqs\".\"updated_by\" = \"updated_by_user\".\"id\" left join \"users\" \"sent_by_user\" on \"procurement_rfqs\".\"sent_by\" = \"sent_by_user\".\"id\"", + "name": "procurement_rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + } + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db/migrations/meta/0121_snapshot.json b/db/migrations/meta/0121_snapshot.json new file mode 100644 index 00000000..857bd22a --- /dev/null +++ b/db/migrations/meta/0121_snapshot.json @@ -0,0 +1,12088 @@ +{ + "id": "76434f4f-b888-43e8-873c-4e3ce525af9a", + "prevId": "2776f234-d78d-40f0-9600-fcfbd546b6ab", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.companies": { + "name": "companies", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "companies_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "taxID": { + "name": "taxID", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_envelopes": { + "name": "contract_envelopes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_envelopes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "envelope_id": { + "name": "envelope_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": true + }, + "document_id": { + "name": "document_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": false + }, + "envelope_status": { + "name": "envelope_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_envelopes_contract_id_contracts_id_fk": { + "name": "contract_envelopes_contract_id_contracts_id_fk", + "tableFrom": "contract_envelopes", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_items": { + "name": "contract_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_items_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_id": { + "name": "item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "unit_price": { + "name": "unit_price", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "total_line_amount": { + "name": "total_line_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_items_contract_item_idx": { + "name": "contract_items_contract_item_idx", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "contract_items_contract_id_contracts_id_fk": { + "name": "contract_items_contract_id_contracts_id_fk", + "tableFrom": "contract_items", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_items_item_id_items_id_fk": { + "name": "contract_items_item_id_items_id_fk", + "tableFrom": "contract_items", + "tableTo": "items", + "columnsFrom": [ + "item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_items_contract_id_item_id_unique": { + "name": "contract_items_contract_id_item_id_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_id", + "item_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_signers": { + "name": "contract_signers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_signers_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "envelope_id": { + "name": "envelope_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_contact_id": { + "name": "vendor_contact_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "signer_type": { + "name": "signer_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'VENDOR'" + }, + "signer_email": { + "name": "signer_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "signer_name": { + "name": "signer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "signer_position": { + "name": "signer_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "signer_status": { + "name": "signer_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "signed_at": { + "name": "signed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_signers_envelope_id_contract_envelopes_id_fk": { + "name": "contract_signers_envelope_id_contract_envelopes_id_fk", + "tableFrom": "contract_signers", + "tableTo": "contract_envelopes", + "columnsFrom": [ + "envelope_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_signers_vendor_contact_id_vendor_contacts_id_fk": { + "name": "contract_signers_vendor_contact_id_vendor_contacts_id_fk", + "tableFrom": "contract_signers", + "tableTo": "vendor_contacts", + "columnsFrom": [ + "vendor_contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contracts": { + "name": "contracts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contracts_project_id_projects_id_fk": { + "name": "contracts_project_id_projects_id_fk", + "tableFrom": "contracts", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contracts_vendor_id_vendors_id_fk": { + "name": "contracts_vendor_id_vendors_id_fk", + "tableFrom": "contracts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contracts_contract_no_unique": { + "name": "contracts_contract_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.poa": { + "name": "poa", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "original_contract_no": { + "name": "original_contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "original_contract_name": { + "name": "original_contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_status": { + "name": "original_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "poa_original_contract_no_contracts_contract_no_fk": { + "name": "poa_original_contract_no_contracts_contract_no_fk", + "tableFrom": "poa", + "tableTo": "contracts", + "columnsFrom": [ + "original_contract_no" + ], + "columnsTo": [ + "contract_no" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_project_id_projects_id_fk": { + "name": "poa_project_id_projects_id_fk", + "tableFrom": "poa", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_vendor_id_vendors_id_fk": { + "name": "poa_vendor_id_vendors_id_fk", + "tableFrom": "poa", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_hull": { + "name": "item_offshore_hull", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_hull_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_hull_item_code_items_item_code_fk": { + "name": "item_offshore_hull_item_code_items_item_code_fk", + "tableFrom": "item_offshore_hull", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_top": { + "name": "item_offshore_top", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_top_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_top_item_code_items_item_code_fk": { + "name": "item_offshore_top_item_code_items_item_code_fk", + "tableFrom": "item_offshore_top", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_shipbuilding": { + "name": "item_shipbuilding", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ship_types": { + "name": "ship_types", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'OPTION'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_shipbuilding_item_code_items_item_code_fk": { + "name": "item_shipbuilding_item_code_items_item_code_fk", + "tableFrom": "item_shipbuilding", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.items": { + "name": "items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_no": { + "name": "project_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "package_code": { + "name": "package_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "sm_code": { + "name": "sm_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "items_item_code_unique": { + "name": "items_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.materials": { + "name": "materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "materials_item_code_unique": { + "name": "materials_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias": { + "name": "pq_criterias", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "check_point": { + "name": "check_point", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "group_name": { + "name": "group_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias_extension": { + "name": "pq_criterias_extension", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_criteria_id": { + "name": "pq_criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_info": { + "name": "contract_info", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "additional_requirement": { + "name": "additional_requirement", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk": { + "name": "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "pq_criterias", + "columnsFrom": [ + "pq_criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "pq_criterias_extension_project_id_projects_id_fk": { + "name": "pq_criterias_extension_project_id_projects_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_criteria_attachments": { + "name": "vendor_criteria_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_criteria_answer_id": { + "name": "vendor_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_criteria_attachments", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigation_attachments": { + "name": "vendor_investigation_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "investigation_id": { + "name": "investigation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'REPORT'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { + "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", + "tableFrom": "vendor_investigation_attachments", + "tableTo": "vendor_investigations", + "columnsFrom": [ + "investigation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigations": { + "name": "vendor_investigations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigations_vendor_id_vendors_id_fk": { + "name": "vendor_investigations_vendor_id_vendors_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk": { + "name": "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendor_pq_submissions", + "columnsFrom": [ + "pq_submission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "vendor_investigations_requester_id_users_id_fk": { + "name": "vendor_investigations_requester_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_qm_manager_id_users_id_fk": { + "name": "vendor_investigations_qm_manager_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "qm_manager_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_submissions": { + "name": "vendor_pq_submissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_number": { + "name": "pq_number", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_pq_submission": { + "name": "unique_pq_submission", + "columns": [ + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_pq_submissions_requester_id_users_id_fk": { + "name": "vendor_pq_submissions_requester_id_users_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_pq_submissions_vendor_id_vendors_id_fk": { + "name": "vendor_pq_submissions_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_submissions_project_id_projects_id_fk": { + "name": "vendor_pq_submissions_project_id_projects_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_pq_submissions_pq_number_unique": { + "name": "vendor_pq_submissions_pq_number_unique", + "nullsNotDistinct": false, + "columns": [ + "pq_number" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_criteria_answers": { + "name": "vendor_pq_criteria_answers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "criteria_id": { + "name": "criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "answer": { + "name": "answer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_criteria_answers_vendor_id_vendors_id_fk": { + "name": "vendor_pq_criteria_answers_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": { + "name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "pq_criterias", + "columnsFrom": [ + "criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_project_id_projects_id_fk": { + "name": "vendor_pq_criteria_answers_project_id_projects_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_review_logs": { + "name": "vendor_pq_review_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_pq_criteria_answer_id": { + "name": "vendor_pq_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "reviewer_comment": { + "name": "reviewer_comment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_pq_review_logs", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_pq_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_project_pqs": { + "name": "vendor_project_pqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_project_pqs_vendor_id_vendors_id_fk": { + "name": "vendor_project_pqs_vendor_id_vendors_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_project_pqs_project_id_projects_id_fk": { + "name": "vendor_project_pqs_project_id_projects_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bidding_projects": { + "name": "bidding_projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "proj_nm": { + "name": "proj_nm", + "type": "varchar(90)", + "primaryKey": false, + "notNull": false + }, + "sector": { + "name": "sector", + "type": "char(1)", + "primaryKey": false, + "notNull": false + }, + "proj_msrm": { + "name": "proj_msrm", + "type": "numeric(3, 0)", + "primaryKey": false, + "notNull": false + }, + "kunnr": { + "name": "kunnr", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "kunnr_nm": { + "name": "kunnr_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "cls_1": { + "name": "cls_1", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "cls1_nm": { + "name": "cls1_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "ptype": { + "name": "ptype", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "ptype_nm": { + "name": "ptype_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_cd": { + "name": "pmodel_cd", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "pmodel_nm": { + "name": "pmodel_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_sz": { + "name": "pmodel_sz", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "pmodel_uom": { + "name": "pmodel_uom", + "type": "char(5)", + "primaryKey": false, + "notNull": false + }, + "txt04": { + "name": "txt04", + "type": "char(4)", + "primaryKey": false, + "notNull": false + }, + "txt30": { + "name": "txt30", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "estm_pm": { + "name": "estm_pm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "bidding_projects_pspid_unique": { + "name": "bidding_projects_pspid_unique", + "nullsNotDistinct": false, + "columns": [ + "pspid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_series": { + "name": "project_series", + "schema": "", + "columns": { + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "sers_no": { + "name": "sers_no", + "type": "char(3)", + "primaryKey": false, + "notNull": true + }, + "sc_dt": { + "name": "sc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "kl_dt": { + "name": "kl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "lc_dt": { + "name": "lc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dl_dt": { + "name": "dl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dock_no": { + "name": "dock_no", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "dock_nm": { + "name": "dock_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "proj_no": { + "name": "proj_no", + "type": "char(24)", + "primaryKey": false, + "notNull": false + }, + "post1": { + "name": "post1", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "project_sersNo_unique": { + "name": "project_sersNo_unique", + "columns": [ + { + "expression": "pspid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sers_no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "project_series_pspid_bidding_projects_pspid_fk": { + "name": "project_series_pspid_bidding_projects_pspid_fk", + "tableFrom": "project_series", + "tableTo": "bidding_projects", + "columnsFrom": [ + "pspid" + ], + "columnsTo": [ + "pspid" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projects": { + "name": "projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cbe_evaluations": { + "name": "cbe_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluated_by": { + "name": "evaluated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluated_at": { + "name": "evaluated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "result": { + "name": "result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "total_cost": { + "name": "total_cost", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_schedule": { + "name": "delivery_schedule", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "cbe_evaluations_rfq_id_rfqs_id_fk": { + "name": "cbe_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_vendor_id_vendors_id_fk": { + "name": "cbe_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_evaluated_by_users_id_fk": { + "name": "cbe_evaluations_evaluated_by_users_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "users", + "columnsFrom": [ + "evaluated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_attachments": { + "name": "rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_attachments_rfq_id_rfqs_id_fk": { + "name": "rfq_attachments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_vendor_id_vendors_id_fk": { + "name": "rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_attachments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_cbe_id_cbe_evaluations_id_fk": { + "name": "rfq_attachments_cbe_id_cbe_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "cbe_evaluations", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_comment_id_rfq_comments_id_fk": { + "name": "rfq_attachments_comment_id_rfq_comments_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_comments": { + "name": "rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "comment_text": { + "name": "comment_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "commented_by": { + "name": "commented_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_comments_rfq_id_rfqs_id_fk": { + "name": "rfq_comments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_vendor_id_vendors_id_fk": { + "name": "rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_commented_by_users_id_fk": { + "name": "rfq_comments_commented_by_users_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "commented_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_comments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_cbe_id_vendor_responses_id_fk": { + "name": "rfq_comments_cbe_id_vendor_responses_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_evaluations": { + "name": "rfq_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "eval_type": { + "name": "eval_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "result": { + "name": "result", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_evaluations_rfq_id_rfqs_id_fk": { + "name": "rfq_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_evaluations_vendor_id_vendors_id_fk": { + "name": "rfq_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_items": { + "name": "rfq_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_items_rfq_id_rfqs_id_fk": { + "name": "rfq_items_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_items", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "rfq_items_item_code_items_item_code_fk": { + "name": "rfq_items_item_code_items_item_code_fk", + "tableFrom": "rfq_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfqs": { + "name": "rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "bid_project_id": { + "name": "bid_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false, + "default": "'PURCHASE'" + }, + "parent_rfq_id": { + "name": "parent_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfqs_project_id_projects_id_fk": { + "name": "rfqs_project_id_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_bid_project_id_bidding_projects_id_fk": { + "name": "rfqs_bid_project_id_bidding_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bid_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_created_by_users_id_fk": { + "name": "rfqs_created_by_users_id_fk", + "tableFrom": "rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_parent_rfq_id_rfqs_id_fk": { + "name": "rfqs_parent_rfq_id_rfqs_id_fk", + "tableFrom": "rfqs", + "tableTo": "rfqs", + "columnsFrom": [ + "parent_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "rfqs_rfq_code_unique": { + "name": "rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_commercial_responses": { + "name": "vendor_commercial_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "total_price": { + "name": "total_price", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_period": { + "name": "delivery_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "warranty_period": { + "name": "warranty_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "validity_period": { + "name": "validity_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "price_breakdown": { + "name": "price_breakdown", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "commercial_notes": { + "name": "commercial_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_commercial_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_commercial_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_commercial_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_attachments": { + "name": "vendor_response_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "technical_response_id": { + "name": "technical_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "commercial_response_id": { + "name": "commercial_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_attachments_response_id_vendor_responses_id_fk": { + "name": "vendor_response_attachments_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk": { + "name": "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_technical_responses", + "columnsFrom": [ + "technical_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk": { + "name": "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_commercial_responses", + "columnsFrom": [ + "commercial_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_responses": { + "name": "vendor_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'REVIEWING'" + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "responded_by": { + "name": "responded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "responded_at": { + "name": "responded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "vendor_response_unique": { + "name": "vendor_response_unique", + "columns": [ + { + "expression": "rfq_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_responses_rfq_id_rfqs_id_fk": { + "name": "vendor_responses_rfq_id_rfqs_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_responses_vendor_id_vendors_id_fk": { + "name": "vendor_responses_vendor_id_vendors_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_technical_responses": { + "name": "vendor_technical_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_technical_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_technical_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_technical_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.otps": { + "name": "otps", + "schema": "", + "columns": { + "email": { + "name": "email", + "type": "varchar(256)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(6)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "otpToken": { + "name": "otpToken", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "otp_expires": { + "name": "otp_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permissions": { + "name": "permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "permissions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "permission_key": { + "name": "permission_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.role_permissions": { + "name": "role_permissions", + "schema": "", + "columns": { + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "permission_id": { + "name": "permission_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "role_permissions_role_id_roles_id_fk": { + "name": "role_permissions_role_id_roles_id_fk", + "tableFrom": "role_permissions", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "role_permissions_permission_id_permissions_id_fk": { + "name": "role_permissions_permission_id_permissions_id_fk", + "tableFrom": "role_permissions", + "tableTo": "permissions", + "columnsFrom": [ + "permission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.roles": { + "name": "roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "roles_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "roles_company_id_vendors_id_fk": { + "name": "roles_company_id_vendors_id_fk", + "tableFrom": "roles", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_roles": { + "name": "user_roles", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_roles_user_id_users_id_fk": { + "name": "user_roles_user_id_users_id_fk", + "tableFrom": "user_roles", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_roles_role_id_roles_id_fk": { + "name": "user_roles_role_id_roles_id_fk", + "tableFrom": "user_roles", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "users_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'partners'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "image_url": { + "name": "image_url", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "language": { + "name": "language", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'en'" + } + }, + "indexes": {}, + "foreignKeys": { + "users_company_id_vendors_id_fk": { + "name": "users_company_id_vendors_id_fk", + "tableFrom": "users", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_entries": { + "name": "form_entries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_entries_contract_item_id_contract_items_id_fk": { + "name": "form_entries_contract_item_id_contract_items_id_fk", + "tableFrom": "form_entries", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_metas": { + "name": "form_metas", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "columns": { + "name": "columns", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_metas_project_id_projects_id_fk": { + "name": "form_metas_project_id_projects_id_fk", + "tableFrom": "form_metas", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "form_code_project_unique": { + "name": "form_code_project_unique", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.forms": { + "name": "forms", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "forms_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "eng": { + "name": "eng", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "im": { + "name": "im", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_item_form_code_unique": { + "name": "contract_item_form_code_unique", + "columns": [ + { + "expression": "contract_item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "form_code", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "forms_contract_item_id_contract_items_id_fk": { + "name": "forms_contract_item_id_contract_items_id_fk", + "tableFrom": "forms", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_class_attributes": { + "name": "tag_class_attributes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_class_attributes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "tag_class_id": { + "name": "tag_class_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "att_id": { + "name": "att_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "def_val": { + "name": "def_val", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uom_id": { + "name": "uom_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "seq": { + "name": "seq", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "tag_class_attributes_seq_idx": { + "name": "tag_class_attributes_seq_idx", + "columns": [ + { + "expression": "seq", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "tag_class_attributes_tag_class_id_tag_classes_id_fk": { + "name": "tag_class_attributes_tag_class_id_tag_classes_id_fk", + "tableFrom": "tag_class_attributes", + "tableTo": "tag_classes", + "columnsFrom": [ + "tag_class_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_att_id_in_tag_class": { + "name": "uniq_att_id_in_tag_class", + "nullsNotDistinct": false, + "columns": [ + "tag_class_id", + "att_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_classes": { + "name": "tag_classes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_classes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_classes_project_id_projects_id_fk": { + "name": "tag_classes_project_id_projects_id_fk", + "tableFrom": "tag_classes", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk": { + "name": "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk", + "tableFrom": "tag_classes", + "tableTo": "tag_types", + "columnsFrom": [ + "tag_type_code", + "project_id" + ], + "columnsTo": [ + "code", + "project_id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_code_in_project": { + "name": "uniq_code_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfield_options": { + "name": "tag_subfield_options", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfield_options_project_id_projects_id_fk": { + "name": "tag_subfield_options_project_id_projects_id_fk", + "tableFrom": "tag_subfield_options", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_attribute_project_code": { + "name": "uniq_attribute_project_code", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "attributes_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfields": { + "name": "tag_subfields", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfields_project_id_projects_id_fk": { + "name": "tag_subfields_project_id_projects_id_fk", + "tableFrom": "tag_subfields", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_tag_type_attribute": { + "name": "uniq_tag_type_attribute", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_code", + "attributes_id" + ] + }, + "uniq_attribute_id_project": { + "name": "uniq_attribute_id_project", + "nullsNotDistinct": false, + "columns": [ + "attributes_id", + "project_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_type_class_form_mappings": { + "name": "tag_type_class_form_mappings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_label": { + "name": "tag_type_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "class_label": { + "name": "class_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "ep": { + "name": "ep", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_mapping_in_project": { + "name": "uniq_mapping_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_label", + "class_label", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_types": { + "name": "tag_types", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_types_project_id_projects_id_fk": { + "name": "tag_types_project_id_projects_id_fk", + "tableFrom": "tag_types", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "tag_types_code_project_id_pk": { + "name": "tag_types_code_project_id_pk", + "columns": [ + "code", + "project_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tags": { + "name": "tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tags_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "tag_type": { + "name": "tag_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "class": { + "name": "class", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tags_contract_item_id_contract_items_id_fk": { + "name": "tags_contract_item_id_contract_items_id_fk", + "tableFrom": "tags", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_form_id_forms_id_fk": { + "name": "tags_form_id_forms_id_fk", + "tableFrom": "tags", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_item_tag_no_unique": { + "name": "contract_item_tag_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_item_id", + "tag_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_data_report_temps": { + "name": "vendor_data_report_temps", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_data_report_temps_contract_item_id_contract_items_id_fk": { + "name": "vendor_data_report_temps_contract_item_id_contract_items_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_data_report_temps_form_id_forms_id_fk": { + "name": "vendor_data_report_temps_form_id_forms_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.change_logs": { + "name": "change_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "changed_fields": { + "name": "changed_fields", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "old_values": { + "name": "old_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "new_values": { + "name": "new_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_name": { + "name": "user_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_synced": { + "name": "is_synced", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "sync_attempts": { + "name": "sync_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_sync_error": { + "name": "last_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "synced_at": { + "name": "synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "target_systems": { + "name": "target_systems", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + } + }, + "indexes": { + "idx_change_logs_contract_synced": { + "name": "idx_change_logs_contract_synced", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_synced", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_created_at": { + "name": "idx_change_logs_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_entity": { + "name": "idx_change_logs_entity", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_sync_attempts": { + "name": "idx_change_logs_sync_attempts", + "columns": [ + { + "expression": "sync_attempts", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.document_attachments": { + "name": "document_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "document_attachments_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "revision_id": { + "name": "revision_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "upload_id": { + "name": "upload_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "file_id": { + "name": "file_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "dolce_file_path": { + "name": "dolce_file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "document_attachments_revision_id_revisions_id_fk": { + "name": "document_attachments_revision_id_revisions_id_fk", + "tableFrom": "document_attachments", + "tableTo": "revisions", + "columnsFrom": [ + "revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.documents": { + "name": "documents", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "documents_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "drawing_move_gbn": { + "name": "drawing_move_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "discipline": { + "name": "discipline", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "external_document_id": { + "name": "external_document_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "external_system_type": { + "name": "external_system_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "external_synced_at": { + "name": "external_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "shi_drawing_no": { + "name": "shi_drawing_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager": { + "name": "manager", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_enm": { + "name": "manager_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_no": { + "name": "manager_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "register_group": { + "name": "register_group", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "register_group_id": { + "name": "register_group_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "create_user_no": { + "name": "create_user_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "create_user_id": { + "name": "create_user_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "create_user_enm": { + "name": "create_user_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_contract_doc_status": { + "name": "unique_contract_doc_status", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_contract_vendor_doc": { + "name": "unique_contract_vendor_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"vendor_doc_number\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_external_doc": { + "name": "unique_external_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_system_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"external_document_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "drawing_kind_idx": { + "name": "drawing_kind_idx", + "columns": [ + { + "expression": "drawing_kind", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "documents_contract_id_contracts_id_fk": { + "name": "documents_contract_id_contracts_id_fk", + "tableFrom": "documents", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.issue_stages": { + "name": "issue_stages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "issue_stages_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_name": { + "name": "stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "plan_date": { + "name": "plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "actual_date": { + "name": "actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "stage_status": { + "name": "stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "stage_order": { + "name": "stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "priority": { + "name": "priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'MEDIUM'" + }, + "assignee_id": { + "name": "assignee_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "assignee_name": { + "name": "assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "reminder_days": { + "name": "reminder_days", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_document_stage": { + "name": "unique_document_stage", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_stage_order": { + "name": "document_stage_order", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "issue_stages_document_id_documents_id_fk": { + "name": "issue_stages_document_id_documents_id_fk", + "tableFrom": "issue_stages", + "tableTo": "documents", + "columnsFrom": [ + "document_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.revisions": { + "name": "revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "revisions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "issue_stage_id": { + "name": "issue_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "revision": { + "name": "revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "uploader_type": { + "name": "uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'vendor'" + }, + "uploader_id": { + "name": "uploader_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploader_name": { + "name": "uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "usage": { + "name": "usage", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "revision_status": { + "name": "revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'SUBMITTED'" + }, + "submitted_date": { + "name": "submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "review_start_date": { + "name": "review_start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "approved_date": { + "name": "approved_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "rejected_date": { + "name": "rejected_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "reviewer_id": { + "name": "reviewer_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "review_comments": { + "name": "review_comments", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "external_upload_id": { + "name": "external_upload_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_stage_rev": { + "name": "unique_stage_rev", + "columns": [ + { + "expression": "issue_stage_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "revision", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_batches": { + "name": "sync_batches", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "batch_size": { + "name": "batch_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "retry_count": { + "name": "retry_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "change_log_ids": { + "name": "change_log_ids", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "success_count": { + "name": "success_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "failure_count": { + "name": "failure_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sync_metadata": { + "name": "sync_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_batches_contract_system": { + "name": "idx_sync_batches_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_status": { + "name": "idx_sync_batches_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_created_at": { + "name": "idx_sync_batches_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_configs": { + "name": "sync_configs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "sync_interval_minutes": { + "name": "sync_interval_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 30 + }, + "last_successful_sync": { + "name": "last_successful_sync", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_sync_attempt": { + "name": "last_sync_attempt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "endpoint_url": { + "name": "endpoint_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "auth_token": { + "name": "auth_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "api_version": { + "name": "api_version", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'v1'" + }, + "max_batch_size": { + "name": "max_batch_size", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 100 + }, + "retry_max_attempts": { + "name": "retry_max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_configs_contract_system": { + "name": "idx_sync_configs_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sync_configs_contract_id_contracts_id_fk": { + "name": "sync_configs_contract_id_contracts_id_fk", + "tableFrom": "sync_configs", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_attachments": { + "name": "vendor_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'GENERAL'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_attachments_vendor_id_vendors_id_fk": { + "name": "vendor_attachments_vendor_id_vendors_id_fk", + "tableFrom": "vendor_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidates": { + "name": "vendor_candidates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidates_vendor_id_vendors_id_fk": { + "name": "vendor_candidates_vendor_id_vendors_id_fk", + "tableFrom": "vendor_candidates", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_contacts": { + "name": "vendor_contacts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contact_name": { + "name": "contact_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_position": { + "name": "contact_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "is_primary": { + "name": "is_primary", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_contacts_vendor_id_vendors_id_fk": { + "name": "vendor_contacts_vendor_id_vendors_id_fk", + "tableFrom": "vendor_contacts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_items": { + "name": "vendor_possible_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_items_vendor_id_vendors_id_fk": { + "name": "vendor_possible_items_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_items_item_code_items_item_code_fk": { + "name": "vendor_possible_items_item_code_items_item_code_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_materials": { + "name": "vendor_possible_materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_materials_vendor_id_vendors_id_fk": { + "name": "vendor_possible_materials_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_materials_item_code_materials_item_code_fk": { + "name": "vendor_possible_materials_item_code_materials_item_code_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "materials", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_types": { + "name": "vendor_types", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_types_code_unique": { + "name": "vendor_types_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors": { + "name": "vendors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "vendor_type_id": { + "name": "vendor_type_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_vendor_type_id_vendor_types_id_fk": { + "name": "vendors_vendor_type_id_vendor_types_id_fk", + "tableFrom": "vendors", + "tableTo": "vendor_types", + "columnsFrom": [ + "vendor_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tasks": { + "name": "tasks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'todo'" + }, + "label": { + "name": "label", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'bug'" + }, + "priority": { + "name": "priority", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'low'" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "current_timestamp" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tasks_code_unique": { + "name": "tasks_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidate_logs": { + "name": "vendor_candidate_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_candidate_id": { + "name": "vendor_candidate_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk": { + "name": "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "vendor_candidates", + "columnsFrom": [ + "vendor_candidate_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_candidate_logs_user_id_users_id_fk": { + "name": "vendor_candidate_logs_user_id_users_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors_logs": { + "name": "vendors_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_logs_vendor_id_vendors_id_fk": { + "name": "vendors_logs_vendor_id_vendors_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendors_logs_user_id_users_id_fk": { + "name": "vendors_logs_user_id_users_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract": { + "name": "basic_contract", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_id": { + "name": "template_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requested_by": { + "name": "requested_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "basic_contract_template_id_basic_contract_templates_id_fk": { + "name": "basic_contract_template_id_basic_contract_templates_id_fk", + "tableFrom": "basic_contract", + "tableTo": "basic_contract_templates", + "columnsFrom": [ + "template_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_vendor_id_vendors_id_fk": { + "name": "basic_contract_vendor_id_vendors_id_fk", + "tableFrom": "basic_contract", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_requested_by_users_id_fk": { + "name": "basic_contract_requested_by_users_id_fk", + "tableFrom": "basic_contract", + "tableTo": "users", + "columnsFrom": [ + "requested_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract_templates": { + "name": "basic_contract_templates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_templates_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_name": { + "name": "template_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "validity_period": { + "name": "validity_period", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.incoterms": { + "name": "incoterms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(20)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "incoterms_created_by_users_id_fk": { + "name": "incoterms_created_by_users_id_fk", + "tableFrom": "incoterms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payment_terms": { + "name": "payment_terms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "payment_terms_created_by_users_id_fk": { + "name": "payment_terms_created_by_users_id_fk", + "tableFrom": "payment_terms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pr_items": { + "name": "pr_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "pr_items", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_attachments": { + "name": "procurement_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "procurement_rfq_details_id": { + "name": "procurement_rfq_details_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk": { + "name": "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfq_details", + "columnsFrom": [ + "procurement_rfq_details_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_created_by_users_id_fk": { + "name": "procurement_attachments_created_by_users_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "attachment_type_check": { + "name": "attachment_type_check", + "value": "\"procurement_attachments\".\"procurement_rfqs_id\" IS NOT NULL OR \"procurement_attachments\".\"procurement_rfq_details_id\" IS NOT NULL" + } + }, + "isRLSEnabled": false + }, + "public.procurement_quotation_items": { + "name": "procurement_quotation_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pr_item_id": { + "name": "pr_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "material_code": { + "name": "material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "uom": { + "name": "uom", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "unit_price": { + "name": "unit_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "vendor_material_code": { + "name": "vendor_material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_material_description": { + "name": "vendor_material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "lead_time_in_days": { + "name": "lead_time_in_days", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_rate": { + "name": "discount_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_amount": { + "name": "discount_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_alternative": { + "name": "is_alternative", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_recommended": { + "name": "is_recommended", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_quotation_items_pr_item_id_pr_items_id_fk": { + "name": "procurement_quotation_items_pr_item_id_pr_items_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "pr_items", + "columnsFrom": [ + "pr_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_attachments": { + "name": "procurement_rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_uploaded_by_users_id_fk": { + "name": "procurement_rfq_attachments_uploaded_by_users_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_comments": { + "name": "procurement_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_comments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_user_id_users_id_fk": { + "name": "procurement_rfq_comments_user_id_users_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_details": { + "name": "procurement_rfq_details", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendors_id": { + "name": "vendors_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'VV'" + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_vendors_id_vendors_id_fk": { + "name": "procurement_rfq_details_vendors_id_vendors_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "vendors", + "columnsFrom": [ + "vendors_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_rfq_details_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_incoterms_code_incoterms_code_fk": { + "name": "procurement_rfq_details_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_updated_by_users_id_fk": { + "name": "procurement_rfq_details_updated_by_users_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfqs": { + "name": "procurement_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "series": { + "name": "series", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "rfq_sealed_yn": { + "name": "rfq_sealed_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfqs_project_id_projects_id_fk": { + "name": "procurement_rfqs_project_id_projects_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_sent_by_users_id_fk": { + "name": "procurement_rfqs_sent_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_created_by_users_id_fk": { + "name": "procurement_rfqs_created_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_updated_by_users_id_fk": { + "name": "procurement_rfqs_updated_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "procurement_rfqs_rfq_code_unique": { + "name": "procurement_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_vendor_quotations": { + "name": "procurement_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_items_count": { + "name": "total_items_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sub_total": { + "name": "sub_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "tax_total": { + "name": "tax_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "discount_total": { + "name": "discount_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "estimated_delivery_date": { + "name": "estimated_delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "procurement_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_incoterms_code_incoterms_code_fk": { + "name": "procurement_vendor_quotations_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.preset_shares": { + "name": "preset_shares", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "preset_id": { + "name": "preset_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "shared_with_user_id": { + "name": "shared_with_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'read'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "preset_shares_preset_id_table_presets_id_fk": { + "name": "preset_shares_preset_id_table_presets_id_fk", + "tableFrom": "preset_shares", + "tableTo": "table_presets", + "columnsFrom": [ + "preset_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_presets": { + "name": "table_presets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_shared": { + "name": "is_shared", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_attachments": { + "name": "tech_sales_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "tech_sales_rfq_id": { + "name": "tech_sales_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "tech_sales_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_attachments_created_by_users_id_fk": { + "name": "tech_sales_attachments_created_by_users_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comment_attachments": { + "name": "tech_sales_rfq_comment_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk": { + "name": "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk": { + "name": "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comments": { + "name": "tech_sales_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_user_id_users_id_fk": { + "name": "tech_sales_rfq_comments_user_id_users_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfqs": { + "name": "tech_sales_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_shipbuilding_id": { + "name": "item_shipbuilding_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "bidding_project_id": { + "name": "bidding_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_snapshot": { + "name": "project_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "series_snapshot": { + "name": "series_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk": { + "name": "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "item_shipbuilding", + "columnsFrom": [ + "item_shipbuilding_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk": { + "name": "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bidding_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_sent_by_users_id_fk": { + "name": "tech_sales_rfqs_sent_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_created_by_users_id_fk": { + "name": "tech_sales_rfqs_created_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_updated_by_users_id_fk": { + "name": "tech_sales_rfqs_updated_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tech_sales_rfqs_rfq_code_unique": { + "name": "tech_sales_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_vendor_quotations": { + "name": "tech_sales_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "tech_sales_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rotation_attempts": { + "name": "ocr_rotation_attempts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "rotation": { + "name": "rotation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "tables_found": { + "name": "tables_found", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "text_quality": { + "name": "text_quality", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "keyword_count": { + "name": "keyword_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "score": { + "name": "score", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "extracted_rows_count": { + "name": "extracted_rows_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_rotation_attempts_session_id_ocr_sessions_id_fk": { + "name": "ocr_rotation_attempts_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rotation_attempts", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rows": { + "name": "ocr_rows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "table_id": { + "name": "table_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "row_index": { + "name": "row_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "report_no": { + "name": "report_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "no": { + "name": "no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "identification_no": { + "name": "identification_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_no": { + "name": "joint_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_type": { + "name": "joint_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "welding_date": { + "name": "welding_date", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "source_table": { + "name": "source_table", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "source_row": { + "name": "source_row", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_ocr_report_no_unique": { + "name": "idx_ocr_report_no_unique", + "columns": [ + { + "expression": "report_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "tag_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "joint_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "joint_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "ocr_rows_table_id_ocr_tables_id_fk": { + "name": "ocr_rows_table_id_ocr_tables_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_tables", + "columnsFrom": [ + "table_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_session_id_ocr_sessions_id_fk": { + "name": "ocr_rows_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_user_id_users_id_fk": { + "name": "ocr_rows_user_id_users_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_sessions": { + "name": "ocr_sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "processing_time": { + "name": "processing_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "best_rotation": { + "name": "best_rotation", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_tables": { + "name": "total_tables", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_rows": { + "name": "total_rows", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "image_enhanced": { + "name": "image_enhanced", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pdf_converted": { + "name": "pdf_converted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "success": { + "name": "success", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "warnings": { + "name": "warnings", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_tables": { + "name": "ocr_tables", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "table_index": { + "name": "table_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "row_count": { + "name": "row_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_tables_session_id_ocr_sessions_id_fk": { + "name": "ocr_tables_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_tables", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.offshore_hull_work_type": { + "name": "offshore_hull_work_type", + "schema": "public", + "values": [ + "HA", + "HE", + "HH", + "HM", + "NC" + ] + }, + "public.offshore_top_work_type": { + "name": "offshore_top_work_type", + "schema": "public", + "values": [ + "TM", + "TS", + "TE", + "TP" + ] + }, + "public.work_type": { + "name": "work_type", + "schema": "public", + "values": [ + "기장", + "전장", + "선실", + "배관", + "철의" + ] + }, + "public.user_domain": { + "name": "user_domain", + "schema": "public", + "values": [ + "evcp", + "partners" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": { + "public.contracts_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"contracts\".\"id\", \"contracts\".\"contract_no\", \"contracts\".\"contract_name\", \"contracts\".\"status\", \"contracts\".\"start_date\", \"contracts\".\"end_date\", \"contracts\".\"project_id\", \"projects\".\"code\", \"projects\".\"name\", \"contracts\".\"vendor_id\", \"vendors\".\"vendor_name\", \"contracts\".\"payment_terms\", \"contracts\".\"delivery_terms\", \"contracts\".\"delivery_date\", \"contracts\".\"delivery_location\", \"contracts\".\"currency\", \"contracts\".\"total_amount\", \"contracts\".\"discount\", \"contracts\".\"tax\", \"contracts\".\"shipping_fee\", \"contracts\".\"net_total\", \"contracts\".\"partial_shipping_allowed\", \"contracts\".\"partial_payment_allowed\", \"contracts\".\"remarks\", \"contracts\".\"version\", \"contracts\".\"created_at\", \"contracts\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"contracts\".\"id\"\n ) as \"has_signature\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "contracts_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.poa_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", + "name": "poa_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.project_approved_vendors": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"status\", \"vendor_types\".\"name_ko\", \"vendor_types\".\"name_en\", \"projects\".\"code\", \"projects\".\"name\", \"projects\".\"type\", \"vendor_pq_submissions\".\"submitted_at\", \"vendor_pq_submissions\".\"approved_at\" from \"vendors\" inner join \"vendor_pq_submissions\" on \"vendor_pq_submissions\".\"vendor_id\" = \"vendors\".\"id\" inner join \"projects\" on \"vendor_pq_submissions\".\"project_id\" = \"projects\".\"id\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\" where \"vendor_pq_submissions\".\"status\" = 'APPROVED'", + "name": "project_approved_vendors", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_investigations_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"vendor_id\", \"vendor_investigations\".\"pq_submission_id\", \"vendor_investigations\".\"requester_id\", \"vendor_investigations\".\"qm_manager_id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"evaluation_type\", \"vendor_investigations\".\"investigation_address\", \"vendor_investigations\".\"investigation_method\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"forecasted_at\", \"vendor_investigations\".\"requested_at\", \"vendor_investigations\".\"confirmed_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"evaluation_score\", \"vendor_investigations\".\"evaluation_result\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", requester.name as \"requesterName\", requester.email as \"requesterEmail\", qm_manager.name as \"qmManagerName\", qm_manager.email as \"qmManagerEmail\", (\n CASE \n WHEN EXISTS (\n SELECT 1 FROM vendor_investigation_attachments via \n WHERE via.investigation_id = \"vendor_investigations\".\"id\"\n ) \n THEN true \n ELSE false \n END\n ) as \"hasAttachments\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\" left join users AS requester on \"vendor_investigations\".\"requester_id\" = requester.id left join users AS qm_manager on \"vendor_investigations\".\"qm_manager_id\" = qm_manager.id", + "name": "vendor_investigations_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.cbe_view": { + "columns": {}, + "definition": "select \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"rfq_id\" as \"rfq_id\", \"cbe_evaluations\".\"vendor_id\" as \"vendor_id\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"result\" as \"result\", \"cbe_evaluations\".\"notes\" as \"notes\", \"cbe_evaluations\".\"evaluated_by\" as \"evaluated_by\", \"cbe_evaluations\".\"evaluated_at\" as \"evaluated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"name\" as \"evaluator_name\", \"users\".\"email\" as \"evaluator_email\" from \"cbe_evaluations\" inner join \"rfqs\" on \"cbe_evaluations\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"cbe_evaluations\".\"evaluated_by\" = \"users\".\"id\"", + "name": "cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.rfqs_view": { + "columns": {}, + "definition": "select \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"rfqs\".\"parent_rfq_id\" as \"parent_rfq_id\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"email\" as \"user_email\", \"users\".\"name\" as \"user_name\", (\n SELECT COUNT(*) \n FROM \"rfq_items\" \n WHERE \"rfq_items\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"item_count\", (\n SELECT COUNT(*) \n FROM \"rfq_attachments\" \n WHERE \"rfq_attachments\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"attachment_count\" from \"rfqs\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"rfqs\".\"created_by\" = \"users\".\"id\"", + "name": "rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_cbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", \"cbe_evaluations\".\"notes\" as \"cbe_note\", \"cbe_evaluations\".\"updated_at\" as \"cbe_updated\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"delivery_schedule\" as \"delivery_schedule\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_response_cbe_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"notes\" as \"response_notes\", \"vendor_responses\".\"responded_by\" as \"responded_by\", \"vendor_responses\".\"responded_at\" as \"responded_at\", \"vendor_responses\".\"updated_at\" as \"response_updated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"status\" as \"vendor_status\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"response_status\" as \"commercial_response_status\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"vendor_commercial_responses\".\"payment_terms\" as \"payment_terms\", \"vendor_commercial_responses\".\"incoterms\" as \"incoterms\", \"vendor_commercial_responses\".\"delivery_period\" as \"delivery_period\", \"vendor_commercial_responses\".\"warranty_period\" as \"warranty_period\", \"vendor_commercial_responses\".\"validity_period\" as \"validity_period\", \"vendor_commercial_responses\".\"price_breakdown\" as \"price_breakdown\", \"vendor_commercial_responses\".\"commercial_notes\" as \"commercial_notes\", \"vendor_commercial_responses\".\"created_at\" as \"commercial_created_at\", \"vendor_commercial_responses\".\"updated_at\" as \"commercial_updated_at\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"commercial_response_id\" = \"vendor_commercial_responses\".\"id\"\n ) as \"commercial_attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n AND \"vendor_response_attachments\".\"attachment_type\" = 'TECHNICAL_SPEC'\n ) as \"technical_attachment_count\", (\n SELECT MAX(\"uploaded_at\") \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"latest_attachment_date\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\"", + "name": "vendor_response_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_responses_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"created_at\" as \"rfq_created_at\", \"rfqs\".\"updated_at\" as \"rfq_updated_at\", \"rfqs\".\"created_by\" as \"rfq_created_by\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"responded_at\" as \"responded_at\", CASE WHEN \"vendor_technical_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_technical_response\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", CASE WHEN \"vendor_commercial_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_commercial_response\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"rfq_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE') left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"cbe_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\")", + "name": "vendor_responses_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_rfq_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", + "name": "vendor_rfq_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_tbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", \"vendor_technical_responses\".\"response_status\" as \"technical_response_status\", \"vendor_technical_responses\".\"summary\" as \"technical_summary\", \"vendor_technical_responses\".\"notes\" as \"technical_notes\", \"vendor_technical_responses\".\"updated_at\" as \"technical_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"rfq_evaluations\".\"notes\" as \"tbe_note\", \"rfq_evaluations\".\"updated_at\" as \"tbe_updated\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_tbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.role_view": { + "columns": {}, + "definition": "select \"roles\".\"id\" as \"id\", \"roles\".\"name\" as \"name\", \"roles\".\"description\" as \"description\", \"roles\".\"domain\" as \"domain\", \"roles\".\"created_at\" as \"created_at\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", COUNT(\"users\".\"id\") as \"user_count\" from \"roles\" left join \"user_roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" left join \"users\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"vendors\" on \"roles\".\"company_id\" = \"vendors\".\"id\" group by \"roles\".\"id\", \"vendors\".\"id\"", + "name": "role_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.user_view": { + "columns": {}, + "definition": "select \"users\".\"id\" as \"user_id\", \"users\".\"name\" as \"user_name\", \"users\".\"email\" as \"user_email\", \"users\".\"domain\" as \"user_domain\", \"users\".\"image_url\" as \"user_image\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"vendors\" on \"users\".\"company_id\" = \"vendors\".\"id\" left join \"user_roles\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" group by \"users\".\"id\", \"vendors\".\"id\"", + "name": "user_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.form_lists_view": { + "columns": {}, + "definition": "select \"tag_type_class_form_mappings\".\"id\" as \"id\", \"tag_type_class_form_mappings\".\"project_id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"tag_type_class_form_mappings\".\"tag_type_label\" as \"tag_type_label\", \"tag_type_class_form_mappings\".\"class_label\" as \"class_label\", \"tag_type_class_form_mappings\".\"form_code\" as \"form_code\", \"tag_type_class_form_mappings\".\"form_name\" as \"form_name\", \"tag_type_class_form_mappings\".\"ep\" as \"ep\", \"tag_type_class_form_mappings\".\"remark\" as \"remark\", \"tag_type_class_form_mappings\".\"created_at\" as \"created_at\", \"tag_type_class_form_mappings\".\"updated_at\" as \"updated_at\" from \"tag_type_class_form_mappings\" inner join \"projects\" on \"tag_type_class_form_mappings\".\"project_id\" = \"projects\".\"id\"", + "name": "form_lists_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.view_tag_subfields": { + "columns": { + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "definition": "select \"tag_subfields\".\"id\" as \"id\", \"tag_subfields\".\"tag_type_code\", \"tag_types\".\"description\", \"tag_subfields\".\"attributes_id\", \"tag_subfields\".\"attributes_description\", \"tag_subfields\".\"expression\", \"tag_subfields\".\"delimiter\", \"tag_subfields\".\"sort_order\", \"tag_subfields\".\"created_at\", \"tag_subfields\".\"updated_at\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\", \"projects\".\"name\" from \"tag_subfields\" inner join \"tag_types\" on (\"tag_subfields\".\"tag_type_code\" = \"tag_types\".\"code\" and \"tag_subfields\".\"project_id\" = \"tag_types\".\"project_id\") inner join \"projects\" on \"tag_subfields\".\"project_id\" = \"projects\".\"id\"", + "name": "view_tag_subfields", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.document_stages_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_count": { + "name": "stage_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_list": { + "name": "stage_list", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT\n d.id AS document_id,\n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n d.contract_id,\n (SELECT COUNT(*) FROM issue_stages WHERE document_id = d.id) AS stage_count,\n COALESCE( \n (SELECT json_agg(i.stage_name) FROM issue_stages i WHERE i.document_id = d.id), \n '[]'\n ) AS stage_list,\n d.created_at,\n d.updated_at\n FROM documents d\n", + "name": "document_stages_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.enhanced_documents_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_id": { + "name": "current_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_name": { + "name": "current_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_status": { + "name": "current_stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_order": { + "name": "current_stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_plan_date": { + "name": "current_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_actual_date": { + "name": "current_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_assignee_name": { + "name": "current_stage_assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_priority": { + "name": "current_stage_priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "days_until_due": { + "name": "days_until_due", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_overdue": { + "name": "is_overdue", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "days_difference": { + "name": "days_difference", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "total_stages": { + "name": "total_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "completed_stages": { + "name": "completed_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "progress_percentage": { + "name": "progress_percentage", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_status": { + "name": "latest_revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_submitted_date": { + "name": "latest_submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "all_stages": { + "name": "all_stages", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n WITH document_stats AS (\n SELECT \n d.id as document_id,\n COUNT(ist.id) as total_stages,\n COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) as completed_stages,\n CASE \n WHEN COUNT(ist.id) > 0 \n THEN ROUND((COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) * 100.0) / COUNT(ist.id))\n ELSE 0 \n END as progress_percentage\n FROM documents d\n LEFT JOIN issue_stages ist ON d.id = ist.document_id\n GROUP BY d.id\n ),\n current_stage_info AS (\n SELECT DISTINCT ON (document_id)\n document_id,\n id as current_stage_id,\n stage_name as current_stage_name,\n stage_status as current_stage_status,\n stage_order as current_stage_order,\n plan_date as current_stage_plan_date,\n actual_date as current_stage_actual_date,\n assignee_name as current_stage_assignee_name,\n priority as current_stage_priority,\n CASE \n WHEN actual_date IS NULL AND plan_date IS NOT NULL \n THEN plan_date - CURRENT_DATE\n ELSE NULL \n END as days_until_due,\n CASE \n WHEN actual_date IS NULL AND plan_date < CURRENT_DATE \n THEN true\n WHEN actual_date IS NOT NULL AND actual_date > plan_date \n THEN true\n ELSE false \n END as is_overdue,\n CASE \n WHEN actual_date IS NOT NULL AND plan_date IS NOT NULL \n THEN actual_date - plan_date\n ELSE NULL \n END as days_difference\n FROM issue_stages\n WHERE stage_status NOT IN ('COMPLETED', 'APPROVED')\n ORDER BY document_id, stage_order ASC, priority DESC\n ),\n latest_revision_info AS (\n SELECT DISTINCT ON (ist.document_id)\n ist.document_id,\n r.id as latest_revision_id,\n r.revision as latest_revision,\n r.revision_status as latest_revision_status,\n r.uploader_name as latest_revision_uploader_name,\n r.submitted_date as latest_submitted_date\n FROM revisions r\n JOIN issue_stages ist ON r.issue_stage_id = ist.id\n ORDER BY ist.document_id, r.created_at DESC\n ),\n -- 리비전별 첨부파일 집계\n revision_attachments AS (\n SELECT \n r.id as revision_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', da.id,\n 'revisionId', da.revision_id,\n 'fileName', da.file_name,\n 'filePath', da.file_path,\n 'fileSize', da.file_size,\n 'fileType', da.file_type,\n 'createdAt', da.created_at,\n 'updatedAt', da.updated_at\n ) ORDER BY da.created_at\n ) FILTER (WHERE da.id IS NOT NULL),\n '[]'::json\n ) as attachments\n FROM revisions r\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY r.id\n ),\n -- 스테이지별 리비전 집계 (첨부파일 포함)\n stage_revisions AS (\n SELECT \n ist.id as stage_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', r.id,\n 'issueStageId', r.issue_stage_id,\n 'revision', r.revision,\n 'uploaderType', r.uploader_type,\n 'uploaderId', r.uploader_id,\n 'uploaderName', r.uploader_name,\n 'comment', r.comment,\n 'usage', r.usage,\n 'revisionStatus', r.revision_status,\n 'submittedDate', r.submitted_date,\n 'uploadedAt', r.uploaded_at,\n 'approvedDate', r.approved_date,\n 'reviewStartDate', r.review_start_date,\n 'rejectedDate', r.rejected_date,\n 'reviewerId', r.reviewer_id,\n 'reviewerName', r.reviewer_name,\n 'reviewComments', r.review_comments,\n 'createdAt', r.created_at,\n 'updatedAt', r.updated_at,\n 'attachments', ra.attachments\n ) ORDER BY r.created_at\n ) FILTER (WHERE r.id IS NOT NULL),\n '[]'::json\n ) as revisions\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN revision_attachments ra ON r.id = ra.revision_id\n GROUP BY ist.id\n ),\n -- 문서별 스테이지 집계 (리비전 포함)\n stage_aggregation AS (\n SELECT \n ist.document_id,\n json_agg(\n json_build_object(\n 'id', ist.id,\n 'stageName', ist.stage_name,\n 'stageStatus', ist.stage_status,\n 'stageOrder', ist.stage_order,\n 'planDate', ist.plan_date,\n 'actualDate', ist.actual_date,\n 'assigneeName', ist.assignee_name,\n 'priority', ist.priority,\n 'revisions', sr.revisions\n ) ORDER BY ist.stage_order\n ) as all_stages\n FROM issue_stages ist\n LEFT JOIN stage_revisions sr ON ist.id = sr.stage_id\n GROUP BY ist.document_id\n ),\n attachment_counts AS (\n SELECT \n ist.document_id,\n COUNT(da.id) as attachment_count\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY ist.document_id\n )\n \n SELECT \n d.id as document_id,\n d.doc_number,\n d.drawing_kind,\n d.vendor_doc_number, -- ✅ 벤더 문서 번호 추가\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n\n d.cGbn,\n d.dGbn,\n d.degreeGbn,\n d.deptGbn,\n d.sGbn,\n\n\n \n -- ✅ 프로젝트 및 벤더 정보 추가\n p.code as project_code,\n v.vendor_name as vendor_name,\n v.vendor_code as vendor_code,\n \n -- 현재 스테이지 정보\n csi.current_stage_id,\n csi.current_stage_name,\n csi.current_stage_status,\n csi.current_stage_order,\n csi.current_stage_plan_date,\n csi.current_stage_actual_date,\n csi.current_stage_assignee_name,\n csi.current_stage_priority,\n \n -- 계산 필드\n csi.days_until_due,\n csi.is_overdue,\n csi.days_difference,\n \n -- 진행률 정보\n ds.total_stages,\n ds.completed_stages,\n ds.progress_percentage,\n \n -- 최신 리비전 정보\n lri.latest_revision_id,\n lri.latest_revision,\n lri.latest_revision_status,\n lri.latest_revision_uploader_name,\n lri.latest_submitted_date,\n \n -- 전체 스테이지 (리비전 및 첨부파일 포함)\n COALESCE(sa.all_stages, '[]'::json) as all_stages,\n \n -- 기타\n COALESCE(ac.attachment_count, 0) as attachment_count,\n d.created_at,\n d.updated_at\n \n FROM documents d\n -- ✅ contracts, projects, vendors 테이블 JOIN 추가\n LEFT JOIN contracts c ON d.contract_id = c.id\n LEFT JOIN projects p ON c.project_id = p.id\n LEFT JOIN vendors v ON c.vendor_id = v.id\n \n LEFT JOIN document_stats ds ON d.id = ds.document_id\n LEFT JOIN current_stage_info csi ON d.id = csi.document_id\n LEFT JOIN latest_revision_info lri ON d.id = lri.document_id\n LEFT JOIN stage_aggregation sa ON d.id = sa.document_id\n LEFT JOIN attachment_counts ac ON d.id = ac.document_id\n \n ORDER BY d.created_at DESC\n", + "name": "enhanced_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.sync_status_view": { + "columns": { + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "total_changes": { + "name": "total_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pending_changes": { + "name": "pending_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "synced_changes": { + "name": "synced_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "failed_changes": { + "name": "failed_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "last_sync_at": { + "name": "last_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_sync_at": { + "name": "next_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n WITH change_stats AS (\n SELECT \n cl.contract_id,\n sc.target_system,\n COUNT(*) as total_changes,\n COUNT(CASE WHEN cl.is_synced = false AND cl.sync_attempts < sc.retry_max_attempts THEN 1 END) as pending_changes,\n COUNT(CASE WHEN cl.is_synced = true THEN 1 END) as synced_changes,\n COUNT(CASE WHEN cl.sync_attempts >= sc.retry_max_attempts AND cl.is_synced = false THEN 1 END) as failed_changes,\n MAX(cl.synced_at) as last_sync_at\n FROM change_logs cl\n CROSS JOIN sync_configs sc \n WHERE cl.contract_id = sc.contract_id\n AND (cl.target_systems IS NULL OR cl.target_systems @> to_jsonb(sc.target_system))\n GROUP BY cl.contract_id, sc.target_system\n )\n SELECT \n cs.contract_id,\n cs.target_system,\n COALESCE(cs.total_changes, 0) as total_changes,\n COALESCE(cs.pending_changes, 0) as pending_changes,\n COALESCE(cs.synced_changes, 0) as synced_changes,\n COALESCE(cs.failed_changes, 0) as failed_changes,\n cs.last_sync_at,\n CASE \n WHEN sc.sync_enabled = true AND sc.last_successful_sync IS NOT NULL \n THEN sc.last_successful_sync + (sc.sync_interval_minutes || ' minutes')::interval\n ELSE NULL\n END as next_sync_at,\n sc.sync_enabled\n FROM sync_configs sc\n LEFT JOIN change_stats cs ON sc.contract_id = cs.contract_id AND sc.target_system = cs.target_system\n", + "name": "sync_status_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_documents_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "latest_stage_id": { + "name": "latest_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_stage_name": { + "name": "latest_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_stage_plan_date": { + "name": "latest_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_stage_actual_date": { + "name": "latest_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_type": { + "name": "latest_revision_uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT \n d.id, \n d.doc_number,\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n (SELECT id FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_id,\n (SELECT stage_name FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_name,\n (SELECT plan_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_plan_date,\n (SELECT actual_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_actual_date,\n \n (SELECT r.id FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_id,\n (SELECT r.revision FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision,\n (SELECT r.uploader_type FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_type,\n (SELECT r.uploader_name FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_name,\n \n (SELECT COUNT(*) FROM document_attachments a JOIN revisions r ON a.revision_id = r.id JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id) AS attachment_count,\n \n d.created_at,\n d.updated_at\n FROM documents d\n JOIN contracts c ON d.contract_id = c.id\n ", + "name": "vendor_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_candidates_with_vendor_info": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_candidates\".\"id\", \"vendor_candidates\".\"company_name\", \"vendor_candidates\".\"contact_email\", \"vendor_candidates\".\"contact_phone\", \"vendor_candidates\".\"tax_id\", \"vendor_candidates\".\"address\", \"vendor_candidates\".\"country\", \"vendor_candidates\".\"source\", \"vendor_candidates\".\"status\", \"vendor_candidates\".\"items\", \"vendor_candidates\".\"remark\", \"vendor_candidates\".\"created_at\", \"vendor_candidates\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"created_at\" as \"vendor_created_at\", (\n SELECT l2.\"created_at\"\n FROM \"vendor_candidate_logs\" l2\n WHERE l2.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l2.\"action\" = 'status_change'\n ORDER BY l2.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_at\", (\n SELECT u.\"name\"\n FROM \"users\" u\n JOIN \"vendor_candidate_logs\" l3\n ON l3.\"user_id\" = u.\"id\"\n WHERE l3.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l3.\"action\" = 'status_change'\n ORDER BY l3.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_by\", (\n SELECT l4.\"created_at\"\n FROM \"vendor_candidate_logs\" l4\n WHERE l4.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l4.\"action\" = 'invite_sent'\n ORDER BY l4.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_at\", (\n SELECT u2.\"name\"\n FROM \"users\" u2\n JOIN \"vendor_candidate_logs\" l5\n ON l5.\"user_id\" = u2.\"id\"\n WHERE l5.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l5.\"action\" = 'invite_sent'\n ORDER BY l5.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_by\" from \"vendor_candidates\" left join \"vendors\" on \"vendor_candidates\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "vendor_candidates_with_vendor_info", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"business_size\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"", + "name": "vendor_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", + "name": "vendor_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_materials_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_materials\".\"id\", \"vendor_possible_materials\".\"vendor_id\", \"materials\".\"item_name\", \"materials\".\"item_code\", \"materials\".\"description\", \"materials\".\"unit_of_measure\", \"materials\".\"steel_type\", \"materials\".\"grade_material\", \"vendor_possible_materials\".\"created_at\", \"vendor_possible_materials\".\"updated_at\" from \"vendor_possible_materials\" left join \"materials\" on \"vendor_possible_materials\".\"item_code\" = \"materials\".\"item_code\"", + "name": "vendor_materials_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendors_with_types": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"tax_id\" as \"tax_id\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"phone\" as \"phone\", \"vendors\".\"email\" as \"email\", \"vendors\".\"business_size\" as \"business_size\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"status\", \"vendors\".\"vendor_type_id\" as \"vendor_type_id\", \"vendors\".\"representative_name\" as \"representative_name\", \"vendors\".\"representative_birth\" as \"representative_birth\", \"vendors\".\"representative_email\" as \"representative_email\", \"vendors\".\"representative_phone\" as \"representative_phone\", \"vendors\".\"corporate_registration_number\" as \"corporate_registration_number\", \"vendors\".\"items\" as \"items\", \"vendors\".\"credit_agency\" as \"credit_agency\", \"vendors\".\"credit_rating\" as \"credit_rating\", \"vendors\".\"cash_flow_rating\" as \"cash_flow_rating\", \"vendors\".\"created_at\" as \"created_at\", \"vendors\".\"updated_at\" as \"updated_at\", \"vendor_types\".\"name_ko\" as \"vendor_type_name\", \"vendor_types\".\"name_en\" as \"vendor_type_name_en\", \"vendor_types\".\"code\" as \"vendor_type_code\", \n CASE\n WHEN \"vendors\".\"status\" = 'ACTIVE' THEN '정규업체'\n WHEN \"vendors\".\"status\" IN ('INACTIVE', 'BLACKLISTED', 'REJECTED') THEN ''\n ELSE '잠재업체'\n END\n as \"vendor_category\" from \"vendors\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\"", + "name": "vendors_with_types", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.basic_contract_view": { + "columns": {}, + "definition": "select \"basic_contract\".\"id\" as \"id\", \"basic_contract\".\"template_id\" as \"template_id\", \"basic_contract\".\"vendor_id\" as \"vendor_id\", \"basic_contract\".\"requested_by\" as \"requested_by\", \"basic_contract\".\"status\" as \"basic_contract_status\", \"basic_contract\".\"created_at\" as \"created_at\", \"basic_contract\".\"updated_at\" as \"updated_at\", \"basic_contract\".\"updated_at\" as \"completed_at\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"email\" as \"vendor_email\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"users\".\"name\" as \"user_name\", \"basic_contract_templates\".\"template_name\" as \"template_name\", \"basic_contract_templates\".\"validity_period\" as \"validityPeriod\", \"basic_contract_templates\".\"file_path\" as \"file_path\", \"basic_contract_templates\".\"file_name\" as \"file_name\", \"basic_contract\".\"file_path\" as \"signed_file_path\" from \"basic_contract\" left join \"vendors\" on \"basic_contract\".\"vendor_id\" = \"vendors\".\"id\" left join \"users\" on \"basic_contract\".\"requested_by\" = \"users\".\"id\" left join \"basic_contract_templates\" on \"basic_contract\".\"template_id\" = \"basic_contract_templates\".\"id\"", + "name": "basic_contract_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.pr_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"pr_items\".\"id\", \"pr_items\".\"procurement_rfqs_id\", \"pr_items\".\"rfq_item\", \"pr_items\".\"pr_item\", \"pr_items\".\"pr_no\", \"pr_items\".\"material_code\", \"pr_items\".\"material_category\", \"pr_items\".\"acc\", \"pr_items\".\"material_description\", \"pr_items\".\"size\", \"pr_items\".\"delivery_date\", \"pr_items\".\"quantity\", \"pr_items\".\"uom\", \"pr_items\".\"gross_weight\", \"pr_items\".\"gw_uom\", \"pr_items\".\"spec_no\", \"pr_items\".\"spec_url\", \"pr_items\".\"tracking_no\", \"pr_items\".\"major_yn\", \"pr_items\".\"project_def\", \"pr_items\".\"project_sc\", \"pr_items\".\"project_kl\", \"pr_items\".\"project_lc\", \"pr_items\".\"project_dl\", \"pr_items\".\"remark\", \"procurement_rfqs\".\"rfq_code\", \"procurement_rfqs\".\"item_code\", \"procurement_rfqs\".\"item_name\" from \"pr_items\" left join \"procurement_rfqs\" on \"pr_items\".\"procurement_rfqs_id\" = \"procurement_rfqs\".\"id\"", + "name": "pr_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfq_details_view": { + "columns": {}, + "definition": "select \"rfq_details\".\"id\" as \"detail_id\", \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfqs\".\"item_code\" as \"item_code\", \"rfqs\".\"item_name\" as \"item_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"country\" as \"vendor_country\", \"rfq_details\".\"currency\" as \"currency\", \"payment_terms\".\"code\" as \"payment_terms_code\", \"payment_terms\".\"description\" as \"payment_terms_description\", \"incoterms\".\"code\" as \"incoterms_code\", \"incoterms\".\"description\" as \"incoterms_description\", \"rfq_details\".\"incoterms_detail\" as \"incoterms_detail\", \"rfq_details\".\"delivery_date\" as \"delivery_date\", \"rfq_details\".\"tax_code\" as \"tax_code\", \"rfq_details\".\"place_of_shipping\" as \"place_of_shipping\", \"rfq_details\".\"place_of_destination\" as \"place_of_destination\", \"rfq_details\".\"material_price_related_yn\" as \"material_price_related_yn\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"rfq_details\".\"updated_at\" as \"updated_at\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\"\n ) as \"pr_items_count\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\" \n AND major_yn = true\n ) as \"major_items_count\", (\n SELECT COUNT(*) \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"comment_count\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_comment_date\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\" AND is_vendor_comment = true\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_vendor_comment_date\", (\n SELECT COUNT(*) \n FROM procurement_rfq_attachments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) > 0\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"has_quotation\", (\n SELECT status\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_status\", (\n SELECT total_price\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_total_price\", (\n SELECT quotation_version\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"quotation_version\", (\n SELECT COUNT(DISTINCT quotation_version)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"quotation_version_count\", (\n SELECT created_at\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"last_quotation_date\" from \"procurement_rfq_details\" \"rfq_details\" left join \"procurement_rfqs\" \"rfqs\" on \"rfq_details\".\"procurement_rfqs_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"rfq_details\".\"vendors_id\" = \"vendors\".\"id\" left join \"payment_terms\" on \"rfq_details\".\"payment_terms_code\" = \"payment_terms\".\"code\" left join \"incoterms\" on \"rfq_details\".\"incoterms_code\" = \"incoterms\".\"code\" left join \"users\" \"updated_by_user\" on \"rfq_details\".\"updated_by\" = \"updated_by_user\".\"id\"", + "name": "procurement_rfq_details_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfqs_view": { + "columns": {}, + "definition": "select \"procurement_rfqs\".\"id\" as \"id\", \"procurement_rfqs\".\"rfq_code\" as \"rfq_code\", \"procurement_rfqs\".\"series\" as \"series\", \"procurement_rfqs\".\"rfq_sealed_yn\" as \"rfq_sealed_yn\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"procurement_rfqs\".\"item_code\" as \"item_code\", \"procurement_rfqs\".\"item_name\" as \"item_name\", \"procurement_rfqs\".\"status\" as \"status\", \"procurement_rfqs\".\"pic_code\" as \"pic_code\", \"procurement_rfqs\".\"rfq_send_date\" as \"rfq_send_date\", \"procurement_rfqs\".\"due_date\" as \"due_date\", (\n SELECT MIN(submitted_at)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"procurement_rfqs\".\"id\"\n AND submitted_at IS NOT NULL\n ) as \"earliest_quotation_submitted_at\", \"created_by_user\".\"name\" as \"created_by_user_name\", \"sent_by_user\".\"name\" as \"sent_by_user_name\", \"procurement_rfqs\".\"updated_at\" as \"updated_at\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"procurement_rfqs\".\"remark\" as \"remark\", (\n SELECT material_code \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"major_item_material_code\", (\n SELECT pr_no \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"po_no\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n ) as \"pr_items_count\" from \"procurement_rfqs\" left join \"projects\" on \"procurement_rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" \"created_by_user\" on \"procurement_rfqs\".\"created_by\" = \"created_by_user\".\"id\" left join \"users\" \"updated_by_user\" on \"procurement_rfqs\".\"updated_by\" = \"updated_by_user\".\"id\" left join \"users\" \"sent_by_user\" on \"procurement_rfqs\".\"sent_by\" = \"sent_by_user\".\"id\"", + "name": "procurement_rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + } + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db/migrations/meta/0122_snapshot.json b/db/migrations/meta/0122_snapshot.json new file mode 100644 index 00000000..2d672837 --- /dev/null +++ b/db/migrations/meta/0122_snapshot.json @@ -0,0 +1,12088 @@ +{ + "id": "a7e35d21-e0a2-49df-bca5-cf0e60388c45", + "prevId": "76434f4f-b888-43e8-873c-4e3ce525af9a", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.companies": { + "name": "companies", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "companies_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "taxID": { + "name": "taxID", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_envelopes": { + "name": "contract_envelopes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_envelopes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "envelope_id": { + "name": "envelope_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": true + }, + "document_id": { + "name": "document_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": false + }, + "envelope_status": { + "name": "envelope_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_envelopes_contract_id_contracts_id_fk": { + "name": "contract_envelopes_contract_id_contracts_id_fk", + "tableFrom": "contract_envelopes", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_items": { + "name": "contract_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_items_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_id": { + "name": "item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "unit_price": { + "name": "unit_price", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "total_line_amount": { + "name": "total_line_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_items_contract_item_idx": { + "name": "contract_items_contract_item_idx", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "contract_items_contract_id_contracts_id_fk": { + "name": "contract_items_contract_id_contracts_id_fk", + "tableFrom": "contract_items", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_items_item_id_items_id_fk": { + "name": "contract_items_item_id_items_id_fk", + "tableFrom": "contract_items", + "tableTo": "items", + "columnsFrom": [ + "item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_items_contract_id_item_id_unique": { + "name": "contract_items_contract_id_item_id_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_id", + "item_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_signers": { + "name": "contract_signers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_signers_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "envelope_id": { + "name": "envelope_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_contact_id": { + "name": "vendor_contact_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "signer_type": { + "name": "signer_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'VENDOR'" + }, + "signer_email": { + "name": "signer_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "signer_name": { + "name": "signer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "signer_position": { + "name": "signer_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "signer_status": { + "name": "signer_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "signed_at": { + "name": "signed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_signers_envelope_id_contract_envelopes_id_fk": { + "name": "contract_signers_envelope_id_contract_envelopes_id_fk", + "tableFrom": "contract_signers", + "tableTo": "contract_envelopes", + "columnsFrom": [ + "envelope_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_signers_vendor_contact_id_vendor_contacts_id_fk": { + "name": "contract_signers_vendor_contact_id_vendor_contacts_id_fk", + "tableFrom": "contract_signers", + "tableTo": "vendor_contacts", + "columnsFrom": [ + "vendor_contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contracts": { + "name": "contracts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contracts_project_id_projects_id_fk": { + "name": "contracts_project_id_projects_id_fk", + "tableFrom": "contracts", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contracts_vendor_id_vendors_id_fk": { + "name": "contracts_vendor_id_vendors_id_fk", + "tableFrom": "contracts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contracts_contract_no_unique": { + "name": "contracts_contract_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.poa": { + "name": "poa", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "original_contract_no": { + "name": "original_contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "original_contract_name": { + "name": "original_contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_status": { + "name": "original_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "poa_original_contract_no_contracts_contract_no_fk": { + "name": "poa_original_contract_no_contracts_contract_no_fk", + "tableFrom": "poa", + "tableTo": "contracts", + "columnsFrom": [ + "original_contract_no" + ], + "columnsTo": [ + "contract_no" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_project_id_projects_id_fk": { + "name": "poa_project_id_projects_id_fk", + "tableFrom": "poa", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_vendor_id_vendors_id_fk": { + "name": "poa_vendor_id_vendors_id_fk", + "tableFrom": "poa", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_hull": { + "name": "item_offshore_hull", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_hull_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_hull_item_code_items_item_code_fk": { + "name": "item_offshore_hull_item_code_items_item_code_fk", + "tableFrom": "item_offshore_hull", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_top": { + "name": "item_offshore_top", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_top_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_top_item_code_items_item_code_fk": { + "name": "item_offshore_top_item_code_items_item_code_fk", + "tableFrom": "item_offshore_top", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_shipbuilding": { + "name": "item_shipbuilding", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ship_types": { + "name": "ship_types", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'OPTION'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_shipbuilding_item_code_items_item_code_fk": { + "name": "item_shipbuilding_item_code_items_item_code_fk", + "tableFrom": "item_shipbuilding", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.items": { + "name": "items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_no": { + "name": "project_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "package_code": { + "name": "package_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "sm_code": { + "name": "sm_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "items_item_code_unique": { + "name": "items_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.materials": { + "name": "materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "materials_item_code_unique": { + "name": "materials_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias": { + "name": "pq_criterias", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "check_point": { + "name": "check_point", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "group_name": { + "name": "group_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias_extension": { + "name": "pq_criterias_extension", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_criteria_id": { + "name": "pq_criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_info": { + "name": "contract_info", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "additional_requirement": { + "name": "additional_requirement", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk": { + "name": "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "pq_criterias", + "columnsFrom": [ + "pq_criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "pq_criterias_extension_project_id_projects_id_fk": { + "name": "pq_criterias_extension_project_id_projects_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_criteria_attachments": { + "name": "vendor_criteria_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_criteria_answer_id": { + "name": "vendor_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_criteria_attachments", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigation_attachments": { + "name": "vendor_investigation_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "investigation_id": { + "name": "investigation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'REPORT'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { + "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", + "tableFrom": "vendor_investigation_attachments", + "tableTo": "vendor_investigations", + "columnsFrom": [ + "investigation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigations": { + "name": "vendor_investigations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigations_vendor_id_vendors_id_fk": { + "name": "vendor_investigations_vendor_id_vendors_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk": { + "name": "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendor_pq_submissions", + "columnsFrom": [ + "pq_submission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "vendor_investigations_requester_id_users_id_fk": { + "name": "vendor_investigations_requester_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_qm_manager_id_users_id_fk": { + "name": "vendor_investigations_qm_manager_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "qm_manager_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_submissions": { + "name": "vendor_pq_submissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_number": { + "name": "pq_number", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_pq_submission": { + "name": "unique_pq_submission", + "columns": [ + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_pq_submissions_requester_id_users_id_fk": { + "name": "vendor_pq_submissions_requester_id_users_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_pq_submissions_vendor_id_vendors_id_fk": { + "name": "vendor_pq_submissions_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_submissions_project_id_projects_id_fk": { + "name": "vendor_pq_submissions_project_id_projects_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_pq_submissions_pq_number_unique": { + "name": "vendor_pq_submissions_pq_number_unique", + "nullsNotDistinct": false, + "columns": [ + "pq_number" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_criteria_answers": { + "name": "vendor_pq_criteria_answers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "criteria_id": { + "name": "criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "answer": { + "name": "answer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_criteria_answers_vendor_id_vendors_id_fk": { + "name": "vendor_pq_criteria_answers_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": { + "name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "pq_criterias", + "columnsFrom": [ + "criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_project_id_projects_id_fk": { + "name": "vendor_pq_criteria_answers_project_id_projects_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_review_logs": { + "name": "vendor_pq_review_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_pq_criteria_answer_id": { + "name": "vendor_pq_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "reviewer_comment": { + "name": "reviewer_comment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_pq_review_logs", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_pq_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_project_pqs": { + "name": "vendor_project_pqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_project_pqs_vendor_id_vendors_id_fk": { + "name": "vendor_project_pqs_vendor_id_vendors_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_project_pqs_project_id_projects_id_fk": { + "name": "vendor_project_pqs_project_id_projects_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bidding_projects": { + "name": "bidding_projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "proj_nm": { + "name": "proj_nm", + "type": "varchar(90)", + "primaryKey": false, + "notNull": false + }, + "sector": { + "name": "sector", + "type": "char(1)", + "primaryKey": false, + "notNull": false + }, + "proj_msrm": { + "name": "proj_msrm", + "type": "numeric(3, 0)", + "primaryKey": false, + "notNull": false + }, + "kunnr": { + "name": "kunnr", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "kunnr_nm": { + "name": "kunnr_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "cls_1": { + "name": "cls_1", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "cls1_nm": { + "name": "cls1_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "ptype": { + "name": "ptype", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "ptype_nm": { + "name": "ptype_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_cd": { + "name": "pmodel_cd", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "pmodel_nm": { + "name": "pmodel_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_sz": { + "name": "pmodel_sz", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "pmodel_uom": { + "name": "pmodel_uom", + "type": "char(5)", + "primaryKey": false, + "notNull": false + }, + "txt04": { + "name": "txt04", + "type": "char(4)", + "primaryKey": false, + "notNull": false + }, + "txt30": { + "name": "txt30", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "estm_pm": { + "name": "estm_pm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "bidding_projects_pspid_unique": { + "name": "bidding_projects_pspid_unique", + "nullsNotDistinct": false, + "columns": [ + "pspid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_series": { + "name": "project_series", + "schema": "", + "columns": { + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "sers_no": { + "name": "sers_no", + "type": "char(3)", + "primaryKey": false, + "notNull": true + }, + "sc_dt": { + "name": "sc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "kl_dt": { + "name": "kl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "lc_dt": { + "name": "lc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dl_dt": { + "name": "dl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dock_no": { + "name": "dock_no", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "dock_nm": { + "name": "dock_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "proj_no": { + "name": "proj_no", + "type": "char(24)", + "primaryKey": false, + "notNull": false + }, + "post1": { + "name": "post1", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "project_sersNo_unique": { + "name": "project_sersNo_unique", + "columns": [ + { + "expression": "pspid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sers_no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "project_series_pspid_bidding_projects_pspid_fk": { + "name": "project_series_pspid_bidding_projects_pspid_fk", + "tableFrom": "project_series", + "tableTo": "bidding_projects", + "columnsFrom": [ + "pspid" + ], + "columnsTo": [ + "pspid" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projects": { + "name": "projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cbe_evaluations": { + "name": "cbe_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluated_by": { + "name": "evaluated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluated_at": { + "name": "evaluated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "result": { + "name": "result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "total_cost": { + "name": "total_cost", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_schedule": { + "name": "delivery_schedule", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "cbe_evaluations_rfq_id_rfqs_id_fk": { + "name": "cbe_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_vendor_id_vendors_id_fk": { + "name": "cbe_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_evaluated_by_users_id_fk": { + "name": "cbe_evaluations_evaluated_by_users_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "users", + "columnsFrom": [ + "evaluated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_attachments": { + "name": "rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_attachments_rfq_id_rfqs_id_fk": { + "name": "rfq_attachments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_vendor_id_vendors_id_fk": { + "name": "rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_attachments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_cbe_id_cbe_evaluations_id_fk": { + "name": "rfq_attachments_cbe_id_cbe_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "cbe_evaluations", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_comment_id_rfq_comments_id_fk": { + "name": "rfq_attachments_comment_id_rfq_comments_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_comments": { + "name": "rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "comment_text": { + "name": "comment_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "commented_by": { + "name": "commented_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_comments_rfq_id_rfqs_id_fk": { + "name": "rfq_comments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_vendor_id_vendors_id_fk": { + "name": "rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_commented_by_users_id_fk": { + "name": "rfq_comments_commented_by_users_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "commented_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_comments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_cbe_id_vendor_responses_id_fk": { + "name": "rfq_comments_cbe_id_vendor_responses_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_evaluations": { + "name": "rfq_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "eval_type": { + "name": "eval_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "result": { + "name": "result", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_evaluations_rfq_id_rfqs_id_fk": { + "name": "rfq_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_evaluations_vendor_id_vendors_id_fk": { + "name": "rfq_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_items": { + "name": "rfq_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_items_rfq_id_rfqs_id_fk": { + "name": "rfq_items_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_items", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "rfq_items_item_code_items_item_code_fk": { + "name": "rfq_items_item_code_items_item_code_fk", + "tableFrom": "rfq_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfqs": { + "name": "rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "bid_project_id": { + "name": "bid_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false, + "default": "'PURCHASE'" + }, + "parent_rfq_id": { + "name": "parent_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfqs_project_id_projects_id_fk": { + "name": "rfqs_project_id_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_bid_project_id_bidding_projects_id_fk": { + "name": "rfqs_bid_project_id_bidding_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bid_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_created_by_users_id_fk": { + "name": "rfqs_created_by_users_id_fk", + "tableFrom": "rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_parent_rfq_id_rfqs_id_fk": { + "name": "rfqs_parent_rfq_id_rfqs_id_fk", + "tableFrom": "rfqs", + "tableTo": "rfqs", + "columnsFrom": [ + "parent_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "rfqs_rfq_code_unique": { + "name": "rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_commercial_responses": { + "name": "vendor_commercial_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "total_price": { + "name": "total_price", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_period": { + "name": "delivery_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "warranty_period": { + "name": "warranty_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "validity_period": { + "name": "validity_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "price_breakdown": { + "name": "price_breakdown", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "commercial_notes": { + "name": "commercial_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_commercial_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_commercial_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_commercial_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_attachments": { + "name": "vendor_response_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "technical_response_id": { + "name": "technical_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "commercial_response_id": { + "name": "commercial_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_attachments_response_id_vendor_responses_id_fk": { + "name": "vendor_response_attachments_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk": { + "name": "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_technical_responses", + "columnsFrom": [ + "technical_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk": { + "name": "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_commercial_responses", + "columnsFrom": [ + "commercial_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_responses": { + "name": "vendor_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'REVIEWING'" + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "responded_by": { + "name": "responded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "responded_at": { + "name": "responded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "vendor_response_unique": { + "name": "vendor_response_unique", + "columns": [ + { + "expression": "rfq_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_responses_rfq_id_rfqs_id_fk": { + "name": "vendor_responses_rfq_id_rfqs_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_responses_vendor_id_vendors_id_fk": { + "name": "vendor_responses_vendor_id_vendors_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_technical_responses": { + "name": "vendor_technical_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_technical_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_technical_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_technical_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.otps": { + "name": "otps", + "schema": "", + "columns": { + "email": { + "name": "email", + "type": "varchar(256)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(6)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "otpToken": { + "name": "otpToken", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "otp_expires": { + "name": "otp_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permissions": { + "name": "permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "permissions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "permission_key": { + "name": "permission_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.role_permissions": { + "name": "role_permissions", + "schema": "", + "columns": { + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "permission_id": { + "name": "permission_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "role_permissions_role_id_roles_id_fk": { + "name": "role_permissions_role_id_roles_id_fk", + "tableFrom": "role_permissions", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "role_permissions_permission_id_permissions_id_fk": { + "name": "role_permissions_permission_id_permissions_id_fk", + "tableFrom": "role_permissions", + "tableTo": "permissions", + "columnsFrom": [ + "permission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.roles": { + "name": "roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "roles_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "roles_company_id_vendors_id_fk": { + "name": "roles_company_id_vendors_id_fk", + "tableFrom": "roles", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_roles": { + "name": "user_roles", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_roles_user_id_users_id_fk": { + "name": "user_roles_user_id_users_id_fk", + "tableFrom": "user_roles", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_roles_role_id_roles_id_fk": { + "name": "user_roles_role_id_roles_id_fk", + "tableFrom": "user_roles", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "users_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'partners'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "image_url": { + "name": "image_url", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "language": { + "name": "language", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'en'" + } + }, + "indexes": {}, + "foreignKeys": { + "users_company_id_vendors_id_fk": { + "name": "users_company_id_vendors_id_fk", + "tableFrom": "users", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_entries": { + "name": "form_entries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_entries_contract_item_id_contract_items_id_fk": { + "name": "form_entries_contract_item_id_contract_items_id_fk", + "tableFrom": "form_entries", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_metas": { + "name": "form_metas", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "columns": { + "name": "columns", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_metas_project_id_projects_id_fk": { + "name": "form_metas_project_id_projects_id_fk", + "tableFrom": "form_metas", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "form_code_project_unique": { + "name": "form_code_project_unique", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.forms": { + "name": "forms", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "forms_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "eng": { + "name": "eng", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "im": { + "name": "im", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_item_form_code_unique": { + "name": "contract_item_form_code_unique", + "columns": [ + { + "expression": "contract_item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "form_code", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "forms_contract_item_id_contract_items_id_fk": { + "name": "forms_contract_item_id_contract_items_id_fk", + "tableFrom": "forms", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_class_attributes": { + "name": "tag_class_attributes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_class_attributes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "tag_class_id": { + "name": "tag_class_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "att_id": { + "name": "att_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "def_val": { + "name": "def_val", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uom_id": { + "name": "uom_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "seq": { + "name": "seq", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "tag_class_attributes_seq_idx": { + "name": "tag_class_attributes_seq_idx", + "columns": [ + { + "expression": "seq", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "tag_class_attributes_tag_class_id_tag_classes_id_fk": { + "name": "tag_class_attributes_tag_class_id_tag_classes_id_fk", + "tableFrom": "tag_class_attributes", + "tableTo": "tag_classes", + "columnsFrom": [ + "tag_class_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_att_id_in_tag_class": { + "name": "uniq_att_id_in_tag_class", + "nullsNotDistinct": false, + "columns": [ + "tag_class_id", + "att_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_classes": { + "name": "tag_classes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_classes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_classes_project_id_projects_id_fk": { + "name": "tag_classes_project_id_projects_id_fk", + "tableFrom": "tag_classes", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk": { + "name": "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk", + "tableFrom": "tag_classes", + "tableTo": "tag_types", + "columnsFrom": [ + "tag_type_code", + "project_id" + ], + "columnsTo": [ + "code", + "project_id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_code_in_project": { + "name": "uniq_code_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfield_options": { + "name": "tag_subfield_options", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfield_options_project_id_projects_id_fk": { + "name": "tag_subfield_options_project_id_projects_id_fk", + "tableFrom": "tag_subfield_options", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_attribute_project_code": { + "name": "uniq_attribute_project_code", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "attributes_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfields": { + "name": "tag_subfields", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfields_project_id_projects_id_fk": { + "name": "tag_subfields_project_id_projects_id_fk", + "tableFrom": "tag_subfields", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_tag_type_attribute": { + "name": "uniq_tag_type_attribute", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_code", + "attributes_id" + ] + }, + "uniq_attribute_id_project": { + "name": "uniq_attribute_id_project", + "nullsNotDistinct": false, + "columns": [ + "attributes_id", + "project_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_type_class_form_mappings": { + "name": "tag_type_class_form_mappings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_label": { + "name": "tag_type_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "class_label": { + "name": "class_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "ep": { + "name": "ep", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_mapping_in_project": { + "name": "uniq_mapping_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_label", + "class_label", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_types": { + "name": "tag_types", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_types_project_id_projects_id_fk": { + "name": "tag_types_project_id_projects_id_fk", + "tableFrom": "tag_types", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "tag_types_code_project_id_pk": { + "name": "tag_types_code_project_id_pk", + "columns": [ + "code", + "project_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tags": { + "name": "tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tags_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "tag_type": { + "name": "tag_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "class": { + "name": "class", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tags_contract_item_id_contract_items_id_fk": { + "name": "tags_contract_item_id_contract_items_id_fk", + "tableFrom": "tags", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_form_id_forms_id_fk": { + "name": "tags_form_id_forms_id_fk", + "tableFrom": "tags", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_item_tag_no_unique": { + "name": "contract_item_tag_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_item_id", + "tag_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_data_report_temps": { + "name": "vendor_data_report_temps", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_data_report_temps_contract_item_id_contract_items_id_fk": { + "name": "vendor_data_report_temps_contract_item_id_contract_items_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_data_report_temps_form_id_forms_id_fk": { + "name": "vendor_data_report_temps_form_id_forms_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.change_logs": { + "name": "change_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "changed_fields": { + "name": "changed_fields", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "old_values": { + "name": "old_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "new_values": { + "name": "new_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_name": { + "name": "user_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_synced": { + "name": "is_synced", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "sync_attempts": { + "name": "sync_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_sync_error": { + "name": "last_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "synced_at": { + "name": "synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "target_systems": { + "name": "target_systems", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + } + }, + "indexes": { + "idx_change_logs_contract_synced": { + "name": "idx_change_logs_contract_synced", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_synced", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_created_at": { + "name": "idx_change_logs_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_entity": { + "name": "idx_change_logs_entity", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_sync_attempts": { + "name": "idx_change_logs_sync_attempts", + "columns": [ + { + "expression": "sync_attempts", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.document_attachments": { + "name": "document_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "document_attachments_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "revision_id": { + "name": "revision_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "upload_id": { + "name": "upload_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "file_id": { + "name": "file_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "dolce_file_path": { + "name": "dolce_file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "document_attachments_revision_id_revisions_id_fk": { + "name": "document_attachments_revision_id_revisions_id_fk", + "tableFrom": "document_attachments", + "tableTo": "revisions", + "columnsFrom": [ + "revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.documents": { + "name": "documents", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "documents_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "drawing_move_gbn": { + "name": "drawing_move_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "discipline": { + "name": "discipline", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "external_document_id": { + "name": "external_document_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "external_system_type": { + "name": "external_system_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "external_synced_at": { + "name": "external_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "shi_drawing_no": { + "name": "shi_drawing_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager": { + "name": "manager", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_enm": { + "name": "manager_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_no": { + "name": "manager_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "register_group": { + "name": "register_group", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "register_group_id": { + "name": "register_group_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "create_user_no": { + "name": "create_user_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "create_user_id": { + "name": "create_user_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "create_user_enm": { + "name": "create_user_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_contract_doc_status": { + "name": "unique_contract_doc_status", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_contract_vendor_doc": { + "name": "unique_contract_vendor_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"vendor_doc_number\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_external_doc": { + "name": "unique_external_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_system_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"external_document_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "drawing_kind_idx": { + "name": "drawing_kind_idx", + "columns": [ + { + "expression": "drawing_kind", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "documents_contract_id_contracts_id_fk": { + "name": "documents_contract_id_contracts_id_fk", + "tableFrom": "documents", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.issue_stages": { + "name": "issue_stages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "issue_stages_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_name": { + "name": "stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "plan_date": { + "name": "plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "actual_date": { + "name": "actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "stage_status": { + "name": "stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "stage_order": { + "name": "stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "priority": { + "name": "priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'MEDIUM'" + }, + "assignee_id": { + "name": "assignee_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "assignee_name": { + "name": "assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "reminder_days": { + "name": "reminder_days", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_document_stage": { + "name": "unique_document_stage", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_stage_order": { + "name": "document_stage_order", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "issue_stages_document_id_documents_id_fk": { + "name": "issue_stages_document_id_documents_id_fk", + "tableFrom": "issue_stages", + "tableTo": "documents", + "columnsFrom": [ + "document_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.revisions": { + "name": "revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "revisions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "issue_stage_id": { + "name": "issue_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "revision": { + "name": "revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "uploader_type": { + "name": "uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'vendor'" + }, + "uploader_id": { + "name": "uploader_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploader_name": { + "name": "uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "usage": { + "name": "usage", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "revision_status": { + "name": "revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'SUBMITTED'" + }, + "submitted_date": { + "name": "submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "review_start_date": { + "name": "review_start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "approved_date": { + "name": "approved_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "rejected_date": { + "name": "rejected_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "reviewer_id": { + "name": "reviewer_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "review_comments": { + "name": "review_comments", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "external_upload_id": { + "name": "external_upload_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_stage_rev": { + "name": "unique_stage_rev", + "columns": [ + { + "expression": "issue_stage_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "revision", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_batches": { + "name": "sync_batches", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "batch_size": { + "name": "batch_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "retry_count": { + "name": "retry_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "change_log_ids": { + "name": "change_log_ids", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "success_count": { + "name": "success_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "failure_count": { + "name": "failure_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sync_metadata": { + "name": "sync_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_batches_contract_system": { + "name": "idx_sync_batches_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_status": { + "name": "idx_sync_batches_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_created_at": { + "name": "idx_sync_batches_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_configs": { + "name": "sync_configs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "sync_interval_minutes": { + "name": "sync_interval_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 30 + }, + "last_successful_sync": { + "name": "last_successful_sync", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_sync_attempt": { + "name": "last_sync_attempt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "endpoint_url": { + "name": "endpoint_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "auth_token": { + "name": "auth_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "api_version": { + "name": "api_version", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'v1'" + }, + "max_batch_size": { + "name": "max_batch_size", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 100 + }, + "retry_max_attempts": { + "name": "retry_max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_configs_contract_system": { + "name": "idx_sync_configs_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sync_configs_contract_id_contracts_id_fk": { + "name": "sync_configs_contract_id_contracts_id_fk", + "tableFrom": "sync_configs", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_attachments": { + "name": "vendor_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'GENERAL'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_attachments_vendor_id_vendors_id_fk": { + "name": "vendor_attachments_vendor_id_vendors_id_fk", + "tableFrom": "vendor_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidates": { + "name": "vendor_candidates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidates_vendor_id_vendors_id_fk": { + "name": "vendor_candidates_vendor_id_vendors_id_fk", + "tableFrom": "vendor_candidates", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_contacts": { + "name": "vendor_contacts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contact_name": { + "name": "contact_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_position": { + "name": "contact_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "is_primary": { + "name": "is_primary", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_contacts_vendor_id_vendors_id_fk": { + "name": "vendor_contacts_vendor_id_vendors_id_fk", + "tableFrom": "vendor_contacts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_items": { + "name": "vendor_possible_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_items_vendor_id_vendors_id_fk": { + "name": "vendor_possible_items_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_items_item_code_items_item_code_fk": { + "name": "vendor_possible_items_item_code_items_item_code_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_materials": { + "name": "vendor_possible_materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_materials_vendor_id_vendors_id_fk": { + "name": "vendor_possible_materials_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_materials_item_code_materials_item_code_fk": { + "name": "vendor_possible_materials_item_code_materials_item_code_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "materials", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_types": { + "name": "vendor_types", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_types_code_unique": { + "name": "vendor_types_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors": { + "name": "vendors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "vendor_type_id": { + "name": "vendor_type_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_vendor_type_id_vendor_types_id_fk": { + "name": "vendors_vendor_type_id_vendor_types_id_fk", + "tableFrom": "vendors", + "tableTo": "vendor_types", + "columnsFrom": [ + "vendor_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tasks": { + "name": "tasks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'todo'" + }, + "label": { + "name": "label", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'bug'" + }, + "priority": { + "name": "priority", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'low'" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "current_timestamp" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tasks_code_unique": { + "name": "tasks_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidate_logs": { + "name": "vendor_candidate_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_candidate_id": { + "name": "vendor_candidate_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk": { + "name": "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "vendor_candidates", + "columnsFrom": [ + "vendor_candidate_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_candidate_logs_user_id_users_id_fk": { + "name": "vendor_candidate_logs_user_id_users_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors_logs": { + "name": "vendors_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_logs_vendor_id_vendors_id_fk": { + "name": "vendors_logs_vendor_id_vendors_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendors_logs_user_id_users_id_fk": { + "name": "vendors_logs_user_id_users_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract": { + "name": "basic_contract", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_id": { + "name": "template_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requested_by": { + "name": "requested_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "basic_contract_template_id_basic_contract_templates_id_fk": { + "name": "basic_contract_template_id_basic_contract_templates_id_fk", + "tableFrom": "basic_contract", + "tableTo": "basic_contract_templates", + "columnsFrom": [ + "template_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_vendor_id_vendors_id_fk": { + "name": "basic_contract_vendor_id_vendors_id_fk", + "tableFrom": "basic_contract", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_requested_by_users_id_fk": { + "name": "basic_contract_requested_by_users_id_fk", + "tableFrom": "basic_contract", + "tableTo": "users", + "columnsFrom": [ + "requested_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract_templates": { + "name": "basic_contract_templates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_templates_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_name": { + "name": "template_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "validity_period": { + "name": "validity_period", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.incoterms": { + "name": "incoterms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(20)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "incoterms_created_by_users_id_fk": { + "name": "incoterms_created_by_users_id_fk", + "tableFrom": "incoterms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payment_terms": { + "name": "payment_terms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "payment_terms_created_by_users_id_fk": { + "name": "payment_terms_created_by_users_id_fk", + "tableFrom": "payment_terms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pr_items": { + "name": "pr_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "pr_items", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_attachments": { + "name": "procurement_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "procurement_rfq_details_id": { + "name": "procurement_rfq_details_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk": { + "name": "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfq_details", + "columnsFrom": [ + "procurement_rfq_details_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_created_by_users_id_fk": { + "name": "procurement_attachments_created_by_users_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "attachment_type_check": { + "name": "attachment_type_check", + "value": "\"procurement_attachments\".\"procurement_rfqs_id\" IS NOT NULL OR \"procurement_attachments\".\"procurement_rfq_details_id\" IS NOT NULL" + } + }, + "isRLSEnabled": false + }, + "public.procurement_quotation_items": { + "name": "procurement_quotation_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pr_item_id": { + "name": "pr_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "material_code": { + "name": "material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "uom": { + "name": "uom", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "unit_price": { + "name": "unit_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "vendor_material_code": { + "name": "vendor_material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_material_description": { + "name": "vendor_material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "lead_time_in_days": { + "name": "lead_time_in_days", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_rate": { + "name": "discount_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_amount": { + "name": "discount_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_alternative": { + "name": "is_alternative", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_recommended": { + "name": "is_recommended", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_quotation_items_pr_item_id_pr_items_id_fk": { + "name": "procurement_quotation_items_pr_item_id_pr_items_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "pr_items", + "columnsFrom": [ + "pr_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_attachments": { + "name": "procurement_rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_uploaded_by_users_id_fk": { + "name": "procurement_rfq_attachments_uploaded_by_users_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_comments": { + "name": "procurement_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_comments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_user_id_users_id_fk": { + "name": "procurement_rfq_comments_user_id_users_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_details": { + "name": "procurement_rfq_details", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendors_id": { + "name": "vendors_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'VV'" + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_vendors_id_vendors_id_fk": { + "name": "procurement_rfq_details_vendors_id_vendors_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "vendors", + "columnsFrom": [ + "vendors_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_rfq_details_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_incoterms_code_incoterms_code_fk": { + "name": "procurement_rfq_details_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_updated_by_users_id_fk": { + "name": "procurement_rfq_details_updated_by_users_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfqs": { + "name": "procurement_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "series": { + "name": "series", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "rfq_sealed_yn": { + "name": "rfq_sealed_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfqs_project_id_projects_id_fk": { + "name": "procurement_rfqs_project_id_projects_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_sent_by_users_id_fk": { + "name": "procurement_rfqs_sent_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_created_by_users_id_fk": { + "name": "procurement_rfqs_created_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_updated_by_users_id_fk": { + "name": "procurement_rfqs_updated_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "procurement_rfqs_rfq_code_unique": { + "name": "procurement_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_vendor_quotations": { + "name": "procurement_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_items_count": { + "name": "total_items_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sub_total": { + "name": "sub_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "tax_total": { + "name": "tax_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "discount_total": { + "name": "discount_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "estimated_delivery_date": { + "name": "estimated_delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "procurement_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_incoterms_code_incoterms_code_fk": { + "name": "procurement_vendor_quotations_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.preset_shares": { + "name": "preset_shares", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "preset_id": { + "name": "preset_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "shared_with_user_id": { + "name": "shared_with_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'read'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "preset_shares_preset_id_table_presets_id_fk": { + "name": "preset_shares_preset_id_table_presets_id_fk", + "tableFrom": "preset_shares", + "tableTo": "table_presets", + "columnsFrom": [ + "preset_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_presets": { + "name": "table_presets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_shared": { + "name": "is_shared", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_attachments": { + "name": "tech_sales_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "tech_sales_rfq_id": { + "name": "tech_sales_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "tech_sales_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_attachments_created_by_users_id_fk": { + "name": "tech_sales_attachments_created_by_users_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comment_attachments": { + "name": "tech_sales_rfq_comment_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk": { + "name": "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk": { + "name": "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comments": { + "name": "tech_sales_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_user_id_users_id_fk": { + "name": "tech_sales_rfq_comments_user_id_users_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfqs": { + "name": "tech_sales_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_shipbuilding_id": { + "name": "item_shipbuilding_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "bidding_project_id": { + "name": "bidding_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_snapshot": { + "name": "project_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "series_snapshot": { + "name": "series_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk": { + "name": "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "item_shipbuilding", + "columnsFrom": [ + "item_shipbuilding_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk": { + "name": "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bidding_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_sent_by_users_id_fk": { + "name": "tech_sales_rfqs_sent_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_created_by_users_id_fk": { + "name": "tech_sales_rfqs_created_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_updated_by_users_id_fk": { + "name": "tech_sales_rfqs_updated_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tech_sales_rfqs_rfq_code_unique": { + "name": "tech_sales_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_vendor_quotations": { + "name": "tech_sales_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "tech_sales_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rotation_attempts": { + "name": "ocr_rotation_attempts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "rotation": { + "name": "rotation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "tables_found": { + "name": "tables_found", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "text_quality": { + "name": "text_quality", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "keyword_count": { + "name": "keyword_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "score": { + "name": "score", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "extracted_rows_count": { + "name": "extracted_rows_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_rotation_attempts_session_id_ocr_sessions_id_fk": { + "name": "ocr_rotation_attempts_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rotation_attempts", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rows": { + "name": "ocr_rows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "table_id": { + "name": "table_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "row_index": { + "name": "row_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "report_no": { + "name": "report_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "no": { + "name": "no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "identification_no": { + "name": "identification_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_no": { + "name": "joint_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_type": { + "name": "joint_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "welding_date": { + "name": "welding_date", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "source_table": { + "name": "source_table", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "source_row": { + "name": "source_row", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_ocr_report_no_unique": { + "name": "idx_ocr_report_no_unique", + "columns": [ + { + "expression": "report_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "tag_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "joint_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "joint_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "ocr_rows_table_id_ocr_tables_id_fk": { + "name": "ocr_rows_table_id_ocr_tables_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_tables", + "columnsFrom": [ + "table_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_session_id_ocr_sessions_id_fk": { + "name": "ocr_rows_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_user_id_users_id_fk": { + "name": "ocr_rows_user_id_users_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_sessions": { + "name": "ocr_sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "processing_time": { + "name": "processing_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "best_rotation": { + "name": "best_rotation", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_tables": { + "name": "total_tables", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_rows": { + "name": "total_rows", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "image_enhanced": { + "name": "image_enhanced", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pdf_converted": { + "name": "pdf_converted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "success": { + "name": "success", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "warnings": { + "name": "warnings", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_tables": { + "name": "ocr_tables", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "table_index": { + "name": "table_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "row_count": { + "name": "row_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_tables_session_id_ocr_sessions_id_fk": { + "name": "ocr_tables_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_tables", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.offshore_hull_work_type": { + "name": "offshore_hull_work_type", + "schema": "public", + "values": [ + "HA", + "HE", + "HH", + "HM", + "NC" + ] + }, + "public.offshore_top_work_type": { + "name": "offshore_top_work_type", + "schema": "public", + "values": [ + "TM", + "TS", + "TE", + "TP" + ] + }, + "public.work_type": { + "name": "work_type", + "schema": "public", + "values": [ + "기장", + "전장", + "선실", + "배관", + "철의" + ] + }, + "public.user_domain": { + "name": "user_domain", + "schema": "public", + "values": [ + "evcp", + "partners" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": { + "public.contracts_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"contracts\".\"id\", \"contracts\".\"contract_no\", \"contracts\".\"contract_name\", \"contracts\".\"status\", \"contracts\".\"start_date\", \"contracts\".\"end_date\", \"contracts\".\"project_id\", \"projects\".\"code\", \"projects\".\"name\", \"contracts\".\"vendor_id\", \"vendors\".\"vendor_name\", \"contracts\".\"payment_terms\", \"contracts\".\"delivery_terms\", \"contracts\".\"delivery_date\", \"contracts\".\"delivery_location\", \"contracts\".\"currency\", \"contracts\".\"total_amount\", \"contracts\".\"discount\", \"contracts\".\"tax\", \"contracts\".\"shipping_fee\", \"contracts\".\"net_total\", \"contracts\".\"partial_shipping_allowed\", \"contracts\".\"partial_payment_allowed\", \"contracts\".\"remarks\", \"contracts\".\"version\", \"contracts\".\"created_at\", \"contracts\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"contracts\".\"id\"\n ) as \"has_signature\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "contracts_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.poa_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", + "name": "poa_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.project_approved_vendors": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"status\", \"vendor_types\".\"name_ko\", \"vendor_types\".\"name_en\", \"projects\".\"code\", \"projects\".\"name\", \"projects\".\"type\", \"vendor_pq_submissions\".\"submitted_at\", \"vendor_pq_submissions\".\"approved_at\" from \"vendors\" inner join \"vendor_pq_submissions\" on \"vendor_pq_submissions\".\"vendor_id\" = \"vendors\".\"id\" inner join \"projects\" on \"vendor_pq_submissions\".\"project_id\" = \"projects\".\"id\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\" where \"vendor_pq_submissions\".\"status\" = 'APPROVED'", + "name": "project_approved_vendors", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_investigations_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"vendor_id\", \"vendor_investigations\".\"pq_submission_id\", \"vendor_investigations\".\"requester_id\", \"vendor_investigations\".\"qm_manager_id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"evaluation_type\", \"vendor_investigations\".\"investigation_address\", \"vendor_investigations\".\"investigation_method\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"forecasted_at\", \"vendor_investigations\".\"requested_at\", \"vendor_investigations\".\"confirmed_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"evaluation_score\", \"vendor_investigations\".\"evaluation_result\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", requester.name as \"requesterName\", requester.email as \"requesterEmail\", qm_manager.name as \"qmManagerName\", qm_manager.email as \"qmManagerEmail\", (\n CASE \n WHEN EXISTS (\n SELECT 1 FROM vendor_investigation_attachments via \n WHERE via.investigation_id = \"vendor_investigations\".\"id\"\n ) \n THEN true \n ELSE false \n END\n ) as \"hasAttachments\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\" left join users AS requester on \"vendor_investigations\".\"requester_id\" = requester.id left join users AS qm_manager on \"vendor_investigations\".\"qm_manager_id\" = qm_manager.id", + "name": "vendor_investigations_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.cbe_view": { + "columns": {}, + "definition": "select \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"rfq_id\" as \"rfq_id\", \"cbe_evaluations\".\"vendor_id\" as \"vendor_id\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"result\" as \"result\", \"cbe_evaluations\".\"notes\" as \"notes\", \"cbe_evaluations\".\"evaluated_by\" as \"evaluated_by\", \"cbe_evaluations\".\"evaluated_at\" as \"evaluated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"name\" as \"evaluator_name\", \"users\".\"email\" as \"evaluator_email\" from \"cbe_evaluations\" inner join \"rfqs\" on \"cbe_evaluations\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"cbe_evaluations\".\"evaluated_by\" = \"users\".\"id\"", + "name": "cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.rfqs_view": { + "columns": {}, + "definition": "select \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"rfqs\".\"parent_rfq_id\" as \"parent_rfq_id\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"email\" as \"user_email\", \"users\".\"name\" as \"user_name\", (\n SELECT COUNT(*) \n FROM \"rfq_items\" \n WHERE \"rfq_items\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"item_count\", (\n SELECT COUNT(*) \n FROM \"rfq_attachments\" \n WHERE \"rfq_attachments\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"attachment_count\" from \"rfqs\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"rfqs\".\"created_by\" = \"users\".\"id\"", + "name": "rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_cbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", \"cbe_evaluations\".\"notes\" as \"cbe_note\", \"cbe_evaluations\".\"updated_at\" as \"cbe_updated\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"delivery_schedule\" as \"delivery_schedule\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_response_cbe_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"notes\" as \"response_notes\", \"vendor_responses\".\"responded_by\" as \"responded_by\", \"vendor_responses\".\"responded_at\" as \"responded_at\", \"vendor_responses\".\"updated_at\" as \"response_updated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"status\" as \"vendor_status\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"response_status\" as \"commercial_response_status\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"vendor_commercial_responses\".\"payment_terms\" as \"payment_terms\", \"vendor_commercial_responses\".\"incoterms\" as \"incoterms\", \"vendor_commercial_responses\".\"delivery_period\" as \"delivery_period\", \"vendor_commercial_responses\".\"warranty_period\" as \"warranty_period\", \"vendor_commercial_responses\".\"validity_period\" as \"validity_period\", \"vendor_commercial_responses\".\"price_breakdown\" as \"price_breakdown\", \"vendor_commercial_responses\".\"commercial_notes\" as \"commercial_notes\", \"vendor_commercial_responses\".\"created_at\" as \"commercial_created_at\", \"vendor_commercial_responses\".\"updated_at\" as \"commercial_updated_at\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"commercial_response_id\" = \"vendor_commercial_responses\".\"id\"\n ) as \"commercial_attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n AND \"vendor_response_attachments\".\"attachment_type\" = 'TECHNICAL_SPEC'\n ) as \"technical_attachment_count\", (\n SELECT MAX(\"uploaded_at\") \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"latest_attachment_date\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\"", + "name": "vendor_response_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_responses_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"created_at\" as \"rfq_created_at\", \"rfqs\".\"updated_at\" as \"rfq_updated_at\", \"rfqs\".\"created_by\" as \"rfq_created_by\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"responded_at\" as \"responded_at\", CASE WHEN \"vendor_technical_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_technical_response\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", CASE WHEN \"vendor_commercial_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_commercial_response\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"rfq_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE') left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"cbe_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\")", + "name": "vendor_responses_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_rfq_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", + "name": "vendor_rfq_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_tbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", \"vendor_technical_responses\".\"response_status\" as \"technical_response_status\", \"vendor_technical_responses\".\"summary\" as \"technical_summary\", \"vendor_technical_responses\".\"notes\" as \"technical_notes\", \"vendor_technical_responses\".\"updated_at\" as \"technical_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"rfq_evaluations\".\"notes\" as \"tbe_note\", \"rfq_evaluations\".\"updated_at\" as \"tbe_updated\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_tbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.role_view": { + "columns": {}, + "definition": "select \"roles\".\"id\" as \"id\", \"roles\".\"name\" as \"name\", \"roles\".\"description\" as \"description\", \"roles\".\"domain\" as \"domain\", \"roles\".\"created_at\" as \"created_at\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", COUNT(\"users\".\"id\") as \"user_count\" from \"roles\" left join \"user_roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" left join \"users\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"vendors\" on \"roles\".\"company_id\" = \"vendors\".\"id\" group by \"roles\".\"id\", \"vendors\".\"id\"", + "name": "role_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.user_view": { + "columns": {}, + "definition": "select \"users\".\"id\" as \"user_id\", \"users\".\"name\" as \"user_name\", \"users\".\"email\" as \"user_email\", \"users\".\"domain\" as \"user_domain\", \"users\".\"image_url\" as \"user_image\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"vendors\" on \"users\".\"company_id\" = \"vendors\".\"id\" left join \"user_roles\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" group by \"users\".\"id\", \"vendors\".\"id\"", + "name": "user_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.form_lists_view": { + "columns": {}, + "definition": "select \"tag_type_class_form_mappings\".\"id\" as \"id\", \"tag_type_class_form_mappings\".\"project_id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"tag_type_class_form_mappings\".\"tag_type_label\" as \"tag_type_label\", \"tag_type_class_form_mappings\".\"class_label\" as \"class_label\", \"tag_type_class_form_mappings\".\"form_code\" as \"form_code\", \"tag_type_class_form_mappings\".\"form_name\" as \"form_name\", \"tag_type_class_form_mappings\".\"ep\" as \"ep\", \"tag_type_class_form_mappings\".\"remark\" as \"remark\", \"tag_type_class_form_mappings\".\"created_at\" as \"created_at\", \"tag_type_class_form_mappings\".\"updated_at\" as \"updated_at\" from \"tag_type_class_form_mappings\" inner join \"projects\" on \"tag_type_class_form_mappings\".\"project_id\" = \"projects\".\"id\"", + "name": "form_lists_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.view_tag_subfields": { + "columns": { + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "definition": "select \"tag_subfields\".\"id\" as \"id\", \"tag_subfields\".\"tag_type_code\", \"tag_types\".\"description\", \"tag_subfields\".\"attributes_id\", \"tag_subfields\".\"attributes_description\", \"tag_subfields\".\"expression\", \"tag_subfields\".\"delimiter\", \"tag_subfields\".\"sort_order\", \"tag_subfields\".\"created_at\", \"tag_subfields\".\"updated_at\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\", \"projects\".\"name\" from \"tag_subfields\" inner join \"tag_types\" on (\"tag_subfields\".\"tag_type_code\" = \"tag_types\".\"code\" and \"tag_subfields\".\"project_id\" = \"tag_types\".\"project_id\") inner join \"projects\" on \"tag_subfields\".\"project_id\" = \"projects\".\"id\"", + "name": "view_tag_subfields", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.document_stages_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_count": { + "name": "stage_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_list": { + "name": "stage_list", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT\n d.id AS document_id,\n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n d.contract_id,\n (SELECT COUNT(*) FROM issue_stages WHERE document_id = d.id) AS stage_count,\n COALESCE( \n (SELECT json_agg(i.stage_name) FROM issue_stages i WHERE i.document_id = d.id), \n '[]'\n ) AS stage_list,\n d.created_at,\n d.updated_at\n FROM documents d\n", + "name": "document_stages_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.enhanced_documents_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_id": { + "name": "current_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_name": { + "name": "current_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_status": { + "name": "current_stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_order": { + "name": "current_stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_plan_date": { + "name": "current_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_actual_date": { + "name": "current_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_assignee_name": { + "name": "current_stage_assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_priority": { + "name": "current_stage_priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "days_until_due": { + "name": "days_until_due", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_overdue": { + "name": "is_overdue", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "days_difference": { + "name": "days_difference", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "total_stages": { + "name": "total_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "completed_stages": { + "name": "completed_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "progress_percentage": { + "name": "progress_percentage", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_status": { + "name": "latest_revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_submitted_date": { + "name": "latest_submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "all_stages": { + "name": "all_stages", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n WITH document_stats AS (\n SELECT \n d.id as document_id,\n COUNT(ist.id) as total_stages,\n COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) as completed_stages,\n CASE \n WHEN COUNT(ist.id) > 0 \n THEN ROUND((COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) * 100.0) / COUNT(ist.id))\n ELSE 0 \n END as progress_percentage\n FROM documents d\n LEFT JOIN issue_stages ist ON d.id = ist.document_id\n GROUP BY d.id\n ),\n current_stage_info AS (\n SELECT DISTINCT ON (document_id)\n document_id,\n id as current_stage_id,\n stage_name as current_stage_name,\n stage_status as current_stage_status,\n stage_order as current_stage_order,\n plan_date as current_stage_plan_date,\n actual_date as current_stage_actual_date,\n assignee_name as current_stage_assignee_name,\n priority as current_stage_priority,\n CASE \n WHEN actual_date IS NULL AND plan_date IS NOT NULL \n THEN plan_date - CURRENT_DATE\n ELSE NULL \n END as days_until_due,\n CASE \n WHEN actual_date IS NULL AND plan_date < CURRENT_DATE \n THEN true\n WHEN actual_date IS NOT NULL AND actual_date > plan_date \n THEN true\n ELSE false \n END as is_overdue,\n CASE \n WHEN actual_date IS NOT NULL AND plan_date IS NOT NULL \n THEN actual_date - plan_date\n ELSE NULL \n END as days_difference\n FROM issue_stages\n WHERE stage_status NOT IN ('COMPLETED', 'APPROVED')\n ORDER BY document_id, stage_order ASC, priority DESC\n ),\n latest_revision_info AS (\n SELECT DISTINCT ON (ist.document_id)\n ist.document_id,\n r.id as latest_revision_id,\n r.revision as latest_revision,\n r.revision_status as latest_revision_status,\n r.uploader_name as latest_revision_uploader_name,\n r.submitted_date as latest_submitted_date\n FROM revisions r\n JOIN issue_stages ist ON r.issue_stage_id = ist.id\n ORDER BY ist.document_id, r.created_at DESC\n ),\n -- 리비전별 첨부파일 집계\n revision_attachments AS (\n SELECT \n r.id as revision_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', da.id,\n 'revisionId', da.revision_id,\n 'fileName', da.file_name,\n 'filePath', da.file_path,\n 'fileSize', da.file_size,\n 'fileType', da.file_type,\n 'createdAt', da.created_at,\n 'updatedAt', da.updated_at\n ) ORDER BY da.created_at\n ) FILTER (WHERE da.id IS NOT NULL),\n '[]'::json\n ) as attachments\n FROM revisions r\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY r.id\n ),\n -- 스테이지별 리비전 집계 (첨부파일 포함)\n stage_revisions AS (\n SELECT \n ist.id as stage_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', r.id,\n 'issueStageId', r.issue_stage_id,\n 'revision', r.revision,\n 'uploaderType', r.uploader_type,\n 'uploaderId', r.uploader_id,\n 'uploaderName', r.uploader_name,\n 'comment', r.comment,\n 'usage', r.usage,\n 'revisionStatus', r.revision_status,\n 'submittedDate', r.submitted_date,\n 'uploadedAt', r.uploaded_at,\n 'approvedDate', r.approved_date,\n 'reviewStartDate', r.review_start_date,\n 'rejectedDate', r.rejected_date,\n 'reviewerId', r.reviewer_id,\n 'reviewerName', r.reviewer_name,\n 'reviewComments', r.review_comments,\n 'createdAt', r.created_at,\n 'updatedAt', r.updated_at,\n 'attachments', ra.attachments\n ) ORDER BY r.created_at\n ) FILTER (WHERE r.id IS NOT NULL),\n '[]'::json\n ) as revisions\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN revision_attachments ra ON r.id = ra.revision_id\n GROUP BY ist.id\n ),\n -- 문서별 스테이지 집계 (리비전 포함)\n stage_aggregation AS (\n SELECT \n ist.document_id,\n json_agg(\n json_build_object(\n 'id', ist.id,\n 'stageName', ist.stage_name,\n 'stageStatus', ist.stage_status,\n 'stageOrder', ist.stage_order,\n 'planDate', ist.plan_date,\n 'actualDate', ist.actual_date,\n 'assigneeName', ist.assignee_name,\n 'priority', ist.priority,\n 'revisions', sr.revisions\n ) ORDER BY ist.stage_order\n ) as all_stages\n FROM issue_stages ist\n LEFT JOIN stage_revisions sr ON ist.id = sr.stage_id\n GROUP BY ist.document_id\n ),\n attachment_counts AS (\n SELECT \n ist.document_id,\n COUNT(da.id) as attachment_count\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY ist.document_id\n )\n \n SELECT \n d.id as document_id,\n d.doc_number,\n d.drawing_kind,\n d.vendor_doc_number, -- ✅ 벤더 문서 번호 추가\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n\n d.c_gbn,\n d.d_gbn,\n d.degree_gbn,\n d.dept_gbn,\n d.s_gbn,\n\n\n \n -- ✅ 프로젝트 및 벤더 정보 추가\n p.code as project_code,\n v.vendor_name as vendor_name,\n v.vendor_code as vendor_code,\n \n -- 현재 스테이지 정보\n csi.current_stage_id,\n csi.current_stage_name,\n csi.current_stage_status,\n csi.current_stage_order,\n csi.current_stage_plan_date,\n csi.current_stage_actual_date,\n csi.current_stage_assignee_name,\n csi.current_stage_priority,\n \n -- 계산 필드\n csi.days_until_due,\n csi.is_overdue,\n csi.days_difference,\n \n -- 진행률 정보\n ds.total_stages,\n ds.completed_stages,\n ds.progress_percentage,\n \n -- 최신 리비전 정보\n lri.latest_revision_id,\n lri.latest_revision,\n lri.latest_revision_status,\n lri.latest_revision_uploader_name,\n lri.latest_submitted_date,\n \n -- 전체 스테이지 (리비전 및 첨부파일 포함)\n COALESCE(sa.all_stages, '[]'::json) as all_stages,\n \n -- 기타\n COALESCE(ac.attachment_count, 0) as attachment_count,\n d.created_at,\n d.updated_at\n \n FROM documents d\n -- ✅ contracts, projects, vendors 테이블 JOIN 추가\n LEFT JOIN contracts c ON d.contract_id = c.id\n LEFT JOIN projects p ON c.project_id = p.id\n LEFT JOIN vendors v ON c.vendor_id = v.id\n \n LEFT JOIN document_stats ds ON d.id = ds.document_id\n LEFT JOIN current_stage_info csi ON d.id = csi.document_id\n LEFT JOIN latest_revision_info lri ON d.id = lri.document_id\n LEFT JOIN stage_aggregation sa ON d.id = sa.document_id\n LEFT JOIN attachment_counts ac ON d.id = ac.document_id\n \n ORDER BY d.created_at DESC\n", + "name": "enhanced_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.sync_status_view": { + "columns": { + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "total_changes": { + "name": "total_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pending_changes": { + "name": "pending_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "synced_changes": { + "name": "synced_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "failed_changes": { + "name": "failed_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "last_sync_at": { + "name": "last_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_sync_at": { + "name": "next_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n WITH change_stats AS (\n SELECT \n cl.contract_id,\n sc.target_system,\n COUNT(*) as total_changes,\n COUNT(CASE WHEN cl.is_synced = false AND cl.sync_attempts < sc.retry_max_attempts THEN 1 END) as pending_changes,\n COUNT(CASE WHEN cl.is_synced = true THEN 1 END) as synced_changes,\n COUNT(CASE WHEN cl.sync_attempts >= sc.retry_max_attempts AND cl.is_synced = false THEN 1 END) as failed_changes,\n MAX(cl.synced_at) as last_sync_at\n FROM change_logs cl\n CROSS JOIN sync_configs sc \n WHERE cl.contract_id = sc.contract_id\n AND (cl.target_systems IS NULL OR cl.target_systems @> to_jsonb(sc.target_system))\n GROUP BY cl.contract_id, sc.target_system\n )\n SELECT \n cs.contract_id,\n cs.target_system,\n COALESCE(cs.total_changes, 0) as total_changes,\n COALESCE(cs.pending_changes, 0) as pending_changes,\n COALESCE(cs.synced_changes, 0) as synced_changes,\n COALESCE(cs.failed_changes, 0) as failed_changes,\n cs.last_sync_at,\n CASE \n WHEN sc.sync_enabled = true AND sc.last_successful_sync IS NOT NULL \n THEN sc.last_successful_sync + (sc.sync_interval_minutes || ' minutes')::interval\n ELSE NULL\n END as next_sync_at,\n sc.sync_enabled\n FROM sync_configs sc\n LEFT JOIN change_stats cs ON sc.contract_id = cs.contract_id AND sc.target_system = cs.target_system\n", + "name": "sync_status_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_documents_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "latest_stage_id": { + "name": "latest_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_stage_name": { + "name": "latest_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_stage_plan_date": { + "name": "latest_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_stage_actual_date": { + "name": "latest_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_type": { + "name": "latest_revision_uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT \n d.id, \n d.doc_number,\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n (SELECT id FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_id,\n (SELECT stage_name FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_name,\n (SELECT plan_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_plan_date,\n (SELECT actual_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_actual_date,\n \n (SELECT r.id FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_id,\n (SELECT r.revision FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision,\n (SELECT r.uploader_type FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_type,\n (SELECT r.uploader_name FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_name,\n \n (SELECT COUNT(*) FROM document_attachments a JOIN revisions r ON a.revision_id = r.id JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id) AS attachment_count,\n \n d.created_at,\n d.updated_at\n FROM documents d\n JOIN contracts c ON d.contract_id = c.id\n ", + "name": "vendor_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_candidates_with_vendor_info": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_candidates\".\"id\", \"vendor_candidates\".\"company_name\", \"vendor_candidates\".\"contact_email\", \"vendor_candidates\".\"contact_phone\", \"vendor_candidates\".\"tax_id\", \"vendor_candidates\".\"address\", \"vendor_candidates\".\"country\", \"vendor_candidates\".\"source\", \"vendor_candidates\".\"status\", \"vendor_candidates\".\"items\", \"vendor_candidates\".\"remark\", \"vendor_candidates\".\"created_at\", \"vendor_candidates\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"created_at\" as \"vendor_created_at\", (\n SELECT l2.\"created_at\"\n FROM \"vendor_candidate_logs\" l2\n WHERE l2.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l2.\"action\" = 'status_change'\n ORDER BY l2.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_at\", (\n SELECT u.\"name\"\n FROM \"users\" u\n JOIN \"vendor_candidate_logs\" l3\n ON l3.\"user_id\" = u.\"id\"\n WHERE l3.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l3.\"action\" = 'status_change'\n ORDER BY l3.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_by\", (\n SELECT l4.\"created_at\"\n FROM \"vendor_candidate_logs\" l4\n WHERE l4.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l4.\"action\" = 'invite_sent'\n ORDER BY l4.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_at\", (\n SELECT u2.\"name\"\n FROM \"users\" u2\n JOIN \"vendor_candidate_logs\" l5\n ON l5.\"user_id\" = u2.\"id\"\n WHERE l5.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l5.\"action\" = 'invite_sent'\n ORDER BY l5.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_by\" from \"vendor_candidates\" left join \"vendors\" on \"vendor_candidates\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "vendor_candidates_with_vendor_info", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"business_size\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"", + "name": "vendor_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", + "name": "vendor_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_materials_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_materials\".\"id\", \"vendor_possible_materials\".\"vendor_id\", \"materials\".\"item_name\", \"materials\".\"item_code\", \"materials\".\"description\", \"materials\".\"unit_of_measure\", \"materials\".\"steel_type\", \"materials\".\"grade_material\", \"vendor_possible_materials\".\"created_at\", \"vendor_possible_materials\".\"updated_at\" from \"vendor_possible_materials\" left join \"materials\" on \"vendor_possible_materials\".\"item_code\" = \"materials\".\"item_code\"", + "name": "vendor_materials_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendors_with_types": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"tax_id\" as \"tax_id\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"phone\" as \"phone\", \"vendors\".\"email\" as \"email\", \"vendors\".\"business_size\" as \"business_size\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"status\", \"vendors\".\"vendor_type_id\" as \"vendor_type_id\", \"vendors\".\"representative_name\" as \"representative_name\", \"vendors\".\"representative_birth\" as \"representative_birth\", \"vendors\".\"representative_email\" as \"representative_email\", \"vendors\".\"representative_phone\" as \"representative_phone\", \"vendors\".\"corporate_registration_number\" as \"corporate_registration_number\", \"vendors\".\"items\" as \"items\", \"vendors\".\"credit_agency\" as \"credit_agency\", \"vendors\".\"credit_rating\" as \"credit_rating\", \"vendors\".\"cash_flow_rating\" as \"cash_flow_rating\", \"vendors\".\"created_at\" as \"created_at\", \"vendors\".\"updated_at\" as \"updated_at\", \"vendor_types\".\"name_ko\" as \"vendor_type_name\", \"vendor_types\".\"name_en\" as \"vendor_type_name_en\", \"vendor_types\".\"code\" as \"vendor_type_code\", \n CASE\n WHEN \"vendors\".\"status\" = 'ACTIVE' THEN '정규업체'\n WHEN \"vendors\".\"status\" IN ('INACTIVE', 'BLACKLISTED', 'REJECTED') THEN ''\n ELSE '잠재업체'\n END\n as \"vendor_category\" from \"vendors\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\"", + "name": "vendors_with_types", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.basic_contract_view": { + "columns": {}, + "definition": "select \"basic_contract\".\"id\" as \"id\", \"basic_contract\".\"template_id\" as \"template_id\", \"basic_contract\".\"vendor_id\" as \"vendor_id\", \"basic_contract\".\"requested_by\" as \"requested_by\", \"basic_contract\".\"status\" as \"basic_contract_status\", \"basic_contract\".\"created_at\" as \"created_at\", \"basic_contract\".\"updated_at\" as \"updated_at\", \"basic_contract\".\"updated_at\" as \"completed_at\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"email\" as \"vendor_email\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"users\".\"name\" as \"user_name\", \"basic_contract_templates\".\"template_name\" as \"template_name\", \"basic_contract_templates\".\"validity_period\" as \"validityPeriod\", \"basic_contract_templates\".\"file_path\" as \"file_path\", \"basic_contract_templates\".\"file_name\" as \"file_name\", \"basic_contract\".\"file_path\" as \"signed_file_path\" from \"basic_contract\" left join \"vendors\" on \"basic_contract\".\"vendor_id\" = \"vendors\".\"id\" left join \"users\" on \"basic_contract\".\"requested_by\" = \"users\".\"id\" left join \"basic_contract_templates\" on \"basic_contract\".\"template_id\" = \"basic_contract_templates\".\"id\"", + "name": "basic_contract_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.pr_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"pr_items\".\"id\", \"pr_items\".\"procurement_rfqs_id\", \"pr_items\".\"rfq_item\", \"pr_items\".\"pr_item\", \"pr_items\".\"pr_no\", \"pr_items\".\"material_code\", \"pr_items\".\"material_category\", \"pr_items\".\"acc\", \"pr_items\".\"material_description\", \"pr_items\".\"size\", \"pr_items\".\"delivery_date\", \"pr_items\".\"quantity\", \"pr_items\".\"uom\", \"pr_items\".\"gross_weight\", \"pr_items\".\"gw_uom\", \"pr_items\".\"spec_no\", \"pr_items\".\"spec_url\", \"pr_items\".\"tracking_no\", \"pr_items\".\"major_yn\", \"pr_items\".\"project_def\", \"pr_items\".\"project_sc\", \"pr_items\".\"project_kl\", \"pr_items\".\"project_lc\", \"pr_items\".\"project_dl\", \"pr_items\".\"remark\", \"procurement_rfqs\".\"rfq_code\", \"procurement_rfqs\".\"item_code\", \"procurement_rfqs\".\"item_name\" from \"pr_items\" left join \"procurement_rfqs\" on \"pr_items\".\"procurement_rfqs_id\" = \"procurement_rfqs\".\"id\"", + "name": "pr_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfq_details_view": { + "columns": {}, + "definition": "select \"rfq_details\".\"id\" as \"detail_id\", \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfqs\".\"item_code\" as \"item_code\", \"rfqs\".\"item_name\" as \"item_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"country\" as \"vendor_country\", \"rfq_details\".\"currency\" as \"currency\", \"payment_terms\".\"code\" as \"payment_terms_code\", \"payment_terms\".\"description\" as \"payment_terms_description\", \"incoterms\".\"code\" as \"incoterms_code\", \"incoterms\".\"description\" as \"incoterms_description\", \"rfq_details\".\"incoterms_detail\" as \"incoterms_detail\", \"rfq_details\".\"delivery_date\" as \"delivery_date\", \"rfq_details\".\"tax_code\" as \"tax_code\", \"rfq_details\".\"place_of_shipping\" as \"place_of_shipping\", \"rfq_details\".\"place_of_destination\" as \"place_of_destination\", \"rfq_details\".\"material_price_related_yn\" as \"material_price_related_yn\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"rfq_details\".\"updated_at\" as \"updated_at\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\"\n ) as \"pr_items_count\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\" \n AND major_yn = true\n ) as \"major_items_count\", (\n SELECT COUNT(*) \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"comment_count\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_comment_date\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\" AND is_vendor_comment = true\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_vendor_comment_date\", (\n SELECT COUNT(*) \n FROM procurement_rfq_attachments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) > 0\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"has_quotation\", (\n SELECT status\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_status\", (\n SELECT total_price\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_total_price\", (\n SELECT quotation_version\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"quotation_version\", (\n SELECT COUNT(DISTINCT quotation_version)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"quotation_version_count\", (\n SELECT created_at\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"last_quotation_date\" from \"procurement_rfq_details\" \"rfq_details\" left join \"procurement_rfqs\" \"rfqs\" on \"rfq_details\".\"procurement_rfqs_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"rfq_details\".\"vendors_id\" = \"vendors\".\"id\" left join \"payment_terms\" on \"rfq_details\".\"payment_terms_code\" = \"payment_terms\".\"code\" left join \"incoterms\" on \"rfq_details\".\"incoterms_code\" = \"incoterms\".\"code\" left join \"users\" \"updated_by_user\" on \"rfq_details\".\"updated_by\" = \"updated_by_user\".\"id\"", + "name": "procurement_rfq_details_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfqs_view": { + "columns": {}, + "definition": "select \"procurement_rfqs\".\"id\" as \"id\", \"procurement_rfqs\".\"rfq_code\" as \"rfq_code\", \"procurement_rfqs\".\"series\" as \"series\", \"procurement_rfqs\".\"rfq_sealed_yn\" as \"rfq_sealed_yn\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"procurement_rfqs\".\"item_code\" as \"item_code\", \"procurement_rfqs\".\"item_name\" as \"item_name\", \"procurement_rfqs\".\"status\" as \"status\", \"procurement_rfqs\".\"pic_code\" as \"pic_code\", \"procurement_rfqs\".\"rfq_send_date\" as \"rfq_send_date\", \"procurement_rfqs\".\"due_date\" as \"due_date\", (\n SELECT MIN(submitted_at)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"procurement_rfqs\".\"id\"\n AND submitted_at IS NOT NULL\n ) as \"earliest_quotation_submitted_at\", \"created_by_user\".\"name\" as \"created_by_user_name\", \"sent_by_user\".\"name\" as \"sent_by_user_name\", \"procurement_rfqs\".\"updated_at\" as \"updated_at\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"procurement_rfqs\".\"remark\" as \"remark\", (\n SELECT material_code \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"major_item_material_code\", (\n SELECT pr_no \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"po_no\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n ) as \"pr_items_count\" from \"procurement_rfqs\" left join \"projects\" on \"procurement_rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" \"created_by_user\" on \"procurement_rfqs\".\"created_by\" = \"created_by_user\".\"id\" left join \"users\" \"updated_by_user\" on \"procurement_rfqs\".\"updated_by\" = \"updated_by_user\".\"id\" left join \"users\" \"sent_by_user\" on \"procurement_rfqs\".\"sent_by\" = \"sent_by_user\".\"id\"", + "name": "procurement_rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + } + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db/migrations/meta/0123_snapshot.json b/db/migrations/meta/0123_snapshot.json new file mode 100644 index 00000000..e30e8cfb --- /dev/null +++ b/db/migrations/meta/0123_snapshot.json @@ -0,0 +1,13916 @@ +{ + "id": "4e3ea5b3-eaa4-40c1-b094-324c337290be", + "prevId": "a7e35d21-e0a2-49df-bca5-cf0e60388c45", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.companies": { + "name": "companies", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "companies_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "taxID": { + "name": "taxID", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_envelopes": { + "name": "contract_envelopes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_envelopes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "envelope_id": { + "name": "envelope_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": true + }, + "document_id": { + "name": "document_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": false + }, + "envelope_status": { + "name": "envelope_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_envelopes_contract_id_contracts_id_fk": { + "name": "contract_envelopes_contract_id_contracts_id_fk", + "tableFrom": "contract_envelopes", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_items": { + "name": "contract_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_items_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_id": { + "name": "item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "unit_price": { + "name": "unit_price", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "total_line_amount": { + "name": "total_line_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_items_contract_item_idx": { + "name": "contract_items_contract_item_idx", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "contract_items_contract_id_contracts_id_fk": { + "name": "contract_items_contract_id_contracts_id_fk", + "tableFrom": "contract_items", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_items_item_id_items_id_fk": { + "name": "contract_items_item_id_items_id_fk", + "tableFrom": "contract_items", + "tableTo": "items", + "columnsFrom": [ + "item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_items_contract_id_item_id_unique": { + "name": "contract_items_contract_id_item_id_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_id", + "item_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_signers": { + "name": "contract_signers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_signers_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "envelope_id": { + "name": "envelope_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_contact_id": { + "name": "vendor_contact_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "signer_type": { + "name": "signer_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'VENDOR'" + }, + "signer_email": { + "name": "signer_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "signer_name": { + "name": "signer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "signer_position": { + "name": "signer_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "signer_status": { + "name": "signer_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "signed_at": { + "name": "signed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_signers_envelope_id_contract_envelopes_id_fk": { + "name": "contract_signers_envelope_id_contract_envelopes_id_fk", + "tableFrom": "contract_signers", + "tableTo": "contract_envelopes", + "columnsFrom": [ + "envelope_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_signers_vendor_contact_id_vendor_contacts_id_fk": { + "name": "contract_signers_vendor_contact_id_vendor_contacts_id_fk", + "tableFrom": "contract_signers", + "tableTo": "vendor_contacts", + "columnsFrom": [ + "vendor_contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contracts": { + "name": "contracts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contracts_project_id_projects_id_fk": { + "name": "contracts_project_id_projects_id_fk", + "tableFrom": "contracts", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contracts_vendor_id_vendors_id_fk": { + "name": "contracts_vendor_id_vendors_id_fk", + "tableFrom": "contracts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contracts_contract_no_unique": { + "name": "contracts_contract_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.poa": { + "name": "poa", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "original_contract_no": { + "name": "original_contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "original_contract_name": { + "name": "original_contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_status": { + "name": "original_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "poa_original_contract_no_contracts_contract_no_fk": { + "name": "poa_original_contract_no_contracts_contract_no_fk", + "tableFrom": "poa", + "tableTo": "contracts", + "columnsFrom": [ + "original_contract_no" + ], + "columnsTo": [ + "contract_no" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_project_id_projects_id_fk": { + "name": "poa_project_id_projects_id_fk", + "tableFrom": "poa", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_vendor_id_vendors_id_fk": { + "name": "poa_vendor_id_vendors_id_fk", + "tableFrom": "poa", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_hull": { + "name": "item_offshore_hull", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_hull_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_hull_item_code_items_item_code_fk": { + "name": "item_offshore_hull_item_code_items_item_code_fk", + "tableFrom": "item_offshore_hull", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_top": { + "name": "item_offshore_top", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_top_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_top_item_code_items_item_code_fk": { + "name": "item_offshore_top_item_code_items_item_code_fk", + "tableFrom": "item_offshore_top", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_shipbuilding": { + "name": "item_shipbuilding", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ship_types": { + "name": "ship_types", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'OPTION'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_shipbuilding_item_code_items_item_code_fk": { + "name": "item_shipbuilding_item_code_items_item_code_fk", + "tableFrom": "item_shipbuilding", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.items": { + "name": "items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_no": { + "name": "project_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "package_code": { + "name": "package_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "sm_code": { + "name": "sm_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "items_item_code_unique": { + "name": "items_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.materials": { + "name": "materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "materials_item_code_unique": { + "name": "materials_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias": { + "name": "pq_criterias", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "check_point": { + "name": "check_point", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "group_name": { + "name": "group_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias_extension": { + "name": "pq_criterias_extension", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_criteria_id": { + "name": "pq_criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_info": { + "name": "contract_info", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "additional_requirement": { + "name": "additional_requirement", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk": { + "name": "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "pq_criterias", + "columnsFrom": [ + "pq_criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "pq_criterias_extension_project_id_projects_id_fk": { + "name": "pq_criterias_extension_project_id_projects_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_criteria_attachments": { + "name": "vendor_criteria_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_criteria_answer_id": { + "name": "vendor_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_criteria_attachments", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigation_attachments": { + "name": "vendor_investigation_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "investigation_id": { + "name": "investigation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'REPORT'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { + "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", + "tableFrom": "vendor_investigation_attachments", + "tableTo": "vendor_investigations", + "columnsFrom": [ + "investigation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigations": { + "name": "vendor_investigations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigations_vendor_id_vendors_id_fk": { + "name": "vendor_investigations_vendor_id_vendors_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk": { + "name": "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendor_pq_submissions", + "columnsFrom": [ + "pq_submission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "vendor_investigations_requester_id_users_id_fk": { + "name": "vendor_investigations_requester_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_qm_manager_id_users_id_fk": { + "name": "vendor_investigations_qm_manager_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "qm_manager_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_submissions": { + "name": "vendor_pq_submissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_number": { + "name": "pq_number", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_pq_submission": { + "name": "unique_pq_submission", + "columns": [ + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_pq_submissions_requester_id_users_id_fk": { + "name": "vendor_pq_submissions_requester_id_users_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_pq_submissions_vendor_id_vendors_id_fk": { + "name": "vendor_pq_submissions_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_submissions_project_id_projects_id_fk": { + "name": "vendor_pq_submissions_project_id_projects_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_pq_submissions_pq_number_unique": { + "name": "vendor_pq_submissions_pq_number_unique", + "nullsNotDistinct": false, + "columns": [ + "pq_number" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_criteria_answers": { + "name": "vendor_pq_criteria_answers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "criteria_id": { + "name": "criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "answer": { + "name": "answer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_criteria_answers_vendor_id_vendors_id_fk": { + "name": "vendor_pq_criteria_answers_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": { + "name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "pq_criterias", + "columnsFrom": [ + "criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_project_id_projects_id_fk": { + "name": "vendor_pq_criteria_answers_project_id_projects_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_review_logs": { + "name": "vendor_pq_review_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_pq_criteria_answer_id": { + "name": "vendor_pq_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "reviewer_comment": { + "name": "reviewer_comment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_pq_review_logs", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_pq_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_project_pqs": { + "name": "vendor_project_pqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_project_pqs_vendor_id_vendors_id_fk": { + "name": "vendor_project_pqs_vendor_id_vendors_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_project_pqs_project_id_projects_id_fk": { + "name": "vendor_project_pqs_project_id_projects_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bidding_projects": { + "name": "bidding_projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "proj_nm": { + "name": "proj_nm", + "type": "varchar(90)", + "primaryKey": false, + "notNull": false + }, + "sector": { + "name": "sector", + "type": "char(1)", + "primaryKey": false, + "notNull": false + }, + "proj_msrm": { + "name": "proj_msrm", + "type": "numeric(3, 0)", + "primaryKey": false, + "notNull": false + }, + "kunnr": { + "name": "kunnr", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "kunnr_nm": { + "name": "kunnr_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "cls_1": { + "name": "cls_1", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "cls1_nm": { + "name": "cls1_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "ptype": { + "name": "ptype", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "ptype_nm": { + "name": "ptype_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_cd": { + "name": "pmodel_cd", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "pmodel_nm": { + "name": "pmodel_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_sz": { + "name": "pmodel_sz", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "pmodel_uom": { + "name": "pmodel_uom", + "type": "char(5)", + "primaryKey": false, + "notNull": false + }, + "txt04": { + "name": "txt04", + "type": "char(4)", + "primaryKey": false, + "notNull": false + }, + "txt30": { + "name": "txt30", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "estm_pm": { + "name": "estm_pm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "bidding_projects_pspid_unique": { + "name": "bidding_projects_pspid_unique", + "nullsNotDistinct": false, + "columns": [ + "pspid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_series": { + "name": "project_series", + "schema": "", + "columns": { + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "sers_no": { + "name": "sers_no", + "type": "char(3)", + "primaryKey": false, + "notNull": true + }, + "sc_dt": { + "name": "sc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "kl_dt": { + "name": "kl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "lc_dt": { + "name": "lc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dl_dt": { + "name": "dl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dock_no": { + "name": "dock_no", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "dock_nm": { + "name": "dock_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "proj_no": { + "name": "proj_no", + "type": "char(24)", + "primaryKey": false, + "notNull": false + }, + "post1": { + "name": "post1", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "project_sersNo_unique": { + "name": "project_sersNo_unique", + "columns": [ + { + "expression": "pspid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sers_no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "project_series_pspid_bidding_projects_pspid_fk": { + "name": "project_series_pspid_bidding_projects_pspid_fk", + "tableFrom": "project_series", + "tableTo": "bidding_projects", + "columnsFrom": [ + "pspid" + ], + "columnsTo": [ + "pspid" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projects": { + "name": "projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cbe_evaluations": { + "name": "cbe_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluated_by": { + "name": "evaluated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluated_at": { + "name": "evaluated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "result": { + "name": "result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "total_cost": { + "name": "total_cost", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_schedule": { + "name": "delivery_schedule", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "cbe_evaluations_rfq_id_rfqs_id_fk": { + "name": "cbe_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_vendor_id_vendors_id_fk": { + "name": "cbe_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_evaluated_by_users_id_fk": { + "name": "cbe_evaluations_evaluated_by_users_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "users", + "columnsFrom": [ + "evaluated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_attachments": { + "name": "rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_attachments_rfq_id_rfqs_id_fk": { + "name": "rfq_attachments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_vendor_id_vendors_id_fk": { + "name": "rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_attachments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_cbe_id_cbe_evaluations_id_fk": { + "name": "rfq_attachments_cbe_id_cbe_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "cbe_evaluations", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_comment_id_rfq_comments_id_fk": { + "name": "rfq_attachments_comment_id_rfq_comments_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_comments": { + "name": "rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "comment_text": { + "name": "comment_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "commented_by": { + "name": "commented_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_comments_rfq_id_rfqs_id_fk": { + "name": "rfq_comments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_vendor_id_vendors_id_fk": { + "name": "rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_commented_by_users_id_fk": { + "name": "rfq_comments_commented_by_users_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "commented_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_comments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_cbe_id_vendor_responses_id_fk": { + "name": "rfq_comments_cbe_id_vendor_responses_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_evaluations": { + "name": "rfq_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "eval_type": { + "name": "eval_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "result": { + "name": "result", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_evaluations_rfq_id_rfqs_id_fk": { + "name": "rfq_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_evaluations_vendor_id_vendors_id_fk": { + "name": "rfq_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_items": { + "name": "rfq_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_items_rfq_id_rfqs_id_fk": { + "name": "rfq_items_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_items", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "rfq_items_item_code_items_item_code_fk": { + "name": "rfq_items_item_code_items_item_code_fk", + "tableFrom": "rfq_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfqs": { + "name": "rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "bid_project_id": { + "name": "bid_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false, + "default": "'PURCHASE'" + }, + "parent_rfq_id": { + "name": "parent_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfqs_project_id_projects_id_fk": { + "name": "rfqs_project_id_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_bid_project_id_bidding_projects_id_fk": { + "name": "rfqs_bid_project_id_bidding_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bid_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_created_by_users_id_fk": { + "name": "rfqs_created_by_users_id_fk", + "tableFrom": "rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_parent_rfq_id_rfqs_id_fk": { + "name": "rfqs_parent_rfq_id_rfqs_id_fk", + "tableFrom": "rfqs", + "tableTo": "rfqs", + "columnsFrom": [ + "parent_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "rfqs_rfq_code_unique": { + "name": "rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_commercial_responses": { + "name": "vendor_commercial_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "total_price": { + "name": "total_price", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_period": { + "name": "delivery_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "warranty_period": { + "name": "warranty_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "validity_period": { + "name": "validity_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "price_breakdown": { + "name": "price_breakdown", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "commercial_notes": { + "name": "commercial_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_commercial_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_commercial_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_commercial_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_attachments": { + "name": "vendor_response_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "technical_response_id": { + "name": "technical_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "commercial_response_id": { + "name": "commercial_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_attachments_response_id_vendor_responses_id_fk": { + "name": "vendor_response_attachments_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk": { + "name": "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_technical_responses", + "columnsFrom": [ + "technical_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk": { + "name": "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_commercial_responses", + "columnsFrom": [ + "commercial_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_responses": { + "name": "vendor_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'REVIEWING'" + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "responded_by": { + "name": "responded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "responded_at": { + "name": "responded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "vendor_response_unique": { + "name": "vendor_response_unique", + "columns": [ + { + "expression": "rfq_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_responses_rfq_id_rfqs_id_fk": { + "name": "vendor_responses_rfq_id_rfqs_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_responses_vendor_id_vendors_id_fk": { + "name": "vendor_responses_vendor_id_vendors_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_technical_responses": { + "name": "vendor_technical_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_technical_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_technical_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_technical_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.otps": { + "name": "otps", + "schema": "", + "columns": { + "email": { + "name": "email", + "type": "varchar(256)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(6)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "otpToken": { + "name": "otpToken", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "otp_expires": { + "name": "otp_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permissions": { + "name": "permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "permissions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "permission_key": { + "name": "permission_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.role_permissions": { + "name": "role_permissions", + "schema": "", + "columns": { + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "permission_id": { + "name": "permission_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "role_permissions_role_id_roles_id_fk": { + "name": "role_permissions_role_id_roles_id_fk", + "tableFrom": "role_permissions", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "role_permissions_permission_id_permissions_id_fk": { + "name": "role_permissions_permission_id_permissions_id_fk", + "tableFrom": "role_permissions", + "tableTo": "permissions", + "columnsFrom": [ + "permission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.roles": { + "name": "roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "roles_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "roles_company_id_vendors_id_fk": { + "name": "roles_company_id_vendors_id_fk", + "tableFrom": "roles", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_roles": { + "name": "user_roles", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_roles_user_id_users_id_fk": { + "name": "user_roles_user_id_users_id_fk", + "tableFrom": "user_roles", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_roles_role_id_roles_id_fk": { + "name": "user_roles_role_id_roles_id_fk", + "tableFrom": "user_roles", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "users_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'partners'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "image_url": { + "name": "image_url", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "language": { + "name": "language", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'en'" + } + }, + "indexes": {}, + "foreignKeys": { + "users_company_id_vendors_id_fk": { + "name": "users_company_id_vendors_id_fk", + "tableFrom": "users", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_entries": { + "name": "form_entries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_entries_contract_item_id_contract_items_id_fk": { + "name": "form_entries_contract_item_id_contract_items_id_fk", + "tableFrom": "form_entries", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_metas": { + "name": "form_metas", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "columns": { + "name": "columns", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_metas_project_id_projects_id_fk": { + "name": "form_metas_project_id_projects_id_fk", + "tableFrom": "form_metas", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "form_code_project_unique": { + "name": "form_code_project_unique", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.forms": { + "name": "forms", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "forms_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "eng": { + "name": "eng", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "im": { + "name": "im", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_item_form_code_unique": { + "name": "contract_item_form_code_unique", + "columns": [ + { + "expression": "contract_item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "form_code", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "forms_contract_item_id_contract_items_id_fk": { + "name": "forms_contract_item_id_contract_items_id_fk", + "tableFrom": "forms", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_class_attributes": { + "name": "tag_class_attributes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_class_attributes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "tag_class_id": { + "name": "tag_class_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "att_id": { + "name": "att_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "def_val": { + "name": "def_val", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uom_id": { + "name": "uom_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "seq": { + "name": "seq", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "tag_class_attributes_seq_idx": { + "name": "tag_class_attributes_seq_idx", + "columns": [ + { + "expression": "seq", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "tag_class_attributes_tag_class_id_tag_classes_id_fk": { + "name": "tag_class_attributes_tag_class_id_tag_classes_id_fk", + "tableFrom": "tag_class_attributes", + "tableTo": "tag_classes", + "columnsFrom": [ + "tag_class_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_att_id_in_tag_class": { + "name": "uniq_att_id_in_tag_class", + "nullsNotDistinct": false, + "columns": [ + "tag_class_id", + "att_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_classes": { + "name": "tag_classes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_classes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_classes_project_id_projects_id_fk": { + "name": "tag_classes_project_id_projects_id_fk", + "tableFrom": "tag_classes", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk": { + "name": "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk", + "tableFrom": "tag_classes", + "tableTo": "tag_types", + "columnsFrom": [ + "tag_type_code", + "project_id" + ], + "columnsTo": [ + "code", + "project_id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_code_in_project": { + "name": "uniq_code_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfield_options": { + "name": "tag_subfield_options", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfield_options_project_id_projects_id_fk": { + "name": "tag_subfield_options_project_id_projects_id_fk", + "tableFrom": "tag_subfield_options", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_attribute_project_code": { + "name": "uniq_attribute_project_code", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "attributes_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfields": { + "name": "tag_subfields", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfields_project_id_projects_id_fk": { + "name": "tag_subfields_project_id_projects_id_fk", + "tableFrom": "tag_subfields", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_tag_type_attribute": { + "name": "uniq_tag_type_attribute", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_code", + "attributes_id" + ] + }, + "uniq_attribute_id_project": { + "name": "uniq_attribute_id_project", + "nullsNotDistinct": false, + "columns": [ + "attributes_id", + "project_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_type_class_form_mappings": { + "name": "tag_type_class_form_mappings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_label": { + "name": "tag_type_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "class_label": { + "name": "class_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "ep": { + "name": "ep", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_mapping_in_project": { + "name": "uniq_mapping_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_label", + "class_label", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_types": { + "name": "tag_types", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_types_project_id_projects_id_fk": { + "name": "tag_types_project_id_projects_id_fk", + "tableFrom": "tag_types", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "tag_types_code_project_id_pk": { + "name": "tag_types_code_project_id_pk", + "columns": [ + "code", + "project_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tags": { + "name": "tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tags_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "tag_type": { + "name": "tag_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "class": { + "name": "class", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tags_contract_item_id_contract_items_id_fk": { + "name": "tags_contract_item_id_contract_items_id_fk", + "tableFrom": "tags", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_form_id_forms_id_fk": { + "name": "tags_form_id_forms_id_fk", + "tableFrom": "tags", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_item_tag_no_unique": { + "name": "contract_item_tag_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_item_id", + "tag_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_data_report_temps": { + "name": "vendor_data_report_temps", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_data_report_temps_contract_item_id_contract_items_id_fk": { + "name": "vendor_data_report_temps_contract_item_id_contract_items_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_data_report_temps_form_id_forms_id_fk": { + "name": "vendor_data_report_temps_form_id_forms_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.change_logs": { + "name": "change_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "changed_fields": { + "name": "changed_fields", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "old_values": { + "name": "old_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "new_values": { + "name": "new_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_name": { + "name": "user_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_synced": { + "name": "is_synced", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "sync_attempts": { + "name": "sync_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_sync_error": { + "name": "last_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "synced_at": { + "name": "synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "target_systems": { + "name": "target_systems", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + } + }, + "indexes": { + "idx_change_logs_contract_synced": { + "name": "idx_change_logs_contract_synced", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_synced", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_created_at": { + "name": "idx_change_logs_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_entity": { + "name": "idx_change_logs_entity", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_sync_attempts": { + "name": "idx_change_logs_sync_attempts", + "columns": [ + { + "expression": "sync_attempts", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.document_attachments": { + "name": "document_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "document_attachments_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "revision_id": { + "name": "revision_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "upload_id": { + "name": "upload_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "file_id": { + "name": "file_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "dolce_file_path": { + "name": "dolce_file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "document_attachments_revision_id_revisions_id_fk": { + "name": "document_attachments_revision_id_revisions_id_fk", + "tableFrom": "document_attachments", + "tableTo": "revisions", + "columnsFrom": [ + "revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.documents": { + "name": "documents", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "documents_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "drawing_move_gbn": { + "name": "drawing_move_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "discipline": { + "name": "discipline", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "external_document_id": { + "name": "external_document_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "external_system_type": { + "name": "external_system_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "external_synced_at": { + "name": "external_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "shi_drawing_no": { + "name": "shi_drawing_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager": { + "name": "manager", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_enm": { + "name": "manager_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_no": { + "name": "manager_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "register_group": { + "name": "register_group", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "register_group_id": { + "name": "register_group_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "create_user_no": { + "name": "create_user_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "create_user_id": { + "name": "create_user_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "create_user_enm": { + "name": "create_user_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_contract_doc_status": { + "name": "unique_contract_doc_status", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_contract_vendor_doc": { + "name": "unique_contract_vendor_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"vendor_doc_number\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_external_doc": { + "name": "unique_external_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_system_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"external_document_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "drawing_kind_idx": { + "name": "drawing_kind_idx", + "columns": [ + { + "expression": "drawing_kind", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "documents_contract_id_contracts_id_fk": { + "name": "documents_contract_id_contracts_id_fk", + "tableFrom": "documents", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.issue_stages": { + "name": "issue_stages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "issue_stages_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_name": { + "name": "stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "plan_date": { + "name": "plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "actual_date": { + "name": "actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "stage_status": { + "name": "stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "stage_order": { + "name": "stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "priority": { + "name": "priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'MEDIUM'" + }, + "assignee_id": { + "name": "assignee_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "assignee_name": { + "name": "assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "reminder_days": { + "name": "reminder_days", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_document_stage": { + "name": "unique_document_stage", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_stage_order": { + "name": "document_stage_order", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "issue_stages_document_id_documents_id_fk": { + "name": "issue_stages_document_id_documents_id_fk", + "tableFrom": "issue_stages", + "tableTo": "documents", + "columnsFrom": [ + "document_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.revisions": { + "name": "revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "revisions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "issue_stage_id": { + "name": "issue_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "revision": { + "name": "revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "uploader_type": { + "name": "uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'vendor'" + }, + "uploader_id": { + "name": "uploader_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploader_name": { + "name": "uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "usage": { + "name": "usage", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "revision_status": { + "name": "revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'SUBMITTED'" + }, + "submitted_date": { + "name": "submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "review_start_date": { + "name": "review_start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "approved_date": { + "name": "approved_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "rejected_date": { + "name": "rejected_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "reviewer_id": { + "name": "reviewer_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "review_comments": { + "name": "review_comments", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "external_upload_id": { + "name": "external_upload_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_stage_rev": { + "name": "unique_stage_rev", + "columns": [ + { + "expression": "issue_stage_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "revision", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_batches": { + "name": "sync_batches", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "batch_size": { + "name": "batch_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "retry_count": { + "name": "retry_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "change_log_ids": { + "name": "change_log_ids", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "success_count": { + "name": "success_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "failure_count": { + "name": "failure_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sync_metadata": { + "name": "sync_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_batches_contract_system": { + "name": "idx_sync_batches_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_status": { + "name": "idx_sync_batches_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_created_at": { + "name": "idx_sync_batches_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_configs": { + "name": "sync_configs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "sync_interval_minutes": { + "name": "sync_interval_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 30 + }, + "last_successful_sync": { + "name": "last_successful_sync", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_sync_attempt": { + "name": "last_sync_attempt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "endpoint_url": { + "name": "endpoint_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "auth_token": { + "name": "auth_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "api_version": { + "name": "api_version", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'v1'" + }, + "max_batch_size": { + "name": "max_batch_size", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 100 + }, + "retry_max_attempts": { + "name": "retry_max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_configs_contract_system": { + "name": "idx_sync_configs_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sync_configs_contract_id_contracts_id_fk": { + "name": "sync_configs_contract_id_contracts_id_fk", + "tableFrom": "sync_configs", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_attachments": { + "name": "vendor_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'GENERAL'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_attachments_vendor_id_vendors_id_fk": { + "name": "vendor_attachments_vendor_id_vendors_id_fk", + "tableFrom": "vendor_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidates": { + "name": "vendor_candidates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidates_vendor_id_vendors_id_fk": { + "name": "vendor_candidates_vendor_id_vendors_id_fk", + "tableFrom": "vendor_candidates", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_contacts": { + "name": "vendor_contacts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contact_name": { + "name": "contact_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_position": { + "name": "contact_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "is_primary": { + "name": "is_primary", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_contacts_vendor_id_vendors_id_fk": { + "name": "vendor_contacts_vendor_id_vendors_id_fk", + "tableFrom": "vendor_contacts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_items": { + "name": "vendor_possible_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_items_vendor_id_vendors_id_fk": { + "name": "vendor_possible_items_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_items_item_code_items_item_code_fk": { + "name": "vendor_possible_items_item_code_items_item_code_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_materials": { + "name": "vendor_possible_materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_materials_vendor_id_vendors_id_fk": { + "name": "vendor_possible_materials_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_materials_item_code_materials_item_code_fk": { + "name": "vendor_possible_materials_item_code_materials_item_code_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "materials", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_types": { + "name": "vendor_types", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_types_code_unique": { + "name": "vendor_types_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors": { + "name": "vendors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "vendor_type_id": { + "name": "vendor_type_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_vendor_type_id_vendor_types_id_fk": { + "name": "vendors_vendor_type_id_vendor_types_id_fk", + "tableFrom": "vendors", + "tableTo": "vendor_types", + "columnsFrom": [ + "vendor_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tasks": { + "name": "tasks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'todo'" + }, + "label": { + "name": "label", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'bug'" + }, + "priority": { + "name": "priority", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'low'" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "current_timestamp" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tasks_code_unique": { + "name": "tasks_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidate_logs": { + "name": "vendor_candidate_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_candidate_id": { + "name": "vendor_candidate_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk": { + "name": "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "vendor_candidates", + "columnsFrom": [ + "vendor_candidate_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_candidate_logs_user_id_users_id_fk": { + "name": "vendor_candidate_logs_user_id_users_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors_logs": { + "name": "vendors_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_logs_vendor_id_vendors_id_fk": { + "name": "vendors_logs_vendor_id_vendors_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendors_logs_user_id_users_id_fk": { + "name": "vendors_logs_user_id_users_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract": { + "name": "basic_contract", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_id": { + "name": "template_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requested_by": { + "name": "requested_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "basic_contract_template_id_basic_contract_templates_id_fk": { + "name": "basic_contract_template_id_basic_contract_templates_id_fk", + "tableFrom": "basic_contract", + "tableTo": "basic_contract_templates", + "columnsFrom": [ + "template_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_vendor_id_vendors_id_fk": { + "name": "basic_contract_vendor_id_vendors_id_fk", + "tableFrom": "basic_contract", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_requested_by_users_id_fk": { + "name": "basic_contract_requested_by_users_id_fk", + "tableFrom": "basic_contract", + "tableTo": "users", + "columnsFrom": [ + "requested_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract_templates": { + "name": "basic_contract_templates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_templates_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_name": { + "name": "template_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "validity_period": { + "name": "validity_period", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.incoterms": { + "name": "incoterms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(20)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "incoterms_created_by_users_id_fk": { + "name": "incoterms_created_by_users_id_fk", + "tableFrom": "incoterms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payment_terms": { + "name": "payment_terms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "payment_terms_created_by_users_id_fk": { + "name": "payment_terms_created_by_users_id_fk", + "tableFrom": "payment_terms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pr_items": { + "name": "pr_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "pr_items", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_attachments": { + "name": "procurement_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "procurement_rfq_details_id": { + "name": "procurement_rfq_details_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk": { + "name": "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfq_details", + "columnsFrom": [ + "procurement_rfq_details_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_created_by_users_id_fk": { + "name": "procurement_attachments_created_by_users_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "attachment_type_check": { + "name": "attachment_type_check", + "value": "\"procurement_attachments\".\"procurement_rfqs_id\" IS NOT NULL OR \"procurement_attachments\".\"procurement_rfq_details_id\" IS NOT NULL" + } + }, + "isRLSEnabled": false + }, + "public.procurement_quotation_items": { + "name": "procurement_quotation_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pr_item_id": { + "name": "pr_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "material_code": { + "name": "material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "uom": { + "name": "uom", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "unit_price": { + "name": "unit_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "vendor_material_code": { + "name": "vendor_material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_material_description": { + "name": "vendor_material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "lead_time_in_days": { + "name": "lead_time_in_days", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_rate": { + "name": "discount_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_amount": { + "name": "discount_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_alternative": { + "name": "is_alternative", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_recommended": { + "name": "is_recommended", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_quotation_items_pr_item_id_pr_items_id_fk": { + "name": "procurement_quotation_items_pr_item_id_pr_items_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "pr_items", + "columnsFrom": [ + "pr_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_attachments": { + "name": "procurement_rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_uploaded_by_users_id_fk": { + "name": "procurement_rfq_attachments_uploaded_by_users_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_comments": { + "name": "procurement_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_comments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_user_id_users_id_fk": { + "name": "procurement_rfq_comments_user_id_users_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_details": { + "name": "procurement_rfq_details", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendors_id": { + "name": "vendors_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'VV'" + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_vendors_id_vendors_id_fk": { + "name": "procurement_rfq_details_vendors_id_vendors_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "vendors", + "columnsFrom": [ + "vendors_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_rfq_details_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_incoterms_code_incoterms_code_fk": { + "name": "procurement_rfq_details_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_updated_by_users_id_fk": { + "name": "procurement_rfq_details_updated_by_users_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfqs": { + "name": "procurement_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "series": { + "name": "series", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "rfq_sealed_yn": { + "name": "rfq_sealed_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfqs_project_id_projects_id_fk": { + "name": "procurement_rfqs_project_id_projects_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_sent_by_users_id_fk": { + "name": "procurement_rfqs_sent_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_created_by_users_id_fk": { + "name": "procurement_rfqs_created_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_updated_by_users_id_fk": { + "name": "procurement_rfqs_updated_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "procurement_rfqs_rfq_code_unique": { + "name": "procurement_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_vendor_quotations": { + "name": "procurement_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_items_count": { + "name": "total_items_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sub_total": { + "name": "sub_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "tax_total": { + "name": "tax_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "discount_total": { + "name": "discount_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "estimated_delivery_date": { + "name": "estimated_delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "procurement_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_incoterms_code_incoterms_code_fk": { + "name": "procurement_vendor_quotations_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.preset_shares": { + "name": "preset_shares", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "preset_id": { + "name": "preset_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "shared_with_user_id": { + "name": "shared_with_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'read'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "preset_shares_preset_id_table_presets_id_fk": { + "name": "preset_shares_preset_id_table_presets_id_fk", + "tableFrom": "preset_shares", + "tableTo": "table_presets", + "columnsFrom": [ + "preset_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_presets": { + "name": "table_presets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_shared": { + "name": "is_shared", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_attachments": { + "name": "tech_sales_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "tech_sales_rfq_id": { + "name": "tech_sales_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "tech_sales_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_attachments_created_by_users_id_fk": { + "name": "tech_sales_attachments_created_by_users_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comment_attachments": { + "name": "tech_sales_rfq_comment_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk": { + "name": "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk": { + "name": "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comments": { + "name": "tech_sales_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_user_id_users_id_fk": { + "name": "tech_sales_rfq_comments_user_id_users_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfqs": { + "name": "tech_sales_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_shipbuilding_id": { + "name": "item_shipbuilding_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "bidding_project_id": { + "name": "bidding_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_snapshot": { + "name": "project_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "series_snapshot": { + "name": "series_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk": { + "name": "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "item_shipbuilding", + "columnsFrom": [ + "item_shipbuilding_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk": { + "name": "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bidding_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_sent_by_users_id_fk": { + "name": "tech_sales_rfqs_sent_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_created_by_users_id_fk": { + "name": "tech_sales_rfqs_created_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_updated_by_users_id_fk": { + "name": "tech_sales_rfqs_updated_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tech_sales_rfqs_rfq_code_unique": { + "name": "tech_sales_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_vendor_quotations": { + "name": "tech_sales_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "tech_sales_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rotation_attempts": { + "name": "ocr_rotation_attempts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "rotation": { + "name": "rotation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "tables_found": { + "name": "tables_found", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "text_quality": { + "name": "text_quality", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "keyword_count": { + "name": "keyword_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "score": { + "name": "score", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "extracted_rows_count": { + "name": "extracted_rows_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_rotation_attempts_session_id_ocr_sessions_id_fk": { + "name": "ocr_rotation_attempts_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rotation_attempts", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rows": { + "name": "ocr_rows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "table_id": { + "name": "table_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "row_index": { + "name": "row_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "report_no": { + "name": "report_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "no": { + "name": "no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "identification_no": { + "name": "identification_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_no": { + "name": "joint_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_type": { + "name": "joint_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "welding_date": { + "name": "welding_date", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "source_table": { + "name": "source_table", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "source_row": { + "name": "source_row", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_ocr_report_no_unique": { + "name": "idx_ocr_report_no_unique", + "columns": [ + { + "expression": "report_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "tag_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "joint_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "joint_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "ocr_rows_table_id_ocr_tables_id_fk": { + "name": "ocr_rows_table_id_ocr_tables_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_tables", + "columnsFrom": [ + "table_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_session_id_ocr_sessions_id_fk": { + "name": "ocr_rows_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_user_id_users_id_fk": { + "name": "ocr_rows_user_id_users_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_sessions": { + "name": "ocr_sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "processing_time": { + "name": "processing_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "best_rotation": { + "name": "best_rotation", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_tables": { + "name": "total_tables", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_rows": { + "name": "total_rows", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "image_enhanced": { + "name": "image_enhanced", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pdf_converted": { + "name": "pdf_converted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "success": { + "name": "success", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "warnings": { + "name": "warnings", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_tables": { + "name": "ocr_tables", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "table_index": { + "name": "table_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "row_count": { + "name": "row_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_tables_session_id_ocr_sessions_id_fk": { + "name": "ocr_tables_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_tables", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.b_rfq_attachment_revisions": { + "name": "b_rfq_attachment_revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_id": { + "name": "attachment_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "revision_no": { + "name": "revision_no", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "is_latest": { + "name": "is_latest", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "revision_comment": { + "name": "revision_comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "latest_revision_idx": { + "name": "latest_revision_idx", + "columns": [ + { + "expression": "attachment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_latest", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "b_rfq_attachment_revisions_attachment_id_b_rfq_attachments_id_fk": { + "name": "b_rfq_attachment_revisions_attachment_id_b_rfq_attachments_id_fk", + "tableFrom": "b_rfq_attachment_revisions", + "tableTo": "b_rfq_attachments", + "columnsFrom": [ + "attachment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "b_rfq_attachment_revisions_created_by_users_id_fk": { + "name": "b_rfq_attachment_revisions_created_by_users_id_fk", + "tableFrom": "b_rfq_attachment_revisions", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.b_rfqs": { + "name": "b_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pic_name": { + "name": "pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "eng_pic_name": { + "name": "eng_pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_company": { + "name": "project_company", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_flag": { + "name": "project_flag", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_site": { + "name": "project_site", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "package_no": { + "name": "package_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "package_name": { + "name": "package_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "b_rfqs_project_id_projects_id_fk": { + "name": "b_rfqs_project_id_projects_id_fk", + "tableFrom": "b_rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "b_rfqs_created_by_users_id_fk": { + "name": "b_rfqs_created_by_users_id_fk", + "tableFrom": "b_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "b_rfqs_updated_by_users_id_fk": { + "name": "b_rfqs_updated_by_users_id_fk", + "tableFrom": "b_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "b_rfqs_rfq_code_unique": { + "name": "b_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.b_rfq_attachments": { + "name": "b_rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "serial_no": { + "name": "serial_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "b_rfq_attachments_rfq_id_b_rfqs_id_fk": { + "name": "b_rfq_attachments_rfq_id_b_rfqs_id_fk", + "tableFrom": "b_rfq_attachments", + "tableTo": "b_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "b_rfq_attachments_created_by_users_id_fk": { + "name": "b_rfq_attachments_created_by_users_id_fk", + "tableFrom": "b_rfq_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.final_rfq": { + "name": "final_rfq", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "final_rfq_status": { + "name": "final_rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "valid_date": { + "name": "valid_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "gtc": { + "name": "gtc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "gtc_valid_date": { + "name": "gtc_valid_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sparepart": { + "name": "sparepart", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "short_list": { + "name": "short_list", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "return_yn": { + "name": "return_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "cp_request_yn": { + "name": "cp_request_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "prject_gtc_yn": { + "name": "prject_gtc_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "return_revision": { + "name": "return_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'VV'" + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "firsttime_yn": { + "name": "firsttime_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vendor_remark": { + "name": "vendor_remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "final_rfq_rfq_id_b_rfqs_id_fk": { + "name": "final_rfq_rfq_id_b_rfqs_id_fk", + "tableFrom": "final_rfq", + "tableTo": "b_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "final_rfq_vendor_id_vendors_id_fk": { + "name": "final_rfq_vendor_id_vendors_id_fk", + "tableFrom": "final_rfq", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "final_rfq_incoterms_code_incoterms_code_fk": { + "name": "final_rfq_incoterms_code_incoterms_code_fk", + "tableFrom": "final_rfq", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "final_rfq_payment_terms_code_payment_terms_code_fk": { + "name": "final_rfq_payment_terms_code_payment_terms_code_fk", + "tableFrom": "final_rfq", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.initial_rfq": { + "name": "initial_rfq", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "initial_rfq_status": { + "name": "initial_rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "valid_date": { + "name": "valid_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "gtc": { + "name": "gtc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "gtc_valid_date": { + "name": "gtc_valid_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sparepart": { + "name": "sparepart", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "short_list": { + "name": "short_list", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "return_yn": { + "name": "return_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "cp_request_yn": { + "name": "cp_request_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "prject_gtc_yn": { + "name": "prject_gtc_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "return_revision": { + "name": "return_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "initial_rfq_rfq_id_b_rfqs_id_fk": { + "name": "initial_rfq_rfq_id_b_rfqs_id_fk", + "tableFrom": "initial_rfq", + "tableTo": "b_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "initial_rfq_vendor_id_vendors_id_fk": { + "name": "initial_rfq_vendor_id_vendors_id_fk", + "tableFrom": "initial_rfq", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "initial_rfq_incoterms_code_incoterms_code_fk": { + "name": "initial_rfq_incoterms_code_incoterms_code_fk", + "tableFrom": "initial_rfq", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_attachment_responses": { + "name": "vendor_attachment_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_id": { + "name": "attachment_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "rfq_record_id": { + "name": "rfq_record_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'NOT_RESPONDED'" + }, + "current_revision": { + "name": "current_revision", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'Rev.0'" + }, + "responded_revision": { + "name": "responded_revision", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "response_comment": { + "name": "response_comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vendor_comment": { + "name": "vendor_comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "responded_at": { + "name": "responded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "vendor_response_idx": { + "name": "vendor_response_idx", + "columns": [ + { + "expression": "attachment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "rfq_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_attachment_responses_attachment_id_b_rfq_attachments_id_fk": { + "name": "vendor_attachment_responses_attachment_id_b_rfq_attachments_id_fk", + "tableFrom": "vendor_attachment_responses", + "tableTo": "b_rfq_attachments", + "columnsFrom": [ + "attachment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_attachment_responses_vendor_id_vendors_id_fk": { + "name": "vendor_attachment_responses_vendor_id_vendors_id_fk", + "tableFrom": "vendor_attachment_responses", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_history": { + "name": "vendor_response_history", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_response_id": { + "name": "vendor_response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "previous_status": { + "name": "previous_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "action_by": { + "name": "action_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "action_at": { + "name": "action_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_history_vendor_response_id_vendor_attachment_responses_id_fk": { + "name": "vendor_response_history_vendor_response_id_vendor_attachment_responses_id_fk", + "tableFrom": "vendor_response_history", + "tableTo": "vendor_attachment_responses", + "columnsFrom": [ + "vendor_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_history_action_by_users_id_fk": { + "name": "vendor_response_history_action_by_users_id_fk", + "tableFrom": "vendor_response_history", + "tableTo": "users", + "columnsFrom": [ + "action_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.offshore_hull_work_type": { + "name": "offshore_hull_work_type", + "schema": "public", + "values": [ + "HA", + "HE", + "HH", + "HM", + "NC" + ] + }, + "public.offshore_top_work_type": { + "name": "offshore_top_work_type", + "schema": "public", + "values": [ + "TM", + "TS", + "TE", + "TP" + ] + }, + "public.work_type": { + "name": "work_type", + "schema": "public", + "values": [ + "기장", + "전장", + "선실", + "배관", + "철의" + ] + }, + "public.user_domain": { + "name": "user_domain", + "schema": "public", + "values": [ + "evcp", + "partners" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": { + "public.contracts_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"contracts\".\"id\", \"contracts\".\"contract_no\", \"contracts\".\"contract_name\", \"contracts\".\"status\", \"contracts\".\"start_date\", \"contracts\".\"end_date\", \"contracts\".\"project_id\", \"projects\".\"code\", \"projects\".\"name\", \"contracts\".\"vendor_id\", \"vendors\".\"vendor_name\", \"contracts\".\"payment_terms\", \"contracts\".\"delivery_terms\", \"contracts\".\"delivery_date\", \"contracts\".\"delivery_location\", \"contracts\".\"currency\", \"contracts\".\"total_amount\", \"contracts\".\"discount\", \"contracts\".\"tax\", \"contracts\".\"shipping_fee\", \"contracts\".\"net_total\", \"contracts\".\"partial_shipping_allowed\", \"contracts\".\"partial_payment_allowed\", \"contracts\".\"remarks\", \"contracts\".\"version\", \"contracts\".\"created_at\", \"contracts\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"contracts\".\"id\"\n ) as \"has_signature\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "contracts_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.poa_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", + "name": "poa_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.project_approved_vendors": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"status\", \"vendor_types\".\"name_ko\", \"vendor_types\".\"name_en\", \"projects\".\"code\", \"projects\".\"name\", \"projects\".\"type\", \"vendor_pq_submissions\".\"submitted_at\", \"vendor_pq_submissions\".\"approved_at\" from \"vendors\" inner join \"vendor_pq_submissions\" on \"vendor_pq_submissions\".\"vendor_id\" = \"vendors\".\"id\" inner join \"projects\" on \"vendor_pq_submissions\".\"project_id\" = \"projects\".\"id\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\" where \"vendor_pq_submissions\".\"status\" = 'APPROVED'", + "name": "project_approved_vendors", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_investigations_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"vendor_id\", \"vendor_investigations\".\"pq_submission_id\", \"vendor_investigations\".\"requester_id\", \"vendor_investigations\".\"qm_manager_id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"evaluation_type\", \"vendor_investigations\".\"investigation_address\", \"vendor_investigations\".\"investigation_method\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"forecasted_at\", \"vendor_investigations\".\"requested_at\", \"vendor_investigations\".\"confirmed_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"evaluation_score\", \"vendor_investigations\".\"evaluation_result\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", requester.name as \"requesterName\", requester.email as \"requesterEmail\", qm_manager.name as \"qmManagerName\", qm_manager.email as \"qmManagerEmail\", (\n CASE \n WHEN EXISTS (\n SELECT 1 FROM vendor_investigation_attachments via \n WHERE via.investigation_id = \"vendor_investigations\".\"id\"\n ) \n THEN true \n ELSE false \n END\n ) as \"hasAttachments\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\" left join users AS requester on \"vendor_investigations\".\"requester_id\" = requester.id left join users AS qm_manager on \"vendor_investigations\".\"qm_manager_id\" = qm_manager.id", + "name": "vendor_investigations_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.cbe_view": { + "columns": {}, + "definition": "select \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"rfq_id\" as \"rfq_id\", \"cbe_evaluations\".\"vendor_id\" as \"vendor_id\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"result\" as \"result\", \"cbe_evaluations\".\"notes\" as \"notes\", \"cbe_evaluations\".\"evaluated_by\" as \"evaluated_by\", \"cbe_evaluations\".\"evaluated_at\" as \"evaluated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"name\" as \"evaluator_name\", \"users\".\"email\" as \"evaluator_email\" from \"cbe_evaluations\" inner join \"rfqs\" on \"cbe_evaluations\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"cbe_evaluations\".\"evaluated_by\" = \"users\".\"id\"", + "name": "cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.rfqs_view": { + "columns": {}, + "definition": "select \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"rfqs\".\"parent_rfq_id\" as \"parent_rfq_id\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"email\" as \"user_email\", \"users\".\"name\" as \"user_name\", (\n SELECT COUNT(*) \n FROM \"rfq_items\" \n WHERE \"rfq_items\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"item_count\", (\n SELECT COUNT(*) \n FROM \"rfq_attachments\" \n WHERE \"rfq_attachments\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"attachment_count\" from \"rfqs\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"rfqs\".\"created_by\" = \"users\".\"id\"", + "name": "rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_cbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", \"cbe_evaluations\".\"notes\" as \"cbe_note\", \"cbe_evaluations\".\"updated_at\" as \"cbe_updated\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"delivery_schedule\" as \"delivery_schedule\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_response_cbe_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"notes\" as \"response_notes\", \"vendor_responses\".\"responded_by\" as \"responded_by\", \"vendor_responses\".\"responded_at\" as \"responded_at\", \"vendor_responses\".\"updated_at\" as \"response_updated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"status\" as \"vendor_status\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"response_status\" as \"commercial_response_status\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"vendor_commercial_responses\".\"payment_terms\" as \"payment_terms\", \"vendor_commercial_responses\".\"incoterms\" as \"incoterms\", \"vendor_commercial_responses\".\"delivery_period\" as \"delivery_period\", \"vendor_commercial_responses\".\"warranty_period\" as \"warranty_period\", \"vendor_commercial_responses\".\"validity_period\" as \"validity_period\", \"vendor_commercial_responses\".\"price_breakdown\" as \"price_breakdown\", \"vendor_commercial_responses\".\"commercial_notes\" as \"commercial_notes\", \"vendor_commercial_responses\".\"created_at\" as \"commercial_created_at\", \"vendor_commercial_responses\".\"updated_at\" as \"commercial_updated_at\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"commercial_response_id\" = \"vendor_commercial_responses\".\"id\"\n ) as \"commercial_attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n AND \"vendor_response_attachments\".\"attachment_type\" = 'TECHNICAL_SPEC'\n ) as \"technical_attachment_count\", (\n SELECT MAX(\"uploaded_at\") \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"latest_attachment_date\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\"", + "name": "vendor_response_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_responses_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"created_at\" as \"rfq_created_at\", \"rfqs\".\"updated_at\" as \"rfq_updated_at\", \"rfqs\".\"created_by\" as \"rfq_created_by\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"responded_at\" as \"responded_at\", CASE WHEN \"vendor_technical_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_technical_response\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", CASE WHEN \"vendor_commercial_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_commercial_response\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"rfq_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE') left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"cbe_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\")", + "name": "vendor_responses_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_rfq_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", + "name": "vendor_rfq_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_tbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", \"vendor_technical_responses\".\"response_status\" as \"technical_response_status\", \"vendor_technical_responses\".\"summary\" as \"technical_summary\", \"vendor_technical_responses\".\"notes\" as \"technical_notes\", \"vendor_technical_responses\".\"updated_at\" as \"technical_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"rfq_evaluations\".\"notes\" as \"tbe_note\", \"rfq_evaluations\".\"updated_at\" as \"tbe_updated\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_tbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.role_view": { + "columns": {}, + "definition": "select \"roles\".\"id\" as \"id\", \"roles\".\"name\" as \"name\", \"roles\".\"description\" as \"description\", \"roles\".\"domain\" as \"domain\", \"roles\".\"created_at\" as \"created_at\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", COUNT(\"users\".\"id\") as \"user_count\" from \"roles\" left join \"user_roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" left join \"users\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"vendors\" on \"roles\".\"company_id\" = \"vendors\".\"id\" group by \"roles\".\"id\", \"vendors\".\"id\"", + "name": "role_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.user_view": { + "columns": {}, + "definition": "select \"users\".\"id\" as \"user_id\", \"users\".\"name\" as \"user_name\", \"users\".\"email\" as \"user_email\", \"users\".\"domain\" as \"user_domain\", \"users\".\"image_url\" as \"user_image\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"vendors\" on \"users\".\"company_id\" = \"vendors\".\"id\" left join \"user_roles\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" group by \"users\".\"id\", \"vendors\".\"id\"", + "name": "user_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.form_lists_view": { + "columns": {}, + "definition": "select \"tag_type_class_form_mappings\".\"id\" as \"id\", \"tag_type_class_form_mappings\".\"project_id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"tag_type_class_form_mappings\".\"tag_type_label\" as \"tag_type_label\", \"tag_type_class_form_mappings\".\"class_label\" as \"class_label\", \"tag_type_class_form_mappings\".\"form_code\" as \"form_code\", \"tag_type_class_form_mappings\".\"form_name\" as \"form_name\", \"tag_type_class_form_mappings\".\"ep\" as \"ep\", \"tag_type_class_form_mappings\".\"remark\" as \"remark\", \"tag_type_class_form_mappings\".\"created_at\" as \"created_at\", \"tag_type_class_form_mappings\".\"updated_at\" as \"updated_at\" from \"tag_type_class_form_mappings\" inner join \"projects\" on \"tag_type_class_form_mappings\".\"project_id\" = \"projects\".\"id\"", + "name": "form_lists_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.view_tag_subfields": { + "columns": { + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "definition": "select \"tag_subfields\".\"id\" as \"id\", \"tag_subfields\".\"tag_type_code\", \"tag_types\".\"description\", \"tag_subfields\".\"attributes_id\", \"tag_subfields\".\"attributes_description\", \"tag_subfields\".\"expression\", \"tag_subfields\".\"delimiter\", \"tag_subfields\".\"sort_order\", \"tag_subfields\".\"created_at\", \"tag_subfields\".\"updated_at\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\", \"projects\".\"name\" from \"tag_subfields\" inner join \"tag_types\" on (\"tag_subfields\".\"tag_type_code\" = \"tag_types\".\"code\" and \"tag_subfields\".\"project_id\" = \"tag_types\".\"project_id\") inner join \"projects\" on \"tag_subfields\".\"project_id\" = \"projects\".\"id\"", + "name": "view_tag_subfields", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.document_stages_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_count": { + "name": "stage_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_list": { + "name": "stage_list", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT\n d.id AS document_id,\n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n d.contract_id,\n (SELECT COUNT(*) FROM issue_stages WHERE document_id = d.id) AS stage_count,\n COALESCE( \n (SELECT json_agg(i.stage_name) FROM issue_stages i WHERE i.document_id = d.id), \n '[]'\n ) AS stage_list,\n d.created_at,\n d.updated_at\n FROM documents d\n", + "name": "document_stages_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.enhanced_documents_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_id": { + "name": "current_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_name": { + "name": "current_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_status": { + "name": "current_stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_order": { + "name": "current_stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_plan_date": { + "name": "current_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_actual_date": { + "name": "current_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_assignee_name": { + "name": "current_stage_assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_priority": { + "name": "current_stage_priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "days_until_due": { + "name": "days_until_due", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_overdue": { + "name": "is_overdue", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "days_difference": { + "name": "days_difference", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "total_stages": { + "name": "total_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "completed_stages": { + "name": "completed_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "progress_percentage": { + "name": "progress_percentage", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_status": { + "name": "latest_revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_submitted_date": { + "name": "latest_submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "all_stages": { + "name": "all_stages", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n WITH document_stats AS (\n SELECT \n d.id as document_id,\n COUNT(ist.id) as total_stages,\n COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) as completed_stages,\n CASE \n WHEN COUNT(ist.id) > 0 \n THEN ROUND((COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) * 100.0) / COUNT(ist.id))\n ELSE 0 \n END as progress_percentage\n FROM documents d\n LEFT JOIN issue_stages ist ON d.id = ist.document_id\n GROUP BY d.id\n ),\n current_stage_info AS (\n SELECT DISTINCT ON (document_id)\n document_id,\n id as current_stage_id,\n stage_name as current_stage_name,\n stage_status as current_stage_status,\n stage_order as current_stage_order,\n plan_date as current_stage_plan_date,\n actual_date as current_stage_actual_date,\n assignee_name as current_stage_assignee_name,\n priority as current_stage_priority,\n CASE \n WHEN actual_date IS NULL AND plan_date IS NOT NULL \n THEN plan_date - CURRENT_DATE\n ELSE NULL \n END as days_until_due,\n CASE \n WHEN actual_date IS NULL AND plan_date < CURRENT_DATE \n THEN true\n WHEN actual_date IS NOT NULL AND actual_date > plan_date \n THEN true\n ELSE false \n END as is_overdue,\n CASE \n WHEN actual_date IS NOT NULL AND plan_date IS NOT NULL \n THEN actual_date - plan_date\n ELSE NULL \n END as days_difference\n FROM issue_stages\n WHERE stage_status NOT IN ('COMPLETED', 'APPROVED')\n ORDER BY document_id, stage_order ASC, priority DESC\n ),\n latest_revision_info AS (\n SELECT DISTINCT ON (ist.document_id)\n ist.document_id,\n r.id as latest_revision_id,\n r.revision as latest_revision,\n r.revision_status as latest_revision_status,\n r.uploader_name as latest_revision_uploader_name,\n r.submitted_date as latest_submitted_date\n FROM revisions r\n JOIN issue_stages ist ON r.issue_stage_id = ist.id\n ORDER BY ist.document_id, r.created_at DESC\n ),\n -- 리비전별 첨부파일 집계\n revision_attachments AS (\n SELECT \n r.id as revision_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', da.id,\n 'revisionId', da.revision_id,\n 'fileName', da.file_name,\n 'filePath', da.file_path,\n 'fileSize', da.file_size,\n 'fileType', da.file_type,\n 'createdAt', da.created_at,\n 'updatedAt', da.updated_at\n ) ORDER BY da.created_at\n ) FILTER (WHERE da.id IS NOT NULL),\n '[]'::json\n ) as attachments\n FROM revisions r\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY r.id\n ),\n -- 스테이지별 리비전 집계 (첨부파일 포함)\n stage_revisions AS (\n SELECT \n ist.id as stage_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', r.id,\n 'issueStageId', r.issue_stage_id,\n 'revision', r.revision,\n 'uploaderType', r.uploader_type,\n 'uploaderId', r.uploader_id,\n 'uploaderName', r.uploader_name,\n 'comment', r.comment,\n 'usage', r.usage,\n 'revisionStatus', r.revision_status,\n 'submittedDate', r.submitted_date,\n 'uploadedAt', r.uploaded_at,\n 'approvedDate', r.approved_date,\n 'reviewStartDate', r.review_start_date,\n 'rejectedDate', r.rejected_date,\n 'reviewerId', r.reviewer_id,\n 'reviewerName', r.reviewer_name,\n 'reviewComments', r.review_comments,\n 'createdAt', r.created_at,\n 'updatedAt', r.updated_at,\n 'attachments', ra.attachments\n ) ORDER BY r.created_at\n ) FILTER (WHERE r.id IS NOT NULL),\n '[]'::json\n ) as revisions\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN revision_attachments ra ON r.id = ra.revision_id\n GROUP BY ist.id\n ),\n -- 문서별 스테이지 집계 (리비전 포함)\n stage_aggregation AS (\n SELECT \n ist.document_id,\n json_agg(\n json_build_object(\n 'id', ist.id,\n 'stageName', ist.stage_name,\n 'stageStatus', ist.stage_status,\n 'stageOrder', ist.stage_order,\n 'planDate', ist.plan_date,\n 'actualDate', ist.actual_date,\n 'assigneeName', ist.assignee_name,\n 'priority', ist.priority,\n 'revisions', sr.revisions\n ) ORDER BY ist.stage_order\n ) as all_stages\n FROM issue_stages ist\n LEFT JOIN stage_revisions sr ON ist.id = sr.stage_id\n GROUP BY ist.document_id\n ),\n attachment_counts AS (\n SELECT \n ist.document_id,\n COUNT(da.id) as attachment_count\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY ist.document_id\n )\n \n SELECT \n d.id as document_id,\n d.doc_number,\n d.drawing_kind,\n d.vendor_doc_number, -- ✅ 벤더 문서 번호 추가\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n\n d.c_gbn,\n d.d_gbn,\n d.degree_gbn,\n d.dept_gbn,\n d.s_gbn,\n\n\n \n -- ✅ 프로젝트 및 벤더 정보 추가\n p.code as project_code,\n v.vendor_name as vendor_name,\n v.vendor_code as vendor_code,\n \n -- 현재 스테이지 정보\n csi.current_stage_id,\n csi.current_stage_name,\n csi.current_stage_status,\n csi.current_stage_order,\n csi.current_stage_plan_date,\n csi.current_stage_actual_date,\n csi.current_stage_assignee_name,\n csi.current_stage_priority,\n \n -- 계산 필드\n csi.days_until_due,\n csi.is_overdue,\n csi.days_difference,\n \n -- 진행률 정보\n ds.total_stages,\n ds.completed_stages,\n ds.progress_percentage,\n \n -- 최신 리비전 정보\n lri.latest_revision_id,\n lri.latest_revision,\n lri.latest_revision_status,\n lri.latest_revision_uploader_name,\n lri.latest_submitted_date,\n \n -- 전체 스테이지 (리비전 및 첨부파일 포함)\n COALESCE(sa.all_stages, '[]'::json) as all_stages,\n \n -- 기타\n COALESCE(ac.attachment_count, 0) as attachment_count,\n d.created_at,\n d.updated_at\n \n FROM documents d\n -- ✅ contracts, projects, vendors 테이블 JOIN 추가\n LEFT JOIN contracts c ON d.contract_id = c.id\n LEFT JOIN projects p ON c.project_id = p.id\n LEFT JOIN vendors v ON c.vendor_id = v.id\n \n LEFT JOIN document_stats ds ON d.id = ds.document_id\n LEFT JOIN current_stage_info csi ON d.id = csi.document_id\n LEFT JOIN latest_revision_info lri ON d.id = lri.document_id\n LEFT JOIN stage_aggregation sa ON d.id = sa.document_id\n LEFT JOIN attachment_counts ac ON d.id = ac.document_id\n \n ORDER BY d.created_at DESC\n", + "name": "enhanced_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.sync_status_view": { + "columns": { + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "total_changes": { + "name": "total_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pending_changes": { + "name": "pending_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "synced_changes": { + "name": "synced_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "failed_changes": { + "name": "failed_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "last_sync_at": { + "name": "last_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_sync_at": { + "name": "next_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n WITH change_stats AS (\n SELECT \n cl.contract_id,\n sc.target_system,\n COUNT(*) as total_changes,\n COUNT(CASE WHEN cl.is_synced = false AND cl.sync_attempts < sc.retry_max_attempts THEN 1 END) as pending_changes,\n COUNT(CASE WHEN cl.is_synced = true THEN 1 END) as synced_changes,\n COUNT(CASE WHEN cl.sync_attempts >= sc.retry_max_attempts AND cl.is_synced = false THEN 1 END) as failed_changes,\n MAX(cl.synced_at) as last_sync_at\n FROM change_logs cl\n CROSS JOIN sync_configs sc \n WHERE cl.contract_id = sc.contract_id\n AND (cl.target_systems IS NULL OR cl.target_systems @> to_jsonb(sc.target_system))\n GROUP BY cl.contract_id, sc.target_system\n )\n SELECT \n cs.contract_id,\n cs.target_system,\n COALESCE(cs.total_changes, 0) as total_changes,\n COALESCE(cs.pending_changes, 0) as pending_changes,\n COALESCE(cs.synced_changes, 0) as synced_changes,\n COALESCE(cs.failed_changes, 0) as failed_changes,\n cs.last_sync_at,\n CASE \n WHEN sc.sync_enabled = true AND sc.last_successful_sync IS NOT NULL \n THEN sc.last_successful_sync + (sc.sync_interval_minutes || ' minutes')::interval\n ELSE NULL\n END as next_sync_at,\n sc.sync_enabled\n FROM sync_configs sc\n LEFT JOIN change_stats cs ON sc.contract_id = cs.contract_id AND sc.target_system = cs.target_system\n", + "name": "sync_status_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_documents_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "latest_stage_id": { + "name": "latest_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_stage_name": { + "name": "latest_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_stage_plan_date": { + "name": "latest_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_stage_actual_date": { + "name": "latest_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_type": { + "name": "latest_revision_uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT \n d.id, \n d.doc_number,\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n (SELECT id FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_id,\n (SELECT stage_name FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_name,\n (SELECT plan_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_plan_date,\n (SELECT actual_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_actual_date,\n \n (SELECT r.id FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_id,\n (SELECT r.revision FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision,\n (SELECT r.uploader_type FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_type,\n (SELECT r.uploader_name FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_name,\n \n (SELECT COUNT(*) FROM document_attachments a JOIN revisions r ON a.revision_id = r.id JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id) AS attachment_count,\n \n d.created_at,\n d.updated_at\n FROM documents d\n JOIN contracts c ON d.contract_id = c.id\n ", + "name": "vendor_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_candidates_with_vendor_info": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_candidates\".\"id\", \"vendor_candidates\".\"company_name\", \"vendor_candidates\".\"contact_email\", \"vendor_candidates\".\"contact_phone\", \"vendor_candidates\".\"tax_id\", \"vendor_candidates\".\"address\", \"vendor_candidates\".\"country\", \"vendor_candidates\".\"source\", \"vendor_candidates\".\"status\", \"vendor_candidates\".\"items\", \"vendor_candidates\".\"remark\", \"vendor_candidates\".\"created_at\", \"vendor_candidates\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"created_at\" as \"vendor_created_at\", (\n SELECT l2.\"created_at\"\n FROM \"vendor_candidate_logs\" l2\n WHERE l2.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l2.\"action\" = 'status_change'\n ORDER BY l2.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_at\", (\n SELECT u.\"name\"\n FROM \"users\" u\n JOIN \"vendor_candidate_logs\" l3\n ON l3.\"user_id\" = u.\"id\"\n WHERE l3.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l3.\"action\" = 'status_change'\n ORDER BY l3.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_by\", (\n SELECT l4.\"created_at\"\n FROM \"vendor_candidate_logs\" l4\n WHERE l4.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l4.\"action\" = 'invite_sent'\n ORDER BY l4.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_at\", (\n SELECT u2.\"name\"\n FROM \"users\" u2\n JOIN \"vendor_candidate_logs\" l5\n ON l5.\"user_id\" = u2.\"id\"\n WHERE l5.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l5.\"action\" = 'invite_sent'\n ORDER BY l5.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_by\" from \"vendor_candidates\" left join \"vendors\" on \"vendor_candidates\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "vendor_candidates_with_vendor_info", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"business_size\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"", + "name": "vendor_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", + "name": "vendor_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_materials_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_materials\".\"id\", \"vendor_possible_materials\".\"vendor_id\", \"materials\".\"item_name\", \"materials\".\"item_code\", \"materials\".\"description\", \"materials\".\"unit_of_measure\", \"materials\".\"steel_type\", \"materials\".\"grade_material\", \"vendor_possible_materials\".\"created_at\", \"vendor_possible_materials\".\"updated_at\" from \"vendor_possible_materials\" left join \"materials\" on \"vendor_possible_materials\".\"item_code\" = \"materials\".\"item_code\"", + "name": "vendor_materials_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendors_with_types": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"tax_id\" as \"tax_id\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"phone\" as \"phone\", \"vendors\".\"email\" as \"email\", \"vendors\".\"business_size\" as \"business_size\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"status\", \"vendors\".\"vendor_type_id\" as \"vendor_type_id\", \"vendors\".\"representative_name\" as \"representative_name\", \"vendors\".\"representative_birth\" as \"representative_birth\", \"vendors\".\"representative_email\" as \"representative_email\", \"vendors\".\"representative_phone\" as \"representative_phone\", \"vendors\".\"corporate_registration_number\" as \"corporate_registration_number\", \"vendors\".\"items\" as \"items\", \"vendors\".\"credit_agency\" as \"credit_agency\", \"vendors\".\"credit_rating\" as \"credit_rating\", \"vendors\".\"cash_flow_rating\" as \"cash_flow_rating\", \"vendors\".\"created_at\" as \"created_at\", \"vendors\".\"updated_at\" as \"updated_at\", \"vendor_types\".\"name_ko\" as \"vendor_type_name\", \"vendor_types\".\"name_en\" as \"vendor_type_name_en\", \"vendor_types\".\"code\" as \"vendor_type_code\", \n CASE\n WHEN \"vendors\".\"status\" = 'ACTIVE' THEN '정규업체'\n WHEN \"vendors\".\"status\" IN ('INACTIVE', 'BLACKLISTED', 'REJECTED') THEN ''\n ELSE '잠재업체'\n END\n as \"vendor_category\" from \"vendors\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\"", + "name": "vendors_with_types", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.basic_contract_view": { + "columns": {}, + "definition": "select \"basic_contract\".\"id\" as \"id\", \"basic_contract\".\"template_id\" as \"template_id\", \"basic_contract\".\"vendor_id\" as \"vendor_id\", \"basic_contract\".\"requested_by\" as \"requested_by\", \"basic_contract\".\"status\" as \"basic_contract_status\", \"basic_contract\".\"created_at\" as \"created_at\", \"basic_contract\".\"updated_at\" as \"updated_at\", \"basic_contract\".\"updated_at\" as \"completed_at\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"email\" as \"vendor_email\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"users\".\"name\" as \"user_name\", \"basic_contract_templates\".\"template_name\" as \"template_name\", \"basic_contract_templates\".\"validity_period\" as \"validityPeriod\", \"basic_contract_templates\".\"file_path\" as \"file_path\", \"basic_contract_templates\".\"file_name\" as \"file_name\", \"basic_contract\".\"file_path\" as \"signed_file_path\" from \"basic_contract\" left join \"vendors\" on \"basic_contract\".\"vendor_id\" = \"vendors\".\"id\" left join \"users\" on \"basic_contract\".\"requested_by\" = \"users\".\"id\" left join \"basic_contract_templates\" on \"basic_contract\".\"template_id\" = \"basic_contract_templates\".\"id\"", + "name": "basic_contract_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.pr_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"pr_items\".\"id\", \"pr_items\".\"procurement_rfqs_id\", \"pr_items\".\"rfq_item\", \"pr_items\".\"pr_item\", \"pr_items\".\"pr_no\", \"pr_items\".\"material_code\", \"pr_items\".\"material_category\", \"pr_items\".\"acc\", \"pr_items\".\"material_description\", \"pr_items\".\"size\", \"pr_items\".\"delivery_date\", \"pr_items\".\"quantity\", \"pr_items\".\"uom\", \"pr_items\".\"gross_weight\", \"pr_items\".\"gw_uom\", \"pr_items\".\"spec_no\", \"pr_items\".\"spec_url\", \"pr_items\".\"tracking_no\", \"pr_items\".\"major_yn\", \"pr_items\".\"project_def\", \"pr_items\".\"project_sc\", \"pr_items\".\"project_kl\", \"pr_items\".\"project_lc\", \"pr_items\".\"project_dl\", \"pr_items\".\"remark\", \"procurement_rfqs\".\"rfq_code\", \"procurement_rfqs\".\"item_code\", \"procurement_rfqs\".\"item_name\" from \"pr_items\" left join \"procurement_rfqs\" on \"pr_items\".\"procurement_rfqs_id\" = \"procurement_rfqs\".\"id\"", + "name": "pr_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfq_details_view": { + "columns": {}, + "definition": "select \"rfq_details\".\"id\" as \"detail_id\", \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfqs\".\"item_code\" as \"item_code\", \"rfqs\".\"item_name\" as \"item_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"country\" as \"vendor_country\", \"rfq_details\".\"currency\" as \"currency\", \"payment_terms\".\"code\" as \"payment_terms_code\", \"payment_terms\".\"description\" as \"payment_terms_description\", \"incoterms\".\"code\" as \"incoterms_code\", \"incoterms\".\"description\" as \"incoterms_description\", \"rfq_details\".\"incoterms_detail\" as \"incoterms_detail\", \"rfq_details\".\"delivery_date\" as \"delivery_date\", \"rfq_details\".\"tax_code\" as \"tax_code\", \"rfq_details\".\"place_of_shipping\" as \"place_of_shipping\", \"rfq_details\".\"place_of_destination\" as \"place_of_destination\", \"rfq_details\".\"material_price_related_yn\" as \"material_price_related_yn\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"rfq_details\".\"updated_at\" as \"updated_at\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\"\n ) as \"pr_items_count\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\" \n AND major_yn = true\n ) as \"major_items_count\", (\n SELECT COUNT(*) \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"comment_count\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_comment_date\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\" AND is_vendor_comment = true\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_vendor_comment_date\", (\n SELECT COUNT(*) \n FROM procurement_rfq_attachments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) > 0\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"has_quotation\", (\n SELECT status\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_status\", (\n SELECT total_price\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_total_price\", (\n SELECT quotation_version\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"quotation_version\", (\n SELECT COUNT(DISTINCT quotation_version)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"quotation_version_count\", (\n SELECT created_at\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"last_quotation_date\" from \"procurement_rfq_details\" \"rfq_details\" left join \"procurement_rfqs\" \"rfqs\" on \"rfq_details\".\"procurement_rfqs_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"rfq_details\".\"vendors_id\" = \"vendors\".\"id\" left join \"payment_terms\" on \"rfq_details\".\"payment_terms_code\" = \"payment_terms\".\"code\" left join \"incoterms\" on \"rfq_details\".\"incoterms_code\" = \"incoterms\".\"code\" left join \"users\" \"updated_by_user\" on \"rfq_details\".\"updated_by\" = \"updated_by_user\".\"id\"", + "name": "procurement_rfq_details_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfqs_view": { + "columns": {}, + "definition": "select \"procurement_rfqs\".\"id\" as \"id\", \"procurement_rfqs\".\"rfq_code\" as \"rfq_code\", \"procurement_rfqs\".\"series\" as \"series\", \"procurement_rfqs\".\"rfq_sealed_yn\" as \"rfq_sealed_yn\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"procurement_rfqs\".\"item_code\" as \"item_code\", \"procurement_rfqs\".\"item_name\" as \"item_name\", \"procurement_rfqs\".\"status\" as \"status\", \"procurement_rfqs\".\"pic_code\" as \"pic_code\", \"procurement_rfqs\".\"rfq_send_date\" as \"rfq_send_date\", \"procurement_rfqs\".\"due_date\" as \"due_date\", (\n SELECT MIN(submitted_at)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"procurement_rfqs\".\"id\"\n AND submitted_at IS NOT NULL\n ) as \"earliest_quotation_submitted_at\", \"created_by_user\".\"name\" as \"created_by_user_name\", \"sent_by_user\".\"name\" as \"sent_by_user_name\", \"procurement_rfqs\".\"updated_at\" as \"updated_at\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"procurement_rfqs\".\"remark\" as \"remark\", (\n SELECT material_code \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"major_item_material_code\", (\n SELECT pr_no \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"po_no\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n ) as \"pr_items_count\" from \"procurement_rfqs\" left join \"projects\" on \"procurement_rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" \"created_by_user\" on \"procurement_rfqs\".\"created_by\" = \"created_by_user\".\"id\" left join \"users\" \"updated_by_user\" on \"procurement_rfqs\".\"updated_by\" = \"updated_by_user\".\"id\" left join \"users\" \"sent_by_user\" on \"procurement_rfqs\".\"sent_by\" = \"sent_by_user\".\"id\"", + "name": "procurement_rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.b_rfqs_master": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pic_name": { + "name": "pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "eng_pic_name": { + "name": "eng_pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "package_no": { + "name": "package_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "package_name": { + "name": "package_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_name": { + "name": "project_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_type": { + "name": "project_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "project_company": { + "name": "project_company", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_flag": { + "name": "project_flag", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_site": { + "name": "project_site", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "total_attachments": { + "name": "total_attachments", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.description,\n br.status,\n br.due_date,\n br.pic_code,\n br.pic_name,\n br.eng_pic_name,\n br.package_no,\n br.package_name,\n br.project_id,\n p.code as project_code,\n p.name as project_name,\n p.type as project_type,\n br.project_company,\n br.project_flag,\n br.project_site,\n COALESCE(att_count.total_attachments, 0) as total_attachments,\n br.created_at,\n br.updated_at\n FROM b_rfqs br\n LEFT JOIN projects p ON br.project_id = p.id\n LEFT JOIN (\n SELECT rfq_id, COUNT(*) as total_attachments\n FROM b_rfq_attachments\n GROUP BY rfq_id\n ) att_count ON br.id = att_count.rfq_id\n", + "name": "b_rfqs_master", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.final_rfq_detail": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "rfq_status": { + "name": "rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "final_rfq_id": { + "name": "final_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "final_rfq_status": { + "name": "final_rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_country": { + "name": "vendor_country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "vendor_business_size": { + "name": "vendor_business_size", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "valid_date": { + "name": "valid_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_description": { + "name": "incoterms_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "payment_terms_description": { + "name": "payment_terms_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "short_list": { + "name": "short_list", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "return_yn": { + "name": "return_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "cp_request_yn": { + "name": "cp_request_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "prject_gtc_yn": { + "name": "prject_gtc_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "firsttime_yn": { + "name": "firsttime_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "return_revision": { + "name": "return_revision", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "gtc": { + "name": "gtc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "gtc_valid_date": { + "name": "gtc_valid_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sparepart": { + "name": "sparepart", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vendor_remark": { + "name": "vendor_remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.status as rfq_status,\n fr.id as final_rfq_id,\n fr.final_rfq_status,\n fr.vendor_id,\n v.vendor_code,\n v.vendor_name,\n v.country as vendor_country,\n v.business_size as vendor_business_size,\n fr.due_date,\n fr.valid_date,\n fr.delivery_date,\n fr.incoterms_code,\n inc.description as incoterms_description,\n fr.payment_terms_code,\n pt.description as payment_terms_description,\n fr.currency,\n fr.tax_code,\n fr.place_of_shipping,\n fr.place_of_destination,\n fr.short_list,\n fr.return_yn,\n fr.cp_request_yn,\n fr.prject_gtc_yn,\n fr.firsttime_yn,\n fr.material_price_related_yn,\n fr.return_revision,\n fr.gtc,\n fr.gtc_valid_date,\n fr.classification,\n fr.sparepart,\n fr.remark,\n fr.vendor_remark,\n fr.created_at,\n fr.updated_at\n FROM b_rfqs br\n JOIN final_rfq fr ON br.id = fr.rfq_id\n LEFT JOIN vendors v ON fr.vendor_id = v.id\n LEFT JOIN incoterms inc ON fr.incoterms_code = inc.code\n LEFT JOIN payment_terms pt ON fr.payment_terms_code = pt.code\n", + "name": "final_rfq_detail", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.initial_rfq_detail": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "rfq_status": { + "name": "rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "initial_rfq_id": { + "name": "initial_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "initial_rfq_status": { + "name": "initial_rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_country": { + "name": "vendor_country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "vendor_business_size": { + "name": "vendor_business_size", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "valid_date": { + "name": "valid_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_description": { + "name": "incoterms_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "short_list": { + "name": "short_list", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "return_yn": { + "name": "return_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "cp_request_yn": { + "name": "cp_request_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "prject_gtc_yn": { + "name": "prject_gtc_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "return_revision": { + "name": "return_revision", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "gtc": { + "name": "gtc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "gtc_valid_date": { + "name": "gtc_valid_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sparepart": { + "name": "sparepart", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.status as rfq_status,\n ir.id as initial_rfq_id,\n ir.initial_rfq_status,\n ir.vendor_id,\n v.vendor_code,\n v.vendor_name,\n v.country as vendor_country,\n v.business_size as vendor_business_size,\n ir.due_date,\n ir.valid_date,\n ir.incoterms_code,\n inc.description as incoterms_description,\n ir.incoterms_detail,\n ir.short_list,\n ir.return_yn,\n ir.cp_request_yn,\n ir.prject_gtc_yn,\n ir.return_revision,\n ir.gtc,\n ir.gtc_valid_date,\n ir.classification,\n ir.sparepart,\n ir.created_at,\n ir.updated_at\n FROM b_rfqs br\n JOIN initial_rfq ir ON br.id = ir.rfq_id\n LEFT JOIN vendors v ON ir.vendor_id = v.id\n LEFT JOIN incoterms inc ON ir.incoterms_code = inc.code\n", + "name": "initial_rfq_detail", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.rfq_dashboard": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_name": { + "name": "project_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "package_no": { + "name": "package_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "package_name": { + "name": "package_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "pic_name": { + "name": "pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "total_attachments": { + "name": "total_attachments", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "initial_vendor_count": { + "name": "initial_vendor_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "final_vendor_count": { + "name": "final_vendor_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "initial_response_rate": { + "name": "initial_response_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "final_response_rate": { + "name": "final_response_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "overall_progress": { + "name": "overall_progress", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "days_to_deadline": { + "name": "days_to_deadline", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.description,\n br.status,\n br.due_date,\n p.code as project_code,\n p.name as project_name,\n br.package_no,\n br.package_name,\n br.pic_name,\n COALESCE(att_count.total_attachments, 0) as total_attachments,\n COALESCE(init_summary.vendor_count, 0) as initial_vendor_count,\n COALESCE(final_summary.vendor_count, 0) as final_vendor_count,\n COALESCE(init_summary.avg_response_rate, 0) as initial_response_rate,\n COALESCE(final_summary.avg_response_rate, 0) as final_response_rate,\n CASE \n WHEN br.status = 'DRAFT' THEN 0\n WHEN br.status = 'Doc. Received' THEN 10\n WHEN br.status = 'PIC Assigned' THEN 20\n WHEN br.status = 'Doc. Confirmed' THEN 30\n WHEN br.status = 'Init. RFQ Sent' THEN 40\n WHEN br.status = 'Init. RFQ Answered' THEN 50\n WHEN br.status = 'TBE started' THEN 60\n WHEN br.status = 'TBE finished' THEN 70\n WHEN br.status = 'Final RFQ Sent' THEN 80\n WHEN br.status = 'Quotation Received' THEN 90\n WHEN br.status = 'Vendor Selected' THEN 100\n ELSE 0\n END as overall_progress,\n (br.due_date - CURRENT_DATE) as days_to_deadline,\n br.created_at\n FROM b_rfqs br\n LEFT JOIN projects p ON br.project_id = p.id\n LEFT JOIN (\n SELECT rfq_id, COUNT(*) as total_attachments\n FROM b_rfq_attachments\n GROUP BY rfq_id\n ) att_count ON br.id = att_count.rfq_id\n LEFT JOIN (\n SELECT \n rfq_id, \n COUNT(DISTINCT vendor_id) as vendor_count,\n AVG(response_rate) as avg_response_rate\n FROM vendor_response_summary\n WHERE rfq_type = 'INITIAL'\n GROUP BY rfq_id\n ) init_summary ON br.id = init_summary.rfq_id\n LEFT JOIN (\n SELECT \n rfq_id, \n COUNT(DISTINCT vendor_id) as vendor_count,\n AVG(response_rate) as avg_response_rate\n FROM vendor_response_summary\n WHERE rfq_type = 'FINAL'\n GROUP BY rfq_id\n ) final_summary ON br.id = final_summary.rfq_id\n", + "name": "rfq_dashboard", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_response_summary": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "rfq_status": { + "name": "rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_country": { + "name": "vendor_country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "vendor_business_size": { + "name": "vendor_business_size", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "total_attachments": { + "name": "total_attachments", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "responded_count": { + "name": "responded_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "pending_count": { + "name": "pending_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "waived_count": { + "name": "waived_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "revision_requested_count": { + "name": "revision_requested_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "response_rate": { + "name": "response_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "completion_rate": { + "name": "completion_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.status as rfq_status,\n v.id as vendor_id,\n v.vendor_code,\n v.vendor_name,\n v.country as vendor_country,\n v.business_size as vendor_business_size,\n var.rfq_type,\n COUNT(var.id) as total_attachments,\n COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) as responded_count,\n COUNT(CASE WHEN var.response_status = 'NOT_RESPONDED' THEN 1 END) as pending_count,\n COUNT(CASE WHEN var.response_status = 'WAIVED' THEN 1 END) as waived_count,\n COUNT(CASE WHEN var.response_status = 'REVISION_REQUESTED' THEN 1 END) as revision_requested_count,\n ROUND(\n (COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) * 100.0 / \n NULLIF(COUNT(CASE WHEN var.response_status != 'WAIVED' THEN 1 END), 0)), \n 2\n ) as response_rate,\n ROUND(\n ((COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) + \n COUNT(CASE WHEN var.response_status = 'WAIVED' THEN 1 END)) * 100.0 / COUNT(var.id)), \n 2\n ) as completion_rate\n FROM b_rfqs br\n JOIN b_rfq_attachments bra ON br.id = bra.rfq_id\n JOIN vendor_attachment_responses var ON bra.id = var.attachment_id\n JOIN vendors v ON var.vendor_id = v.id\n GROUP BY br.id, br.rfq_code, br.status, v.id, v.vendor_code, v.vendor_name, v.country, v.business_size, var.rfq_type\n", + "name": "vendor_response_summary", + "schema": "public", + "isExisting": false, + "materialized": false + } + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db/migrations/meta/0124_snapshot.json b/db/migrations/meta/0124_snapshot.json new file mode 100644 index 00000000..c0c33c21 --- /dev/null +++ b/db/migrations/meta/0124_snapshot.json @@ -0,0 +1,14011 @@ +{ + "id": "697eaff7-48b8-4f4a-b489-6f42dfdfd199", + "prevId": "4e3ea5b3-eaa4-40c1-b094-324c337290be", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.companies": { + "name": "companies", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "companies_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "taxID": { + "name": "taxID", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_envelopes": { + "name": "contract_envelopes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_envelopes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "envelope_id": { + "name": "envelope_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": true + }, + "document_id": { + "name": "document_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": false + }, + "envelope_status": { + "name": "envelope_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_envelopes_contract_id_contracts_id_fk": { + "name": "contract_envelopes_contract_id_contracts_id_fk", + "tableFrom": "contract_envelopes", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_items": { + "name": "contract_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_items_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_id": { + "name": "item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "unit_price": { + "name": "unit_price", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "total_line_amount": { + "name": "total_line_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_items_contract_item_idx": { + "name": "contract_items_contract_item_idx", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "contract_items_contract_id_contracts_id_fk": { + "name": "contract_items_contract_id_contracts_id_fk", + "tableFrom": "contract_items", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_items_item_id_items_id_fk": { + "name": "contract_items_item_id_items_id_fk", + "tableFrom": "contract_items", + "tableTo": "items", + "columnsFrom": [ + "item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_items_contract_id_item_id_unique": { + "name": "contract_items_contract_id_item_id_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_id", + "item_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_signers": { + "name": "contract_signers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_signers_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "envelope_id": { + "name": "envelope_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_contact_id": { + "name": "vendor_contact_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "signer_type": { + "name": "signer_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'VENDOR'" + }, + "signer_email": { + "name": "signer_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "signer_name": { + "name": "signer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "signer_position": { + "name": "signer_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "signer_status": { + "name": "signer_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "signed_at": { + "name": "signed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_signers_envelope_id_contract_envelopes_id_fk": { + "name": "contract_signers_envelope_id_contract_envelopes_id_fk", + "tableFrom": "contract_signers", + "tableTo": "contract_envelopes", + "columnsFrom": [ + "envelope_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_signers_vendor_contact_id_vendor_contacts_id_fk": { + "name": "contract_signers_vendor_contact_id_vendor_contacts_id_fk", + "tableFrom": "contract_signers", + "tableTo": "vendor_contacts", + "columnsFrom": [ + "vendor_contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contracts": { + "name": "contracts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contracts_project_id_projects_id_fk": { + "name": "contracts_project_id_projects_id_fk", + "tableFrom": "contracts", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contracts_vendor_id_vendors_id_fk": { + "name": "contracts_vendor_id_vendors_id_fk", + "tableFrom": "contracts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contracts_contract_no_unique": { + "name": "contracts_contract_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.poa": { + "name": "poa", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "original_contract_no": { + "name": "original_contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "original_contract_name": { + "name": "original_contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_status": { + "name": "original_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "poa_original_contract_no_contracts_contract_no_fk": { + "name": "poa_original_contract_no_contracts_contract_no_fk", + "tableFrom": "poa", + "tableTo": "contracts", + "columnsFrom": [ + "original_contract_no" + ], + "columnsTo": [ + "contract_no" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_project_id_projects_id_fk": { + "name": "poa_project_id_projects_id_fk", + "tableFrom": "poa", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_vendor_id_vendors_id_fk": { + "name": "poa_vendor_id_vendors_id_fk", + "tableFrom": "poa", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_hull": { + "name": "item_offshore_hull", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_hull_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_hull_item_code_items_item_code_fk": { + "name": "item_offshore_hull_item_code_items_item_code_fk", + "tableFrom": "item_offshore_hull", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_top": { + "name": "item_offshore_top", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_top_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_top_item_code_items_item_code_fk": { + "name": "item_offshore_top_item_code_items_item_code_fk", + "tableFrom": "item_offshore_top", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_shipbuilding": { + "name": "item_shipbuilding", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ship_types": { + "name": "ship_types", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'OPTION'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_shipbuilding_item_code_items_item_code_fk": { + "name": "item_shipbuilding_item_code_items_item_code_fk", + "tableFrom": "item_shipbuilding", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.items": { + "name": "items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_no": { + "name": "project_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "package_code": { + "name": "package_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "sm_code": { + "name": "sm_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "items_item_code_unique": { + "name": "items_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.materials": { + "name": "materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "materials_item_code_unique": { + "name": "materials_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias": { + "name": "pq_criterias", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "check_point": { + "name": "check_point", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "group_name": { + "name": "group_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias_extension": { + "name": "pq_criterias_extension", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_criteria_id": { + "name": "pq_criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_info": { + "name": "contract_info", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "additional_requirement": { + "name": "additional_requirement", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk": { + "name": "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "pq_criterias", + "columnsFrom": [ + "pq_criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "pq_criterias_extension_project_id_projects_id_fk": { + "name": "pq_criterias_extension_project_id_projects_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_criteria_attachments": { + "name": "vendor_criteria_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_criteria_answer_id": { + "name": "vendor_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_criteria_attachments", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigation_attachments": { + "name": "vendor_investigation_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "investigation_id": { + "name": "investigation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'REPORT'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { + "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", + "tableFrom": "vendor_investigation_attachments", + "tableTo": "vendor_investigations", + "columnsFrom": [ + "investigation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigations": { + "name": "vendor_investigations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigations_vendor_id_vendors_id_fk": { + "name": "vendor_investigations_vendor_id_vendors_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk": { + "name": "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendor_pq_submissions", + "columnsFrom": [ + "pq_submission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "vendor_investigations_requester_id_users_id_fk": { + "name": "vendor_investigations_requester_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_qm_manager_id_users_id_fk": { + "name": "vendor_investigations_qm_manager_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "qm_manager_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_submissions": { + "name": "vendor_pq_submissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_number": { + "name": "pq_number", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_pq_submission": { + "name": "unique_pq_submission", + "columns": [ + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_pq_submissions_requester_id_users_id_fk": { + "name": "vendor_pq_submissions_requester_id_users_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_pq_submissions_vendor_id_vendors_id_fk": { + "name": "vendor_pq_submissions_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_submissions_project_id_projects_id_fk": { + "name": "vendor_pq_submissions_project_id_projects_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_pq_submissions_pq_number_unique": { + "name": "vendor_pq_submissions_pq_number_unique", + "nullsNotDistinct": false, + "columns": [ + "pq_number" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_criteria_answers": { + "name": "vendor_pq_criteria_answers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "criteria_id": { + "name": "criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "answer": { + "name": "answer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_criteria_answers_vendor_id_vendors_id_fk": { + "name": "vendor_pq_criteria_answers_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": { + "name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "pq_criterias", + "columnsFrom": [ + "criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_project_id_projects_id_fk": { + "name": "vendor_pq_criteria_answers_project_id_projects_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_review_logs": { + "name": "vendor_pq_review_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_pq_criteria_answer_id": { + "name": "vendor_pq_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "reviewer_comment": { + "name": "reviewer_comment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_pq_review_logs", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_pq_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_project_pqs": { + "name": "vendor_project_pqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_project_pqs_vendor_id_vendors_id_fk": { + "name": "vendor_project_pqs_vendor_id_vendors_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_project_pqs_project_id_projects_id_fk": { + "name": "vendor_project_pqs_project_id_projects_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bidding_projects": { + "name": "bidding_projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "proj_nm": { + "name": "proj_nm", + "type": "varchar(90)", + "primaryKey": false, + "notNull": false + }, + "sector": { + "name": "sector", + "type": "char(1)", + "primaryKey": false, + "notNull": false + }, + "proj_msrm": { + "name": "proj_msrm", + "type": "numeric(3, 0)", + "primaryKey": false, + "notNull": false + }, + "kunnr": { + "name": "kunnr", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "kunnr_nm": { + "name": "kunnr_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "cls_1": { + "name": "cls_1", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "cls1_nm": { + "name": "cls1_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "ptype": { + "name": "ptype", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "ptype_nm": { + "name": "ptype_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_cd": { + "name": "pmodel_cd", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "pmodel_nm": { + "name": "pmodel_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_sz": { + "name": "pmodel_sz", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "pmodel_uom": { + "name": "pmodel_uom", + "type": "char(5)", + "primaryKey": false, + "notNull": false + }, + "txt04": { + "name": "txt04", + "type": "char(4)", + "primaryKey": false, + "notNull": false + }, + "txt30": { + "name": "txt30", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "estm_pm": { + "name": "estm_pm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "bidding_projects_pspid_unique": { + "name": "bidding_projects_pspid_unique", + "nullsNotDistinct": false, + "columns": [ + "pspid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_series": { + "name": "project_series", + "schema": "", + "columns": { + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "sers_no": { + "name": "sers_no", + "type": "char(3)", + "primaryKey": false, + "notNull": true + }, + "sc_dt": { + "name": "sc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "kl_dt": { + "name": "kl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "lc_dt": { + "name": "lc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dl_dt": { + "name": "dl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dock_no": { + "name": "dock_no", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "dock_nm": { + "name": "dock_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "proj_no": { + "name": "proj_no", + "type": "char(24)", + "primaryKey": false, + "notNull": false + }, + "post1": { + "name": "post1", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "project_sersNo_unique": { + "name": "project_sersNo_unique", + "columns": [ + { + "expression": "pspid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sers_no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "project_series_pspid_bidding_projects_pspid_fk": { + "name": "project_series_pspid_bidding_projects_pspid_fk", + "tableFrom": "project_series", + "tableTo": "bidding_projects", + "columnsFrom": [ + "pspid" + ], + "columnsTo": [ + "pspid" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projects": { + "name": "projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cbe_evaluations": { + "name": "cbe_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluated_by": { + "name": "evaluated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluated_at": { + "name": "evaluated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "result": { + "name": "result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "total_cost": { + "name": "total_cost", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_schedule": { + "name": "delivery_schedule", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "cbe_evaluations_rfq_id_rfqs_id_fk": { + "name": "cbe_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_vendor_id_vendors_id_fk": { + "name": "cbe_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_evaluated_by_users_id_fk": { + "name": "cbe_evaluations_evaluated_by_users_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "users", + "columnsFrom": [ + "evaluated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_attachments": { + "name": "rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_attachments_rfq_id_rfqs_id_fk": { + "name": "rfq_attachments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_vendor_id_vendors_id_fk": { + "name": "rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_attachments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_cbe_id_cbe_evaluations_id_fk": { + "name": "rfq_attachments_cbe_id_cbe_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "cbe_evaluations", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_comment_id_rfq_comments_id_fk": { + "name": "rfq_attachments_comment_id_rfq_comments_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_comments": { + "name": "rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "comment_text": { + "name": "comment_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "commented_by": { + "name": "commented_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_comments_rfq_id_rfqs_id_fk": { + "name": "rfq_comments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_vendor_id_vendors_id_fk": { + "name": "rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_commented_by_users_id_fk": { + "name": "rfq_comments_commented_by_users_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "commented_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_comments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_cbe_id_vendor_responses_id_fk": { + "name": "rfq_comments_cbe_id_vendor_responses_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_evaluations": { + "name": "rfq_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "eval_type": { + "name": "eval_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "result": { + "name": "result", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_evaluations_rfq_id_rfqs_id_fk": { + "name": "rfq_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_evaluations_vendor_id_vendors_id_fk": { + "name": "rfq_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_items": { + "name": "rfq_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_items_rfq_id_rfqs_id_fk": { + "name": "rfq_items_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_items", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "rfq_items_item_code_items_item_code_fk": { + "name": "rfq_items_item_code_items_item_code_fk", + "tableFrom": "rfq_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfqs": { + "name": "rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "bid_project_id": { + "name": "bid_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false, + "default": "'PURCHASE'" + }, + "parent_rfq_id": { + "name": "parent_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfqs_project_id_projects_id_fk": { + "name": "rfqs_project_id_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_bid_project_id_bidding_projects_id_fk": { + "name": "rfqs_bid_project_id_bidding_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bid_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_created_by_users_id_fk": { + "name": "rfqs_created_by_users_id_fk", + "tableFrom": "rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_parent_rfq_id_rfqs_id_fk": { + "name": "rfqs_parent_rfq_id_rfqs_id_fk", + "tableFrom": "rfqs", + "tableTo": "rfqs", + "columnsFrom": [ + "parent_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "rfqs_rfq_code_unique": { + "name": "rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_commercial_responses": { + "name": "vendor_commercial_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "total_price": { + "name": "total_price", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_period": { + "name": "delivery_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "warranty_period": { + "name": "warranty_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "validity_period": { + "name": "validity_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "price_breakdown": { + "name": "price_breakdown", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "commercial_notes": { + "name": "commercial_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_commercial_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_commercial_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_commercial_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_attachments": { + "name": "vendor_response_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "technical_response_id": { + "name": "technical_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "commercial_response_id": { + "name": "commercial_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_attachments_response_id_vendor_responses_id_fk": { + "name": "vendor_response_attachments_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk": { + "name": "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_technical_responses", + "columnsFrom": [ + "technical_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk": { + "name": "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_commercial_responses", + "columnsFrom": [ + "commercial_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_responses": { + "name": "vendor_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'REVIEWING'" + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "responded_by": { + "name": "responded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "responded_at": { + "name": "responded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "vendor_response_unique": { + "name": "vendor_response_unique", + "columns": [ + { + "expression": "rfq_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_responses_rfq_id_rfqs_id_fk": { + "name": "vendor_responses_rfq_id_rfqs_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_responses_vendor_id_vendors_id_fk": { + "name": "vendor_responses_vendor_id_vendors_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_technical_responses": { + "name": "vendor_technical_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_technical_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_technical_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_technical_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.otps": { + "name": "otps", + "schema": "", + "columns": { + "email": { + "name": "email", + "type": "varchar(256)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(6)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "otpToken": { + "name": "otpToken", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "otp_expires": { + "name": "otp_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permissions": { + "name": "permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "permissions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "permission_key": { + "name": "permission_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.role_permissions": { + "name": "role_permissions", + "schema": "", + "columns": { + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "permission_id": { + "name": "permission_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "role_permissions_role_id_roles_id_fk": { + "name": "role_permissions_role_id_roles_id_fk", + "tableFrom": "role_permissions", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "role_permissions_permission_id_permissions_id_fk": { + "name": "role_permissions_permission_id_permissions_id_fk", + "tableFrom": "role_permissions", + "tableTo": "permissions", + "columnsFrom": [ + "permission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.roles": { + "name": "roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "roles_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "roles_company_id_vendors_id_fk": { + "name": "roles_company_id_vendors_id_fk", + "tableFrom": "roles", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_roles": { + "name": "user_roles", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_roles_user_id_users_id_fk": { + "name": "user_roles_user_id_users_id_fk", + "tableFrom": "user_roles", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_roles_role_id_roles_id_fk": { + "name": "user_roles_role_id_roles_id_fk", + "tableFrom": "user_roles", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "users_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'partners'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "image_url": { + "name": "image_url", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "language": { + "name": "language", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'en'" + } + }, + "indexes": {}, + "foreignKeys": { + "users_company_id_vendors_id_fk": { + "name": "users_company_id_vendors_id_fk", + "tableFrom": "users", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_entries": { + "name": "form_entries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_entries_contract_item_id_contract_items_id_fk": { + "name": "form_entries_contract_item_id_contract_items_id_fk", + "tableFrom": "form_entries", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_metas": { + "name": "form_metas", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "columns": { + "name": "columns", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_metas_project_id_projects_id_fk": { + "name": "form_metas_project_id_projects_id_fk", + "tableFrom": "form_metas", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "form_code_project_unique": { + "name": "form_code_project_unique", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.forms": { + "name": "forms", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "forms_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "eng": { + "name": "eng", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "im": { + "name": "im", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_item_form_code_unique": { + "name": "contract_item_form_code_unique", + "columns": [ + { + "expression": "contract_item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "form_code", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "forms_contract_item_id_contract_items_id_fk": { + "name": "forms_contract_item_id_contract_items_id_fk", + "tableFrom": "forms", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_class_attributes": { + "name": "tag_class_attributes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_class_attributes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "tag_class_id": { + "name": "tag_class_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "att_id": { + "name": "att_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "def_val": { + "name": "def_val", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uom_id": { + "name": "uom_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "seq": { + "name": "seq", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "tag_class_attributes_seq_idx": { + "name": "tag_class_attributes_seq_idx", + "columns": [ + { + "expression": "seq", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "tag_class_attributes_tag_class_id_tag_classes_id_fk": { + "name": "tag_class_attributes_tag_class_id_tag_classes_id_fk", + "tableFrom": "tag_class_attributes", + "tableTo": "tag_classes", + "columnsFrom": [ + "tag_class_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_att_id_in_tag_class": { + "name": "uniq_att_id_in_tag_class", + "nullsNotDistinct": false, + "columns": [ + "tag_class_id", + "att_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_classes": { + "name": "tag_classes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_classes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_classes_project_id_projects_id_fk": { + "name": "tag_classes_project_id_projects_id_fk", + "tableFrom": "tag_classes", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk": { + "name": "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk", + "tableFrom": "tag_classes", + "tableTo": "tag_types", + "columnsFrom": [ + "tag_type_code", + "project_id" + ], + "columnsTo": [ + "code", + "project_id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_code_in_project": { + "name": "uniq_code_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfield_options": { + "name": "tag_subfield_options", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfield_options_project_id_projects_id_fk": { + "name": "tag_subfield_options_project_id_projects_id_fk", + "tableFrom": "tag_subfield_options", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_attribute_project_code": { + "name": "uniq_attribute_project_code", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "attributes_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfields": { + "name": "tag_subfields", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfields_project_id_projects_id_fk": { + "name": "tag_subfields_project_id_projects_id_fk", + "tableFrom": "tag_subfields", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_tag_type_attribute": { + "name": "uniq_tag_type_attribute", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_code", + "attributes_id" + ] + }, + "uniq_attribute_id_project": { + "name": "uniq_attribute_id_project", + "nullsNotDistinct": false, + "columns": [ + "attributes_id", + "project_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_type_class_form_mappings": { + "name": "tag_type_class_form_mappings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_label": { + "name": "tag_type_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "class_label": { + "name": "class_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "ep": { + "name": "ep", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_mapping_in_project": { + "name": "uniq_mapping_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_label", + "class_label", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_types": { + "name": "tag_types", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_types_project_id_projects_id_fk": { + "name": "tag_types_project_id_projects_id_fk", + "tableFrom": "tag_types", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "tag_types_code_project_id_pk": { + "name": "tag_types_code_project_id_pk", + "columns": [ + "code", + "project_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tags": { + "name": "tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tags_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "tag_type": { + "name": "tag_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "class": { + "name": "class", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tags_contract_item_id_contract_items_id_fk": { + "name": "tags_contract_item_id_contract_items_id_fk", + "tableFrom": "tags", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_form_id_forms_id_fk": { + "name": "tags_form_id_forms_id_fk", + "tableFrom": "tags", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_item_tag_no_unique": { + "name": "contract_item_tag_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_item_id", + "tag_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_data_report_temps": { + "name": "vendor_data_report_temps", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_data_report_temps_contract_item_id_contract_items_id_fk": { + "name": "vendor_data_report_temps_contract_item_id_contract_items_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_data_report_temps_form_id_forms_id_fk": { + "name": "vendor_data_report_temps_form_id_forms_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.change_logs": { + "name": "change_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "changed_fields": { + "name": "changed_fields", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "old_values": { + "name": "old_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "new_values": { + "name": "new_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_name": { + "name": "user_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_synced": { + "name": "is_synced", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "sync_attempts": { + "name": "sync_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_sync_error": { + "name": "last_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "synced_at": { + "name": "synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "target_systems": { + "name": "target_systems", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + } + }, + "indexes": { + "idx_change_logs_contract_synced": { + "name": "idx_change_logs_contract_synced", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_synced", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_created_at": { + "name": "idx_change_logs_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_entity": { + "name": "idx_change_logs_entity", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_sync_attempts": { + "name": "idx_change_logs_sync_attempts", + "columns": [ + { + "expression": "sync_attempts", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.document_attachments": { + "name": "document_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "document_attachments_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "revision_id": { + "name": "revision_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "upload_id": { + "name": "upload_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "file_id": { + "name": "file_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "dolce_file_path": { + "name": "dolce_file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "document_attachments_revision_id_revisions_id_fk": { + "name": "document_attachments_revision_id_revisions_id_fk", + "tableFrom": "document_attachments", + "tableTo": "revisions", + "columnsFrom": [ + "revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.documents": { + "name": "documents", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "documents_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "drawing_move_gbn": { + "name": "drawing_move_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "discipline": { + "name": "discipline", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "external_document_id": { + "name": "external_document_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "external_system_type": { + "name": "external_system_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "external_synced_at": { + "name": "external_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "shi_drawing_no": { + "name": "shi_drawing_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager": { + "name": "manager", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_enm": { + "name": "manager_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_no": { + "name": "manager_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "register_group": { + "name": "register_group", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "register_group_id": { + "name": "register_group_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "create_user_no": { + "name": "create_user_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "create_user_id": { + "name": "create_user_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "create_user_enm": { + "name": "create_user_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_contract_doc_status": { + "name": "unique_contract_doc_status", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_contract_vendor_doc": { + "name": "unique_contract_vendor_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"vendor_doc_number\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_external_doc": { + "name": "unique_external_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_system_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"external_document_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "drawing_kind_idx": { + "name": "drawing_kind_idx", + "columns": [ + { + "expression": "drawing_kind", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "documents_contract_id_contracts_id_fk": { + "name": "documents_contract_id_contracts_id_fk", + "tableFrom": "documents", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.issue_stages": { + "name": "issue_stages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "issue_stages_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_name": { + "name": "stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "plan_date": { + "name": "plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "actual_date": { + "name": "actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "stage_status": { + "name": "stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "stage_order": { + "name": "stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "priority": { + "name": "priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'MEDIUM'" + }, + "assignee_id": { + "name": "assignee_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "assignee_name": { + "name": "assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "reminder_days": { + "name": "reminder_days", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_document_stage": { + "name": "unique_document_stage", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_stage_order": { + "name": "document_stage_order", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "issue_stages_document_id_documents_id_fk": { + "name": "issue_stages_document_id_documents_id_fk", + "tableFrom": "issue_stages", + "tableTo": "documents", + "columnsFrom": [ + "document_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.revisions": { + "name": "revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "revisions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "issue_stage_id": { + "name": "issue_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "revision": { + "name": "revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "uploader_type": { + "name": "uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'vendor'" + }, + "uploader_id": { + "name": "uploader_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploader_name": { + "name": "uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "usage": { + "name": "usage", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "revision_status": { + "name": "revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'SUBMITTED'" + }, + "submitted_date": { + "name": "submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "review_start_date": { + "name": "review_start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "approved_date": { + "name": "approved_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "rejected_date": { + "name": "rejected_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "reviewer_id": { + "name": "reviewer_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "review_comments": { + "name": "review_comments", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "external_upload_id": { + "name": "external_upload_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_stage_rev": { + "name": "unique_stage_rev", + "columns": [ + { + "expression": "issue_stage_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "revision", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_batches": { + "name": "sync_batches", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "batch_size": { + "name": "batch_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "retry_count": { + "name": "retry_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "change_log_ids": { + "name": "change_log_ids", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "success_count": { + "name": "success_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "failure_count": { + "name": "failure_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sync_metadata": { + "name": "sync_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_batches_contract_system": { + "name": "idx_sync_batches_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_status": { + "name": "idx_sync_batches_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_created_at": { + "name": "idx_sync_batches_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_configs": { + "name": "sync_configs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "sync_interval_minutes": { + "name": "sync_interval_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 30 + }, + "last_successful_sync": { + "name": "last_successful_sync", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_sync_attempt": { + "name": "last_sync_attempt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "endpoint_url": { + "name": "endpoint_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "auth_token": { + "name": "auth_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "api_version": { + "name": "api_version", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'v1'" + }, + "max_batch_size": { + "name": "max_batch_size", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 100 + }, + "retry_max_attempts": { + "name": "retry_max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_configs_contract_system": { + "name": "idx_sync_configs_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sync_configs_contract_id_contracts_id_fk": { + "name": "sync_configs_contract_id_contracts_id_fk", + "tableFrom": "sync_configs", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_attachments": { + "name": "vendor_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'GENERAL'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_attachments_vendor_id_vendors_id_fk": { + "name": "vendor_attachments_vendor_id_vendors_id_fk", + "tableFrom": "vendor_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidates": { + "name": "vendor_candidates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidates_vendor_id_vendors_id_fk": { + "name": "vendor_candidates_vendor_id_vendors_id_fk", + "tableFrom": "vendor_candidates", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_contacts": { + "name": "vendor_contacts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contact_name": { + "name": "contact_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_position": { + "name": "contact_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "is_primary": { + "name": "is_primary", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_contacts_vendor_id_vendors_id_fk": { + "name": "vendor_contacts_vendor_id_vendors_id_fk", + "tableFrom": "vendor_contacts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_items": { + "name": "vendor_possible_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_items_vendor_id_vendors_id_fk": { + "name": "vendor_possible_items_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_items_item_code_items_item_code_fk": { + "name": "vendor_possible_items_item_code_items_item_code_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_materials": { + "name": "vendor_possible_materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_materials_vendor_id_vendors_id_fk": { + "name": "vendor_possible_materials_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_materials_item_code_materials_item_code_fk": { + "name": "vendor_possible_materials_item_code_materials_item_code_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "materials", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_types": { + "name": "vendor_types", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_types_code_unique": { + "name": "vendor_types_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors": { + "name": "vendors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "vendor_type_id": { + "name": "vendor_type_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_vendor_type_id_vendor_types_id_fk": { + "name": "vendors_vendor_type_id_vendor_types_id_fk", + "tableFrom": "vendors", + "tableTo": "vendor_types", + "columnsFrom": [ + "vendor_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tasks": { + "name": "tasks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'todo'" + }, + "label": { + "name": "label", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'bug'" + }, + "priority": { + "name": "priority", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'low'" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "current_timestamp" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tasks_code_unique": { + "name": "tasks_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidate_logs": { + "name": "vendor_candidate_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_candidate_id": { + "name": "vendor_candidate_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk": { + "name": "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "vendor_candidates", + "columnsFrom": [ + "vendor_candidate_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_candidate_logs_user_id_users_id_fk": { + "name": "vendor_candidate_logs_user_id_users_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors_logs": { + "name": "vendors_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_logs_vendor_id_vendors_id_fk": { + "name": "vendors_logs_vendor_id_vendors_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendors_logs_user_id_users_id_fk": { + "name": "vendors_logs_user_id_users_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract": { + "name": "basic_contract", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_id": { + "name": "template_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requested_by": { + "name": "requested_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "basic_contract_template_id_basic_contract_templates_id_fk": { + "name": "basic_contract_template_id_basic_contract_templates_id_fk", + "tableFrom": "basic_contract", + "tableTo": "basic_contract_templates", + "columnsFrom": [ + "template_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_vendor_id_vendors_id_fk": { + "name": "basic_contract_vendor_id_vendors_id_fk", + "tableFrom": "basic_contract", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_requested_by_users_id_fk": { + "name": "basic_contract_requested_by_users_id_fk", + "tableFrom": "basic_contract", + "tableTo": "users", + "columnsFrom": [ + "requested_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract_templates": { + "name": "basic_contract_templates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_templates_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_name": { + "name": "template_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "validity_period": { + "name": "validity_period", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.incoterms": { + "name": "incoterms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(20)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "incoterms_created_by_users_id_fk": { + "name": "incoterms_created_by_users_id_fk", + "tableFrom": "incoterms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payment_terms": { + "name": "payment_terms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "payment_terms_created_by_users_id_fk": { + "name": "payment_terms_created_by_users_id_fk", + "tableFrom": "payment_terms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pr_items": { + "name": "pr_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "pr_items", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_attachments": { + "name": "procurement_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "procurement_rfq_details_id": { + "name": "procurement_rfq_details_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk": { + "name": "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfq_details", + "columnsFrom": [ + "procurement_rfq_details_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_created_by_users_id_fk": { + "name": "procurement_attachments_created_by_users_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "attachment_type_check": { + "name": "attachment_type_check", + "value": "\"procurement_attachments\".\"procurement_rfqs_id\" IS NOT NULL OR \"procurement_attachments\".\"procurement_rfq_details_id\" IS NOT NULL" + } + }, + "isRLSEnabled": false + }, + "public.procurement_quotation_items": { + "name": "procurement_quotation_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pr_item_id": { + "name": "pr_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "material_code": { + "name": "material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "uom": { + "name": "uom", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "unit_price": { + "name": "unit_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "vendor_material_code": { + "name": "vendor_material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_material_description": { + "name": "vendor_material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "lead_time_in_days": { + "name": "lead_time_in_days", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_rate": { + "name": "discount_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_amount": { + "name": "discount_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_alternative": { + "name": "is_alternative", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_recommended": { + "name": "is_recommended", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_quotation_items_pr_item_id_pr_items_id_fk": { + "name": "procurement_quotation_items_pr_item_id_pr_items_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "pr_items", + "columnsFrom": [ + "pr_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_attachments": { + "name": "procurement_rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_uploaded_by_users_id_fk": { + "name": "procurement_rfq_attachments_uploaded_by_users_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_comments": { + "name": "procurement_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_comments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_user_id_users_id_fk": { + "name": "procurement_rfq_comments_user_id_users_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_details": { + "name": "procurement_rfq_details", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendors_id": { + "name": "vendors_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'VV'" + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_vendors_id_vendors_id_fk": { + "name": "procurement_rfq_details_vendors_id_vendors_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "vendors", + "columnsFrom": [ + "vendors_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_rfq_details_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_incoterms_code_incoterms_code_fk": { + "name": "procurement_rfq_details_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_updated_by_users_id_fk": { + "name": "procurement_rfq_details_updated_by_users_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfqs": { + "name": "procurement_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "series": { + "name": "series", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "rfq_sealed_yn": { + "name": "rfq_sealed_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfqs_project_id_projects_id_fk": { + "name": "procurement_rfqs_project_id_projects_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_sent_by_users_id_fk": { + "name": "procurement_rfqs_sent_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_created_by_users_id_fk": { + "name": "procurement_rfqs_created_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_updated_by_users_id_fk": { + "name": "procurement_rfqs_updated_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "procurement_rfqs_rfq_code_unique": { + "name": "procurement_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_vendor_quotations": { + "name": "procurement_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_items_count": { + "name": "total_items_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sub_total": { + "name": "sub_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "tax_total": { + "name": "tax_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "discount_total": { + "name": "discount_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "estimated_delivery_date": { + "name": "estimated_delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "procurement_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_incoterms_code_incoterms_code_fk": { + "name": "procurement_vendor_quotations_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.preset_shares": { + "name": "preset_shares", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "preset_id": { + "name": "preset_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "shared_with_user_id": { + "name": "shared_with_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'read'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "preset_shares_preset_id_table_presets_id_fk": { + "name": "preset_shares_preset_id_table_presets_id_fk", + "tableFrom": "preset_shares", + "tableTo": "table_presets", + "columnsFrom": [ + "preset_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_presets": { + "name": "table_presets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_shared": { + "name": "is_shared", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_attachments": { + "name": "tech_sales_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "tech_sales_rfq_id": { + "name": "tech_sales_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "tech_sales_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_attachments_created_by_users_id_fk": { + "name": "tech_sales_attachments_created_by_users_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comment_attachments": { + "name": "tech_sales_rfq_comment_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk": { + "name": "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk": { + "name": "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comments": { + "name": "tech_sales_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_user_id_users_id_fk": { + "name": "tech_sales_rfq_comments_user_id_users_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfqs": { + "name": "tech_sales_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_shipbuilding_id": { + "name": "item_shipbuilding_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "bidding_project_id": { + "name": "bidding_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_snapshot": { + "name": "project_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "series_snapshot": { + "name": "series_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk": { + "name": "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "item_shipbuilding", + "columnsFrom": [ + "item_shipbuilding_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk": { + "name": "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bidding_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_sent_by_users_id_fk": { + "name": "tech_sales_rfqs_sent_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_created_by_users_id_fk": { + "name": "tech_sales_rfqs_created_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_updated_by_users_id_fk": { + "name": "tech_sales_rfqs_updated_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tech_sales_rfqs_rfq_code_unique": { + "name": "tech_sales_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_vendor_quotations": { + "name": "tech_sales_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "tech_sales_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rotation_attempts": { + "name": "ocr_rotation_attempts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "rotation": { + "name": "rotation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "tables_found": { + "name": "tables_found", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "text_quality": { + "name": "text_quality", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "keyword_count": { + "name": "keyword_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "score": { + "name": "score", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "extracted_rows_count": { + "name": "extracted_rows_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_rotation_attempts_session_id_ocr_sessions_id_fk": { + "name": "ocr_rotation_attempts_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rotation_attempts", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rows": { + "name": "ocr_rows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "table_id": { + "name": "table_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "row_index": { + "name": "row_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "report_no": { + "name": "report_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "no": { + "name": "no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "identification_no": { + "name": "identification_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_no": { + "name": "joint_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_type": { + "name": "joint_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "welding_date": { + "name": "welding_date", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "source_table": { + "name": "source_table", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "source_row": { + "name": "source_row", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_ocr_report_no_unique": { + "name": "idx_ocr_report_no_unique", + "columns": [ + { + "expression": "report_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "tag_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "joint_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "joint_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "ocr_rows_table_id_ocr_tables_id_fk": { + "name": "ocr_rows_table_id_ocr_tables_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_tables", + "columnsFrom": [ + "table_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_session_id_ocr_sessions_id_fk": { + "name": "ocr_rows_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_user_id_users_id_fk": { + "name": "ocr_rows_user_id_users_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_sessions": { + "name": "ocr_sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "processing_time": { + "name": "processing_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "best_rotation": { + "name": "best_rotation", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_tables": { + "name": "total_tables", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_rows": { + "name": "total_rows", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "image_enhanced": { + "name": "image_enhanced", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pdf_converted": { + "name": "pdf_converted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "success": { + "name": "success", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "warnings": { + "name": "warnings", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_tables": { + "name": "ocr_tables", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "table_index": { + "name": "table_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "row_count": { + "name": "row_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_tables_session_id_ocr_sessions_id_fk": { + "name": "ocr_tables_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_tables", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.b_rfq_attachment_revisions": { + "name": "b_rfq_attachment_revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_id": { + "name": "attachment_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "revision_no": { + "name": "revision_no", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "is_latest": { + "name": "is_latest", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "revision_comment": { + "name": "revision_comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "latest_revision_idx": { + "name": "latest_revision_idx", + "columns": [ + { + "expression": "attachment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_latest", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "b_rfq_attachment_revisions_attachment_id_b_rfq_attachments_id_fk": { + "name": "b_rfq_attachment_revisions_attachment_id_b_rfq_attachments_id_fk", + "tableFrom": "b_rfq_attachment_revisions", + "tableTo": "b_rfq_attachments", + "columnsFrom": [ + "attachment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "b_rfq_attachment_revisions_created_by_users_id_fk": { + "name": "b_rfq_attachment_revisions_created_by_users_id_fk", + "tableFrom": "b_rfq_attachment_revisions", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.b_rfqs": { + "name": "b_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pic_name": { + "name": "pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "eng_pic_name": { + "name": "eng_pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_company": { + "name": "project_company", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_flag": { + "name": "project_flag", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_site": { + "name": "project_site", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "package_no": { + "name": "package_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "package_name": { + "name": "package_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "b_rfqs_project_id_projects_id_fk": { + "name": "b_rfqs_project_id_projects_id_fk", + "tableFrom": "b_rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "b_rfqs_created_by_users_id_fk": { + "name": "b_rfqs_created_by_users_id_fk", + "tableFrom": "b_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "b_rfqs_updated_by_users_id_fk": { + "name": "b_rfqs_updated_by_users_id_fk", + "tableFrom": "b_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "b_rfqs_rfq_code_unique": { + "name": "b_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.b_rfq_attachments": { + "name": "b_rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "serial_no": { + "name": "serial_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "b_rfq_attachments_rfq_id_b_rfqs_id_fk": { + "name": "b_rfq_attachments_rfq_id_b_rfqs_id_fk", + "tableFrom": "b_rfq_attachments", + "tableTo": "b_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "b_rfq_attachments_created_by_users_id_fk": { + "name": "b_rfq_attachments_created_by_users_id_fk", + "tableFrom": "b_rfq_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.final_rfq": { + "name": "final_rfq", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "final_rfq_status": { + "name": "final_rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "valid_date": { + "name": "valid_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "gtc": { + "name": "gtc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "gtc_valid_date": { + "name": "gtc_valid_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sparepart": { + "name": "sparepart", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "short_list": { + "name": "short_list", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "return_yn": { + "name": "return_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "cp_request_yn": { + "name": "cp_request_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "prject_gtc_yn": { + "name": "prject_gtc_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "return_revision": { + "name": "return_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'VV'" + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "firsttime_yn": { + "name": "firsttime_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vendor_remark": { + "name": "vendor_remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "final_rfq_rfq_id_b_rfqs_id_fk": { + "name": "final_rfq_rfq_id_b_rfqs_id_fk", + "tableFrom": "final_rfq", + "tableTo": "b_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "final_rfq_vendor_id_vendors_id_fk": { + "name": "final_rfq_vendor_id_vendors_id_fk", + "tableFrom": "final_rfq", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "final_rfq_incoterms_code_incoterms_code_fk": { + "name": "final_rfq_incoterms_code_incoterms_code_fk", + "tableFrom": "final_rfq", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "final_rfq_payment_terms_code_payment_terms_code_fk": { + "name": "final_rfq_payment_terms_code_payment_terms_code_fk", + "tableFrom": "final_rfq", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.initial_rfq": { + "name": "initial_rfq", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "initial_rfq_status": { + "name": "initial_rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "valid_date": { + "name": "valid_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "gtc": { + "name": "gtc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "gtc_valid_date": { + "name": "gtc_valid_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sparepart": { + "name": "sparepart", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "short_list": { + "name": "short_list", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "return_yn": { + "name": "return_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "cp_request_yn": { + "name": "cp_request_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "prject_gtc_yn": { + "name": "prject_gtc_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "return_revision": { + "name": "return_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "initial_rfq_rfq_id_b_rfqs_id_fk": { + "name": "initial_rfq_rfq_id_b_rfqs_id_fk", + "tableFrom": "initial_rfq", + "tableTo": "b_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "initial_rfq_vendor_id_vendors_id_fk": { + "name": "initial_rfq_vendor_id_vendors_id_fk", + "tableFrom": "initial_rfq", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "initial_rfq_incoterms_code_incoterms_code_fk": { + "name": "initial_rfq_incoterms_code_incoterms_code_fk", + "tableFrom": "initial_rfq", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_attachment_responses": { + "name": "vendor_attachment_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_id": { + "name": "attachment_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "rfq_record_id": { + "name": "rfq_record_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'NOT_RESPONDED'" + }, + "current_revision": { + "name": "current_revision", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'Rev.0'" + }, + "responded_revision": { + "name": "responded_revision", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "response_comment": { + "name": "response_comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vendor_comment": { + "name": "vendor_comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "responded_at": { + "name": "responded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "vendor_response_idx": { + "name": "vendor_response_idx", + "columns": [ + { + "expression": "attachment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "rfq_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_attachment_responses_attachment_id_b_rfq_attachments_id_fk": { + "name": "vendor_attachment_responses_attachment_id_b_rfq_attachments_id_fk", + "tableFrom": "vendor_attachment_responses", + "tableTo": "b_rfq_attachments", + "columnsFrom": [ + "attachment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_attachment_responses_vendor_id_vendors_id_fk": { + "name": "vendor_attachment_responses_vendor_id_vendors_id_fk", + "tableFrom": "vendor_attachment_responses", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_attachments_b": { + "name": "vendor_response_attachments_b", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_response_id": { + "name": "vendor_response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_attachments_b_vendor_response_id_vendor_attachment_responses_id_fk": { + "name": "vendor_response_attachments_b_vendor_response_id_vendor_attachment_responses_id_fk", + "tableFrom": "vendor_response_attachments_b", + "tableTo": "vendor_attachment_responses", + "columnsFrom": [ + "vendor_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_b_uploaded_by_users_id_fk": { + "name": "vendor_response_attachments_b_uploaded_by_users_id_fk", + "tableFrom": "vendor_response_attachments_b", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_history": { + "name": "vendor_response_history", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_response_id": { + "name": "vendor_response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "previous_status": { + "name": "previous_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "action_by": { + "name": "action_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "action_at": { + "name": "action_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_history_vendor_response_id_vendor_attachment_responses_id_fk": { + "name": "vendor_response_history_vendor_response_id_vendor_attachment_responses_id_fk", + "tableFrom": "vendor_response_history", + "tableTo": "vendor_attachment_responses", + "columnsFrom": [ + "vendor_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_history_action_by_users_id_fk": { + "name": "vendor_response_history_action_by_users_id_fk", + "tableFrom": "vendor_response_history", + "tableTo": "users", + "columnsFrom": [ + "action_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.offshore_hull_work_type": { + "name": "offshore_hull_work_type", + "schema": "public", + "values": [ + "HA", + "HE", + "HH", + "HM", + "NC" + ] + }, + "public.offshore_top_work_type": { + "name": "offshore_top_work_type", + "schema": "public", + "values": [ + "TM", + "TS", + "TE", + "TP" + ] + }, + "public.work_type": { + "name": "work_type", + "schema": "public", + "values": [ + "기장", + "전장", + "선실", + "배관", + "철의" + ] + }, + "public.user_domain": { + "name": "user_domain", + "schema": "public", + "values": [ + "evcp", + "partners" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": { + "public.contracts_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"contracts\".\"id\", \"contracts\".\"contract_no\", \"contracts\".\"contract_name\", \"contracts\".\"status\", \"contracts\".\"start_date\", \"contracts\".\"end_date\", \"contracts\".\"project_id\", \"projects\".\"code\", \"projects\".\"name\", \"contracts\".\"vendor_id\", \"vendors\".\"vendor_name\", \"contracts\".\"payment_terms\", \"contracts\".\"delivery_terms\", \"contracts\".\"delivery_date\", \"contracts\".\"delivery_location\", \"contracts\".\"currency\", \"contracts\".\"total_amount\", \"contracts\".\"discount\", \"contracts\".\"tax\", \"contracts\".\"shipping_fee\", \"contracts\".\"net_total\", \"contracts\".\"partial_shipping_allowed\", \"contracts\".\"partial_payment_allowed\", \"contracts\".\"remarks\", \"contracts\".\"version\", \"contracts\".\"created_at\", \"contracts\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"contracts\".\"id\"\n ) as \"has_signature\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "contracts_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.poa_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", + "name": "poa_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.project_approved_vendors": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"status\", \"vendor_types\".\"name_ko\", \"vendor_types\".\"name_en\", \"projects\".\"code\", \"projects\".\"name\", \"projects\".\"type\", \"vendor_pq_submissions\".\"submitted_at\", \"vendor_pq_submissions\".\"approved_at\" from \"vendors\" inner join \"vendor_pq_submissions\" on \"vendor_pq_submissions\".\"vendor_id\" = \"vendors\".\"id\" inner join \"projects\" on \"vendor_pq_submissions\".\"project_id\" = \"projects\".\"id\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\" where \"vendor_pq_submissions\".\"status\" = 'APPROVED'", + "name": "project_approved_vendors", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_investigations_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"vendor_id\", \"vendor_investigations\".\"pq_submission_id\", \"vendor_investigations\".\"requester_id\", \"vendor_investigations\".\"qm_manager_id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"evaluation_type\", \"vendor_investigations\".\"investigation_address\", \"vendor_investigations\".\"investigation_method\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"forecasted_at\", \"vendor_investigations\".\"requested_at\", \"vendor_investigations\".\"confirmed_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"evaluation_score\", \"vendor_investigations\".\"evaluation_result\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", requester.name as \"requesterName\", requester.email as \"requesterEmail\", qm_manager.name as \"qmManagerName\", qm_manager.email as \"qmManagerEmail\", (\n CASE \n WHEN EXISTS (\n SELECT 1 FROM vendor_investigation_attachments via \n WHERE via.investigation_id = \"vendor_investigations\".\"id\"\n ) \n THEN true \n ELSE false \n END\n ) as \"hasAttachments\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\" left join users AS requester on \"vendor_investigations\".\"requester_id\" = requester.id left join users AS qm_manager on \"vendor_investigations\".\"qm_manager_id\" = qm_manager.id", + "name": "vendor_investigations_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.cbe_view": { + "columns": {}, + "definition": "select \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"rfq_id\" as \"rfq_id\", \"cbe_evaluations\".\"vendor_id\" as \"vendor_id\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"result\" as \"result\", \"cbe_evaluations\".\"notes\" as \"notes\", \"cbe_evaluations\".\"evaluated_by\" as \"evaluated_by\", \"cbe_evaluations\".\"evaluated_at\" as \"evaluated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"name\" as \"evaluator_name\", \"users\".\"email\" as \"evaluator_email\" from \"cbe_evaluations\" inner join \"rfqs\" on \"cbe_evaluations\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"cbe_evaluations\".\"evaluated_by\" = \"users\".\"id\"", + "name": "cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.rfqs_view": { + "columns": {}, + "definition": "select \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"rfqs\".\"parent_rfq_id\" as \"parent_rfq_id\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"email\" as \"user_email\", \"users\".\"name\" as \"user_name\", (\n SELECT COUNT(*) \n FROM \"rfq_items\" \n WHERE \"rfq_items\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"item_count\", (\n SELECT COUNT(*) \n FROM \"rfq_attachments\" \n WHERE \"rfq_attachments\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"attachment_count\" from \"rfqs\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"rfqs\".\"created_by\" = \"users\".\"id\"", + "name": "rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_cbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", \"cbe_evaluations\".\"notes\" as \"cbe_note\", \"cbe_evaluations\".\"updated_at\" as \"cbe_updated\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"delivery_schedule\" as \"delivery_schedule\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_response_cbe_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"notes\" as \"response_notes\", \"vendor_responses\".\"responded_by\" as \"responded_by\", \"vendor_responses\".\"responded_at\" as \"responded_at\", \"vendor_responses\".\"updated_at\" as \"response_updated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"status\" as \"vendor_status\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"response_status\" as \"commercial_response_status\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"vendor_commercial_responses\".\"payment_terms\" as \"payment_terms\", \"vendor_commercial_responses\".\"incoterms\" as \"incoterms\", \"vendor_commercial_responses\".\"delivery_period\" as \"delivery_period\", \"vendor_commercial_responses\".\"warranty_period\" as \"warranty_period\", \"vendor_commercial_responses\".\"validity_period\" as \"validity_period\", \"vendor_commercial_responses\".\"price_breakdown\" as \"price_breakdown\", \"vendor_commercial_responses\".\"commercial_notes\" as \"commercial_notes\", \"vendor_commercial_responses\".\"created_at\" as \"commercial_created_at\", \"vendor_commercial_responses\".\"updated_at\" as \"commercial_updated_at\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"commercial_response_id\" = \"vendor_commercial_responses\".\"id\"\n ) as \"commercial_attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n AND \"vendor_response_attachments\".\"attachment_type\" = 'TECHNICAL_SPEC'\n ) as \"technical_attachment_count\", (\n SELECT MAX(\"uploaded_at\") \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"latest_attachment_date\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\"", + "name": "vendor_response_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_responses_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"created_at\" as \"rfq_created_at\", \"rfqs\".\"updated_at\" as \"rfq_updated_at\", \"rfqs\".\"created_by\" as \"rfq_created_by\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"responded_at\" as \"responded_at\", CASE WHEN \"vendor_technical_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_technical_response\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", CASE WHEN \"vendor_commercial_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_commercial_response\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"rfq_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE') left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"cbe_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\")", + "name": "vendor_responses_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_rfq_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", + "name": "vendor_rfq_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_tbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", \"vendor_technical_responses\".\"response_status\" as \"technical_response_status\", \"vendor_technical_responses\".\"summary\" as \"technical_summary\", \"vendor_technical_responses\".\"notes\" as \"technical_notes\", \"vendor_technical_responses\".\"updated_at\" as \"technical_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"rfq_evaluations\".\"notes\" as \"tbe_note\", \"rfq_evaluations\".\"updated_at\" as \"tbe_updated\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_tbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.role_view": { + "columns": {}, + "definition": "select \"roles\".\"id\" as \"id\", \"roles\".\"name\" as \"name\", \"roles\".\"description\" as \"description\", \"roles\".\"domain\" as \"domain\", \"roles\".\"created_at\" as \"created_at\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", COUNT(\"users\".\"id\") as \"user_count\" from \"roles\" left join \"user_roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" left join \"users\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"vendors\" on \"roles\".\"company_id\" = \"vendors\".\"id\" group by \"roles\".\"id\", \"vendors\".\"id\"", + "name": "role_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.user_view": { + "columns": {}, + "definition": "select \"users\".\"id\" as \"user_id\", \"users\".\"name\" as \"user_name\", \"users\".\"email\" as \"user_email\", \"users\".\"domain\" as \"user_domain\", \"users\".\"image_url\" as \"user_image\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"vendors\" on \"users\".\"company_id\" = \"vendors\".\"id\" left join \"user_roles\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" group by \"users\".\"id\", \"vendors\".\"id\"", + "name": "user_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.form_lists_view": { + "columns": {}, + "definition": "select \"tag_type_class_form_mappings\".\"id\" as \"id\", \"tag_type_class_form_mappings\".\"project_id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"tag_type_class_form_mappings\".\"tag_type_label\" as \"tag_type_label\", \"tag_type_class_form_mappings\".\"class_label\" as \"class_label\", \"tag_type_class_form_mappings\".\"form_code\" as \"form_code\", \"tag_type_class_form_mappings\".\"form_name\" as \"form_name\", \"tag_type_class_form_mappings\".\"ep\" as \"ep\", \"tag_type_class_form_mappings\".\"remark\" as \"remark\", \"tag_type_class_form_mappings\".\"created_at\" as \"created_at\", \"tag_type_class_form_mappings\".\"updated_at\" as \"updated_at\" from \"tag_type_class_form_mappings\" inner join \"projects\" on \"tag_type_class_form_mappings\".\"project_id\" = \"projects\".\"id\"", + "name": "form_lists_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.view_tag_subfields": { + "columns": { + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "definition": "select \"tag_subfields\".\"id\" as \"id\", \"tag_subfields\".\"tag_type_code\", \"tag_types\".\"description\", \"tag_subfields\".\"attributes_id\", \"tag_subfields\".\"attributes_description\", \"tag_subfields\".\"expression\", \"tag_subfields\".\"delimiter\", \"tag_subfields\".\"sort_order\", \"tag_subfields\".\"created_at\", \"tag_subfields\".\"updated_at\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\", \"projects\".\"name\" from \"tag_subfields\" inner join \"tag_types\" on (\"tag_subfields\".\"tag_type_code\" = \"tag_types\".\"code\" and \"tag_subfields\".\"project_id\" = \"tag_types\".\"project_id\") inner join \"projects\" on \"tag_subfields\".\"project_id\" = \"projects\".\"id\"", + "name": "view_tag_subfields", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.document_stages_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_count": { + "name": "stage_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_list": { + "name": "stage_list", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT\n d.id AS document_id,\n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n d.contract_id,\n (SELECT COUNT(*) FROM issue_stages WHERE document_id = d.id) AS stage_count,\n COALESCE( \n (SELECT json_agg(i.stage_name) FROM issue_stages i WHERE i.document_id = d.id), \n '[]'\n ) AS stage_list,\n d.created_at,\n d.updated_at\n FROM documents d\n", + "name": "document_stages_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.enhanced_documents_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_id": { + "name": "current_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_name": { + "name": "current_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_status": { + "name": "current_stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_order": { + "name": "current_stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_plan_date": { + "name": "current_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_actual_date": { + "name": "current_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_assignee_name": { + "name": "current_stage_assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_priority": { + "name": "current_stage_priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "days_until_due": { + "name": "days_until_due", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_overdue": { + "name": "is_overdue", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "days_difference": { + "name": "days_difference", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "total_stages": { + "name": "total_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "completed_stages": { + "name": "completed_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "progress_percentage": { + "name": "progress_percentage", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_status": { + "name": "latest_revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_submitted_date": { + "name": "latest_submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "all_stages": { + "name": "all_stages", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n WITH document_stats AS (\n SELECT \n d.id as document_id,\n COUNT(ist.id) as total_stages,\n COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) as completed_stages,\n CASE \n WHEN COUNT(ist.id) > 0 \n THEN ROUND((COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) * 100.0) / COUNT(ist.id))\n ELSE 0 \n END as progress_percentage\n FROM documents d\n LEFT JOIN issue_stages ist ON d.id = ist.document_id\n GROUP BY d.id\n ),\n current_stage_info AS (\n SELECT DISTINCT ON (document_id)\n document_id,\n id as current_stage_id,\n stage_name as current_stage_name,\n stage_status as current_stage_status,\n stage_order as current_stage_order,\n plan_date as current_stage_plan_date,\n actual_date as current_stage_actual_date,\n assignee_name as current_stage_assignee_name,\n priority as current_stage_priority,\n CASE \n WHEN actual_date IS NULL AND plan_date IS NOT NULL \n THEN plan_date - CURRENT_DATE\n ELSE NULL \n END as days_until_due,\n CASE \n WHEN actual_date IS NULL AND plan_date < CURRENT_DATE \n THEN true\n WHEN actual_date IS NOT NULL AND actual_date > plan_date \n THEN true\n ELSE false \n END as is_overdue,\n CASE \n WHEN actual_date IS NOT NULL AND plan_date IS NOT NULL \n THEN actual_date - plan_date\n ELSE NULL \n END as days_difference\n FROM issue_stages\n WHERE stage_status NOT IN ('COMPLETED', 'APPROVED')\n ORDER BY document_id, stage_order ASC, priority DESC\n ),\n latest_revision_info AS (\n SELECT DISTINCT ON (ist.document_id)\n ist.document_id,\n r.id as latest_revision_id,\n r.revision as latest_revision,\n r.revision_status as latest_revision_status,\n r.uploader_name as latest_revision_uploader_name,\n r.submitted_date as latest_submitted_date\n FROM revisions r\n JOIN issue_stages ist ON r.issue_stage_id = ist.id\n ORDER BY ist.document_id, r.created_at DESC\n ),\n -- 리비전별 첨부파일 집계\n revision_attachments AS (\n SELECT \n r.id as revision_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', da.id,\n 'revisionId', da.revision_id,\n 'fileName', da.file_name,\n 'filePath', da.file_path,\n 'fileSize', da.file_size,\n 'fileType', da.file_type,\n 'createdAt', da.created_at,\n 'updatedAt', da.updated_at\n ) ORDER BY da.created_at\n ) FILTER (WHERE da.id IS NOT NULL),\n '[]'::json\n ) as attachments\n FROM revisions r\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY r.id\n ),\n -- 스테이지별 리비전 집계 (첨부파일 포함)\n stage_revisions AS (\n SELECT \n ist.id as stage_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', r.id,\n 'issueStageId', r.issue_stage_id,\n 'revision', r.revision,\n 'uploaderType', r.uploader_type,\n 'uploaderId', r.uploader_id,\n 'uploaderName', r.uploader_name,\n 'comment', r.comment,\n 'usage', r.usage,\n 'revisionStatus', r.revision_status,\n 'submittedDate', r.submitted_date,\n 'uploadedAt', r.uploaded_at,\n 'approvedDate', r.approved_date,\n 'reviewStartDate', r.review_start_date,\n 'rejectedDate', r.rejected_date,\n 'reviewerId', r.reviewer_id,\n 'reviewerName', r.reviewer_name,\n 'reviewComments', r.review_comments,\n 'createdAt', r.created_at,\n 'updatedAt', r.updated_at,\n 'attachments', ra.attachments\n ) ORDER BY r.created_at\n ) FILTER (WHERE r.id IS NOT NULL),\n '[]'::json\n ) as revisions\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN revision_attachments ra ON r.id = ra.revision_id\n GROUP BY ist.id\n ),\n -- 문서별 스테이지 집계 (리비전 포함)\n stage_aggregation AS (\n SELECT \n ist.document_id,\n json_agg(\n json_build_object(\n 'id', ist.id,\n 'stageName', ist.stage_name,\n 'stageStatus', ist.stage_status,\n 'stageOrder', ist.stage_order,\n 'planDate', ist.plan_date,\n 'actualDate', ist.actual_date,\n 'assigneeName', ist.assignee_name,\n 'priority', ist.priority,\n 'revisions', sr.revisions\n ) ORDER BY ist.stage_order\n ) as all_stages\n FROM issue_stages ist\n LEFT JOIN stage_revisions sr ON ist.id = sr.stage_id\n GROUP BY ist.document_id\n ),\n attachment_counts AS (\n SELECT \n ist.document_id,\n COUNT(da.id) as attachment_count\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY ist.document_id\n )\n \n SELECT \n d.id as document_id,\n d.doc_number,\n d.drawing_kind,\n d.vendor_doc_number, -- ✅ 벤더 문서 번호 추가\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n\n d.c_gbn,\n d.d_gbn,\n d.degree_gbn,\n d.dept_gbn,\n d.s_gbn,\n\n\n \n -- ✅ 프로젝트 및 벤더 정보 추가\n p.code as project_code,\n v.vendor_name as vendor_name,\n v.vendor_code as vendor_code,\n \n -- 현재 스테이지 정보\n csi.current_stage_id,\n csi.current_stage_name,\n csi.current_stage_status,\n csi.current_stage_order,\n csi.current_stage_plan_date,\n csi.current_stage_actual_date,\n csi.current_stage_assignee_name,\n csi.current_stage_priority,\n \n -- 계산 필드\n csi.days_until_due,\n csi.is_overdue,\n csi.days_difference,\n \n -- 진행률 정보\n ds.total_stages,\n ds.completed_stages,\n ds.progress_percentage,\n \n -- 최신 리비전 정보\n lri.latest_revision_id,\n lri.latest_revision,\n lri.latest_revision_status,\n lri.latest_revision_uploader_name,\n lri.latest_submitted_date,\n \n -- 전체 스테이지 (리비전 및 첨부파일 포함)\n COALESCE(sa.all_stages, '[]'::json) as all_stages,\n \n -- 기타\n COALESCE(ac.attachment_count, 0) as attachment_count,\n d.created_at,\n d.updated_at\n \n FROM documents d\n -- ✅ contracts, projects, vendors 테이블 JOIN 추가\n LEFT JOIN contracts c ON d.contract_id = c.id\n LEFT JOIN projects p ON c.project_id = p.id\n LEFT JOIN vendors v ON c.vendor_id = v.id\n \n LEFT JOIN document_stats ds ON d.id = ds.document_id\n LEFT JOIN current_stage_info csi ON d.id = csi.document_id\n LEFT JOIN latest_revision_info lri ON d.id = lri.document_id\n LEFT JOIN stage_aggregation sa ON d.id = sa.document_id\n LEFT JOIN attachment_counts ac ON d.id = ac.document_id\n \n ORDER BY d.created_at DESC\n", + "name": "enhanced_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.sync_status_view": { + "columns": { + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "total_changes": { + "name": "total_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pending_changes": { + "name": "pending_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "synced_changes": { + "name": "synced_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "failed_changes": { + "name": "failed_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "last_sync_at": { + "name": "last_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_sync_at": { + "name": "next_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n WITH change_stats AS (\n SELECT \n cl.contract_id,\n sc.target_system,\n COUNT(*) as total_changes,\n COUNT(CASE WHEN cl.is_synced = false AND cl.sync_attempts < sc.retry_max_attempts THEN 1 END) as pending_changes,\n COUNT(CASE WHEN cl.is_synced = true THEN 1 END) as synced_changes,\n COUNT(CASE WHEN cl.sync_attempts >= sc.retry_max_attempts AND cl.is_synced = false THEN 1 END) as failed_changes,\n MAX(cl.synced_at) as last_sync_at\n FROM change_logs cl\n CROSS JOIN sync_configs sc \n WHERE cl.contract_id = sc.contract_id\n AND (cl.target_systems IS NULL OR cl.target_systems @> to_jsonb(sc.target_system))\n GROUP BY cl.contract_id, sc.target_system\n )\n SELECT \n cs.contract_id,\n cs.target_system,\n COALESCE(cs.total_changes, 0) as total_changes,\n COALESCE(cs.pending_changes, 0) as pending_changes,\n COALESCE(cs.synced_changes, 0) as synced_changes,\n COALESCE(cs.failed_changes, 0) as failed_changes,\n cs.last_sync_at,\n CASE \n WHEN sc.sync_enabled = true AND sc.last_successful_sync IS NOT NULL \n THEN sc.last_successful_sync + (sc.sync_interval_minutes || ' minutes')::interval\n ELSE NULL\n END as next_sync_at,\n sc.sync_enabled\n FROM sync_configs sc\n LEFT JOIN change_stats cs ON sc.contract_id = cs.contract_id AND sc.target_system = cs.target_system\n", + "name": "sync_status_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_documents_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "latest_stage_id": { + "name": "latest_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_stage_name": { + "name": "latest_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_stage_plan_date": { + "name": "latest_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_stage_actual_date": { + "name": "latest_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_type": { + "name": "latest_revision_uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT \n d.id, \n d.doc_number,\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n (SELECT id FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_id,\n (SELECT stage_name FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_name,\n (SELECT plan_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_plan_date,\n (SELECT actual_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_actual_date,\n \n (SELECT r.id FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_id,\n (SELECT r.revision FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision,\n (SELECT r.uploader_type FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_type,\n (SELECT r.uploader_name FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_name,\n \n (SELECT COUNT(*) FROM document_attachments a JOIN revisions r ON a.revision_id = r.id JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id) AS attachment_count,\n \n d.created_at,\n d.updated_at\n FROM documents d\n JOIN contracts c ON d.contract_id = c.id\n ", + "name": "vendor_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_candidates_with_vendor_info": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_candidates\".\"id\", \"vendor_candidates\".\"company_name\", \"vendor_candidates\".\"contact_email\", \"vendor_candidates\".\"contact_phone\", \"vendor_candidates\".\"tax_id\", \"vendor_candidates\".\"address\", \"vendor_candidates\".\"country\", \"vendor_candidates\".\"source\", \"vendor_candidates\".\"status\", \"vendor_candidates\".\"items\", \"vendor_candidates\".\"remark\", \"vendor_candidates\".\"created_at\", \"vendor_candidates\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"created_at\" as \"vendor_created_at\", (\n SELECT l2.\"created_at\"\n FROM \"vendor_candidate_logs\" l2\n WHERE l2.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l2.\"action\" = 'status_change'\n ORDER BY l2.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_at\", (\n SELECT u.\"name\"\n FROM \"users\" u\n JOIN \"vendor_candidate_logs\" l3\n ON l3.\"user_id\" = u.\"id\"\n WHERE l3.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l3.\"action\" = 'status_change'\n ORDER BY l3.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_by\", (\n SELECT l4.\"created_at\"\n FROM \"vendor_candidate_logs\" l4\n WHERE l4.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l4.\"action\" = 'invite_sent'\n ORDER BY l4.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_at\", (\n SELECT u2.\"name\"\n FROM \"users\" u2\n JOIN \"vendor_candidate_logs\" l5\n ON l5.\"user_id\" = u2.\"id\"\n WHERE l5.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l5.\"action\" = 'invite_sent'\n ORDER BY l5.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_by\" from \"vendor_candidates\" left join \"vendors\" on \"vendor_candidates\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "vendor_candidates_with_vendor_info", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"business_size\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"", + "name": "vendor_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", + "name": "vendor_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_materials_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_materials\".\"id\", \"vendor_possible_materials\".\"vendor_id\", \"materials\".\"item_name\", \"materials\".\"item_code\", \"materials\".\"description\", \"materials\".\"unit_of_measure\", \"materials\".\"steel_type\", \"materials\".\"grade_material\", \"vendor_possible_materials\".\"created_at\", \"vendor_possible_materials\".\"updated_at\" from \"vendor_possible_materials\" left join \"materials\" on \"vendor_possible_materials\".\"item_code\" = \"materials\".\"item_code\"", + "name": "vendor_materials_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendors_with_types": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"tax_id\" as \"tax_id\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"phone\" as \"phone\", \"vendors\".\"email\" as \"email\", \"vendors\".\"business_size\" as \"business_size\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"status\", \"vendors\".\"vendor_type_id\" as \"vendor_type_id\", \"vendors\".\"representative_name\" as \"representative_name\", \"vendors\".\"representative_birth\" as \"representative_birth\", \"vendors\".\"representative_email\" as \"representative_email\", \"vendors\".\"representative_phone\" as \"representative_phone\", \"vendors\".\"corporate_registration_number\" as \"corporate_registration_number\", \"vendors\".\"items\" as \"items\", \"vendors\".\"credit_agency\" as \"credit_agency\", \"vendors\".\"credit_rating\" as \"credit_rating\", \"vendors\".\"cash_flow_rating\" as \"cash_flow_rating\", \"vendors\".\"created_at\" as \"created_at\", \"vendors\".\"updated_at\" as \"updated_at\", \"vendor_types\".\"name_ko\" as \"vendor_type_name\", \"vendor_types\".\"name_en\" as \"vendor_type_name_en\", \"vendor_types\".\"code\" as \"vendor_type_code\", \n CASE\n WHEN \"vendors\".\"status\" = 'ACTIVE' THEN '정규업체'\n WHEN \"vendors\".\"status\" IN ('INACTIVE', 'BLACKLISTED', 'REJECTED') THEN ''\n ELSE '잠재업체'\n END\n as \"vendor_category\" from \"vendors\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\"", + "name": "vendors_with_types", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.basic_contract_view": { + "columns": {}, + "definition": "select \"basic_contract\".\"id\" as \"id\", \"basic_contract\".\"template_id\" as \"template_id\", \"basic_contract\".\"vendor_id\" as \"vendor_id\", \"basic_contract\".\"requested_by\" as \"requested_by\", \"basic_contract\".\"status\" as \"basic_contract_status\", \"basic_contract\".\"created_at\" as \"created_at\", \"basic_contract\".\"updated_at\" as \"updated_at\", \"basic_contract\".\"updated_at\" as \"completed_at\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"email\" as \"vendor_email\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"users\".\"name\" as \"user_name\", \"basic_contract_templates\".\"template_name\" as \"template_name\", \"basic_contract_templates\".\"validity_period\" as \"validityPeriod\", \"basic_contract_templates\".\"file_path\" as \"file_path\", \"basic_contract_templates\".\"file_name\" as \"file_name\", \"basic_contract\".\"file_path\" as \"signed_file_path\" from \"basic_contract\" left join \"vendors\" on \"basic_contract\".\"vendor_id\" = \"vendors\".\"id\" left join \"users\" on \"basic_contract\".\"requested_by\" = \"users\".\"id\" left join \"basic_contract_templates\" on \"basic_contract\".\"template_id\" = \"basic_contract_templates\".\"id\"", + "name": "basic_contract_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.pr_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"pr_items\".\"id\", \"pr_items\".\"procurement_rfqs_id\", \"pr_items\".\"rfq_item\", \"pr_items\".\"pr_item\", \"pr_items\".\"pr_no\", \"pr_items\".\"material_code\", \"pr_items\".\"material_category\", \"pr_items\".\"acc\", \"pr_items\".\"material_description\", \"pr_items\".\"size\", \"pr_items\".\"delivery_date\", \"pr_items\".\"quantity\", \"pr_items\".\"uom\", \"pr_items\".\"gross_weight\", \"pr_items\".\"gw_uom\", \"pr_items\".\"spec_no\", \"pr_items\".\"spec_url\", \"pr_items\".\"tracking_no\", \"pr_items\".\"major_yn\", \"pr_items\".\"project_def\", \"pr_items\".\"project_sc\", \"pr_items\".\"project_kl\", \"pr_items\".\"project_lc\", \"pr_items\".\"project_dl\", \"pr_items\".\"remark\", \"procurement_rfqs\".\"rfq_code\", \"procurement_rfqs\".\"item_code\", \"procurement_rfqs\".\"item_name\" from \"pr_items\" left join \"procurement_rfqs\" on \"pr_items\".\"procurement_rfqs_id\" = \"procurement_rfqs\".\"id\"", + "name": "pr_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfq_details_view": { + "columns": {}, + "definition": "select \"rfq_details\".\"id\" as \"detail_id\", \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfqs\".\"item_code\" as \"item_code\", \"rfqs\".\"item_name\" as \"item_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"country\" as \"vendor_country\", \"rfq_details\".\"currency\" as \"currency\", \"payment_terms\".\"code\" as \"payment_terms_code\", \"payment_terms\".\"description\" as \"payment_terms_description\", \"incoterms\".\"code\" as \"incoterms_code\", \"incoterms\".\"description\" as \"incoterms_description\", \"rfq_details\".\"incoterms_detail\" as \"incoterms_detail\", \"rfq_details\".\"delivery_date\" as \"delivery_date\", \"rfq_details\".\"tax_code\" as \"tax_code\", \"rfq_details\".\"place_of_shipping\" as \"place_of_shipping\", \"rfq_details\".\"place_of_destination\" as \"place_of_destination\", \"rfq_details\".\"material_price_related_yn\" as \"material_price_related_yn\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"rfq_details\".\"updated_at\" as \"updated_at\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\"\n ) as \"pr_items_count\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\" \n AND major_yn = true\n ) as \"major_items_count\", (\n SELECT COUNT(*) \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"comment_count\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_comment_date\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\" AND is_vendor_comment = true\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_vendor_comment_date\", (\n SELECT COUNT(*) \n FROM procurement_rfq_attachments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) > 0\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"has_quotation\", (\n SELECT status\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_status\", (\n SELECT total_price\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_total_price\", (\n SELECT quotation_version\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"quotation_version\", (\n SELECT COUNT(DISTINCT quotation_version)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"quotation_version_count\", (\n SELECT created_at\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"last_quotation_date\" from \"procurement_rfq_details\" \"rfq_details\" left join \"procurement_rfqs\" \"rfqs\" on \"rfq_details\".\"procurement_rfqs_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"rfq_details\".\"vendors_id\" = \"vendors\".\"id\" left join \"payment_terms\" on \"rfq_details\".\"payment_terms_code\" = \"payment_terms\".\"code\" left join \"incoterms\" on \"rfq_details\".\"incoterms_code\" = \"incoterms\".\"code\" left join \"users\" \"updated_by_user\" on \"rfq_details\".\"updated_by\" = \"updated_by_user\".\"id\"", + "name": "procurement_rfq_details_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfqs_view": { + "columns": {}, + "definition": "select \"procurement_rfqs\".\"id\" as \"id\", \"procurement_rfqs\".\"rfq_code\" as \"rfq_code\", \"procurement_rfqs\".\"series\" as \"series\", \"procurement_rfqs\".\"rfq_sealed_yn\" as \"rfq_sealed_yn\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"procurement_rfqs\".\"item_code\" as \"item_code\", \"procurement_rfqs\".\"item_name\" as \"item_name\", \"procurement_rfqs\".\"status\" as \"status\", \"procurement_rfqs\".\"pic_code\" as \"pic_code\", \"procurement_rfqs\".\"rfq_send_date\" as \"rfq_send_date\", \"procurement_rfqs\".\"due_date\" as \"due_date\", (\n SELECT MIN(submitted_at)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"procurement_rfqs\".\"id\"\n AND submitted_at IS NOT NULL\n ) as \"earliest_quotation_submitted_at\", \"created_by_user\".\"name\" as \"created_by_user_name\", \"sent_by_user\".\"name\" as \"sent_by_user_name\", \"procurement_rfqs\".\"updated_at\" as \"updated_at\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"procurement_rfqs\".\"remark\" as \"remark\", (\n SELECT material_code \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"major_item_material_code\", (\n SELECT pr_no \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"po_no\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n ) as \"pr_items_count\" from \"procurement_rfqs\" left join \"projects\" on \"procurement_rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" \"created_by_user\" on \"procurement_rfqs\".\"created_by\" = \"created_by_user\".\"id\" left join \"users\" \"updated_by_user\" on \"procurement_rfqs\".\"updated_by\" = \"updated_by_user\".\"id\" left join \"users\" \"sent_by_user\" on \"procurement_rfqs\".\"sent_by\" = \"sent_by_user\".\"id\"", + "name": "procurement_rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.b_rfqs_master": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pic_name": { + "name": "pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "eng_pic_name": { + "name": "eng_pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "package_no": { + "name": "package_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "package_name": { + "name": "package_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_name": { + "name": "project_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_type": { + "name": "project_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "project_company": { + "name": "project_company", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_flag": { + "name": "project_flag", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_site": { + "name": "project_site", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "total_attachments": { + "name": "total_attachments", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.description,\n br.status,\n br.due_date,\n br.pic_code,\n br.pic_name,\n br.eng_pic_name,\n br.package_no,\n br.package_name,\n br.project_id,\n p.code as project_code,\n p.name as project_name,\n p.type as project_type,\n br.project_company,\n br.project_flag,\n br.project_site,\n COALESCE(att_count.total_attachments, 0) as total_attachments,\n br.created_at,\n br.updated_at\n FROM b_rfqs br\n LEFT JOIN projects p ON br.project_id = p.id\n LEFT JOIN (\n SELECT rfq_id, COUNT(*) as total_attachments\n FROM b_rfq_attachments\n GROUP BY rfq_id\n ) att_count ON br.id = att_count.rfq_id\n", + "name": "b_rfqs_master", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.final_rfq_detail": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "rfq_status": { + "name": "rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "final_rfq_id": { + "name": "final_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "final_rfq_status": { + "name": "final_rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_country": { + "name": "vendor_country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "vendor_business_size": { + "name": "vendor_business_size", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "valid_date": { + "name": "valid_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_description": { + "name": "incoterms_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "payment_terms_description": { + "name": "payment_terms_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "short_list": { + "name": "short_list", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "return_yn": { + "name": "return_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "cp_request_yn": { + "name": "cp_request_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "prject_gtc_yn": { + "name": "prject_gtc_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "firsttime_yn": { + "name": "firsttime_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "return_revision": { + "name": "return_revision", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "gtc": { + "name": "gtc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "gtc_valid_date": { + "name": "gtc_valid_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sparepart": { + "name": "sparepart", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vendor_remark": { + "name": "vendor_remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.status as rfq_status,\n fr.id as final_rfq_id,\n fr.final_rfq_status,\n fr.vendor_id,\n v.vendor_code,\n v.vendor_name,\n v.country as vendor_country,\n v.business_size as vendor_business_size,\n fr.due_date,\n fr.valid_date,\n fr.delivery_date,\n fr.incoterms_code,\n inc.description as incoterms_description,\n fr.payment_terms_code,\n pt.description as payment_terms_description,\n fr.currency,\n fr.tax_code,\n fr.place_of_shipping,\n fr.place_of_destination,\n fr.short_list,\n fr.return_yn,\n fr.cp_request_yn,\n fr.prject_gtc_yn,\n fr.firsttime_yn,\n fr.material_price_related_yn,\n fr.return_revision,\n fr.gtc,\n fr.gtc_valid_date,\n fr.classification,\n fr.sparepart,\n fr.remark,\n fr.vendor_remark,\n fr.created_at,\n fr.updated_at\n FROM b_rfqs br\n JOIN final_rfq fr ON br.id = fr.rfq_id\n LEFT JOIN vendors v ON fr.vendor_id = v.id\n LEFT JOIN incoterms inc ON fr.incoterms_code = inc.code\n LEFT JOIN payment_terms pt ON fr.payment_terms_code = pt.code\n", + "name": "final_rfq_detail", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.initial_rfq_detail": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "rfq_status": { + "name": "rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "initial_rfq_id": { + "name": "initial_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "initial_rfq_status": { + "name": "initial_rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_country": { + "name": "vendor_country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "vendor_business_size": { + "name": "vendor_business_size", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "valid_date": { + "name": "valid_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_description": { + "name": "incoterms_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "short_list": { + "name": "short_list", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "return_yn": { + "name": "return_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "cp_request_yn": { + "name": "cp_request_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "prject_gtc_yn": { + "name": "prject_gtc_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "return_revision": { + "name": "return_revision", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "gtc": { + "name": "gtc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "gtc_valid_date": { + "name": "gtc_valid_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sparepart": { + "name": "sparepart", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.status as rfq_status,\n ir.id as initial_rfq_id,\n ir.initial_rfq_status,\n ir.vendor_id,\n v.vendor_code,\n v.vendor_name,\n v.country as vendor_country,\n v.business_size as vendor_business_size,\n ir.due_date,\n ir.valid_date,\n ir.incoterms_code,\n inc.description as incoterms_description,\n ir.short_list,\n ir.return_yn,\n ir.cp_request_yn,\n ir.prject_gtc_yn,\n ir.return_revision,\n ir.gtc,\n ir.gtc_valid_date,\n ir.classification,\n ir.sparepart,\n ir.created_at,\n ir.updated_at\n FROM b_rfqs br\n JOIN initial_rfq ir ON br.id = ir.rfq_id\n LEFT JOIN vendors v ON ir.vendor_id = v.id\n LEFT JOIN incoterms inc ON ir.incoterms_code = inc.code\n", + "name": "initial_rfq_detail", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.rfq_dashboard": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_name": { + "name": "project_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "package_no": { + "name": "package_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "package_name": { + "name": "package_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "pic_name": { + "name": "pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "total_attachments": { + "name": "total_attachments", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "initial_vendor_count": { + "name": "initial_vendor_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "final_vendor_count": { + "name": "final_vendor_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "initial_response_rate": { + "name": "initial_response_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "final_response_rate": { + "name": "final_response_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "overall_progress": { + "name": "overall_progress", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "days_to_deadline": { + "name": "days_to_deadline", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.description,\n br.status,\n br.due_date,\n p.code as project_code,\n p.name as project_name,\n br.package_no,\n br.package_name,\n br.pic_name,\n COALESCE(att_count.total_attachments, 0) as total_attachments,\n COALESCE(init_summary.vendor_count, 0) as initial_vendor_count,\n COALESCE(final_summary.vendor_count, 0) as final_vendor_count,\n COALESCE(init_summary.avg_response_rate, 0) as initial_response_rate,\n COALESCE(final_summary.avg_response_rate, 0) as final_response_rate,\n CASE \n WHEN br.status = 'DRAFT' THEN 0\n WHEN br.status = 'Doc. Received' THEN 10\n WHEN br.status = 'PIC Assigned' THEN 20\n WHEN br.status = 'Doc. Confirmed' THEN 30\n WHEN br.status = 'Init. RFQ Sent' THEN 40\n WHEN br.status = 'Init. RFQ Answered' THEN 50\n WHEN br.status = 'TBE started' THEN 60\n WHEN br.status = 'TBE finished' THEN 70\n WHEN br.status = 'Final RFQ Sent' THEN 80\n WHEN br.status = 'Quotation Received' THEN 90\n WHEN br.status = 'Vendor Selected' THEN 100\n ELSE 0\n END as overall_progress,\n (br.due_date - CURRENT_DATE) as days_to_deadline,\n br.created_at\n FROM b_rfqs br\n LEFT JOIN projects p ON br.project_id = p.id\n LEFT JOIN (\n SELECT rfq_id, COUNT(*) as total_attachments\n FROM b_rfq_attachments\n GROUP BY rfq_id\n ) att_count ON br.id = att_count.rfq_id\n LEFT JOIN (\n SELECT \n rfq_id, \n COUNT(DISTINCT vendor_id) as vendor_count,\n AVG(response_rate) as avg_response_rate\n FROM vendor_response_summary\n WHERE rfq_type = 'INITIAL'\n GROUP BY rfq_id\n ) init_summary ON br.id = init_summary.rfq_id\n LEFT JOIN (\n SELECT \n rfq_id, \n COUNT(DISTINCT vendor_id) as vendor_count,\n AVG(response_rate) as avg_response_rate\n FROM vendor_response_summary\n WHERE rfq_type = 'FINAL'\n GROUP BY rfq_id\n ) final_summary ON br.id = final_summary.rfq_id\n", + "name": "rfq_dashboard", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_response_summary": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "rfq_status": { + "name": "rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_country": { + "name": "vendor_country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "vendor_business_size": { + "name": "vendor_business_size", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "total_attachments": { + "name": "total_attachments", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "responded_count": { + "name": "responded_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "pending_count": { + "name": "pending_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "waived_count": { + "name": "waived_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "revision_requested_count": { + "name": "revision_requested_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "response_rate": { + "name": "response_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "completion_rate": { + "name": "completion_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.status as rfq_status,\n v.id as vendor_id,\n v.vendor_code,\n v.vendor_name,\n v.country as vendor_country,\n v.business_size as vendor_business_size,\n var.rfq_type,\n COUNT(var.id) as total_attachments,\n COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) as responded_count,\n COUNT(CASE WHEN var.response_status = 'NOT_RESPONDED' THEN 1 END) as pending_count,\n COUNT(CASE WHEN var.response_status = 'WAIVED' THEN 1 END) as waived_count,\n COUNT(CASE WHEN var.response_status = 'REVISION_REQUESTED' THEN 1 END) as revision_requested_count,\n ROUND(\n (COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) * 100.0 / \n NULLIF(COUNT(CASE WHEN var.response_status != 'WAIVED' THEN 1 END), 0)), \n 2\n ) as response_rate,\n ROUND(\n ((COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) + \n COUNT(CASE WHEN var.response_status = 'WAIVED' THEN 1 END)) * 100.0 / COUNT(var.id)), \n 2\n ) as completion_rate\n FROM b_rfqs br\n JOIN b_rfq_attachments bra ON br.id = bra.rfq_id\n JOIN vendor_attachment_responses var ON bra.id = var.attachment_id\n JOIN vendors v ON var.vendor_id = v.id\n GROUP BY br.id, br.rfq_code, br.status, v.id, v.vendor_code, v.vendor_name, v.country, v.business_size, var.rfq_type\n", + "name": "vendor_response_summary", + "schema": "public", + "isExisting": false, + "materialized": false + } + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db/migrations/meta/0125_snapshot.json b/db/migrations/meta/0125_snapshot.json new file mode 100644 index 00000000..6a2d10e9 --- /dev/null +++ b/db/migrations/meta/0125_snapshot.json @@ -0,0 +1,14023 @@ +{ + "id": "ad5f9af6-a0ee-4e8f-a2a6-c0e408e211b0", + "prevId": "697eaff7-48b8-4f4a-b489-6f42dfdfd199", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.companies": { + "name": "companies", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "companies_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "taxID": { + "name": "taxID", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_envelopes": { + "name": "contract_envelopes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_envelopes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "envelope_id": { + "name": "envelope_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": true + }, + "document_id": { + "name": "document_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": false + }, + "envelope_status": { + "name": "envelope_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_envelopes_contract_id_contracts_id_fk": { + "name": "contract_envelopes_contract_id_contracts_id_fk", + "tableFrom": "contract_envelopes", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_items": { + "name": "contract_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_items_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_id": { + "name": "item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "unit_price": { + "name": "unit_price", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "total_line_amount": { + "name": "total_line_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_items_contract_item_idx": { + "name": "contract_items_contract_item_idx", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "contract_items_contract_id_contracts_id_fk": { + "name": "contract_items_contract_id_contracts_id_fk", + "tableFrom": "contract_items", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_items_item_id_items_id_fk": { + "name": "contract_items_item_id_items_id_fk", + "tableFrom": "contract_items", + "tableTo": "items", + "columnsFrom": [ + "item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_items_contract_id_item_id_unique": { + "name": "contract_items_contract_id_item_id_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_id", + "item_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_signers": { + "name": "contract_signers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_signers_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "envelope_id": { + "name": "envelope_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_contact_id": { + "name": "vendor_contact_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "signer_type": { + "name": "signer_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'VENDOR'" + }, + "signer_email": { + "name": "signer_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "signer_name": { + "name": "signer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "signer_position": { + "name": "signer_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "signer_status": { + "name": "signer_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "signed_at": { + "name": "signed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_signers_envelope_id_contract_envelopes_id_fk": { + "name": "contract_signers_envelope_id_contract_envelopes_id_fk", + "tableFrom": "contract_signers", + "tableTo": "contract_envelopes", + "columnsFrom": [ + "envelope_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_signers_vendor_contact_id_vendor_contacts_id_fk": { + "name": "contract_signers_vendor_contact_id_vendor_contacts_id_fk", + "tableFrom": "contract_signers", + "tableTo": "vendor_contacts", + "columnsFrom": [ + "vendor_contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contracts": { + "name": "contracts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contracts_project_id_projects_id_fk": { + "name": "contracts_project_id_projects_id_fk", + "tableFrom": "contracts", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contracts_vendor_id_vendors_id_fk": { + "name": "contracts_vendor_id_vendors_id_fk", + "tableFrom": "contracts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contracts_contract_no_unique": { + "name": "contracts_contract_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.poa": { + "name": "poa", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "original_contract_no": { + "name": "original_contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "original_contract_name": { + "name": "original_contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_status": { + "name": "original_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "poa_original_contract_no_contracts_contract_no_fk": { + "name": "poa_original_contract_no_contracts_contract_no_fk", + "tableFrom": "poa", + "tableTo": "contracts", + "columnsFrom": [ + "original_contract_no" + ], + "columnsTo": [ + "contract_no" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_project_id_projects_id_fk": { + "name": "poa_project_id_projects_id_fk", + "tableFrom": "poa", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_vendor_id_vendors_id_fk": { + "name": "poa_vendor_id_vendors_id_fk", + "tableFrom": "poa", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_hull": { + "name": "item_offshore_hull", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_hull_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_hull_item_code_items_item_code_fk": { + "name": "item_offshore_hull_item_code_items_item_code_fk", + "tableFrom": "item_offshore_hull", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_top": { + "name": "item_offshore_top", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_top_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_top_item_code_items_item_code_fk": { + "name": "item_offshore_top_item_code_items_item_code_fk", + "tableFrom": "item_offshore_top", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_shipbuilding": { + "name": "item_shipbuilding", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ship_types": { + "name": "ship_types", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'OPTION'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_shipbuilding_item_code_items_item_code_fk": { + "name": "item_shipbuilding_item_code_items_item_code_fk", + "tableFrom": "item_shipbuilding", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.items": { + "name": "items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_no": { + "name": "project_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "package_code": { + "name": "package_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "sm_code": { + "name": "sm_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "items_item_code_unique": { + "name": "items_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.materials": { + "name": "materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "materials_item_code_unique": { + "name": "materials_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias": { + "name": "pq_criterias", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "check_point": { + "name": "check_point", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "group_name": { + "name": "group_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias_extension": { + "name": "pq_criterias_extension", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_criteria_id": { + "name": "pq_criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_info": { + "name": "contract_info", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "additional_requirement": { + "name": "additional_requirement", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk": { + "name": "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "pq_criterias", + "columnsFrom": [ + "pq_criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "pq_criterias_extension_project_id_projects_id_fk": { + "name": "pq_criterias_extension_project_id_projects_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_criteria_attachments": { + "name": "vendor_criteria_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_criteria_answer_id": { + "name": "vendor_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_criteria_attachments", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigation_attachments": { + "name": "vendor_investigation_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "investigation_id": { + "name": "investigation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'REPORT'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { + "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", + "tableFrom": "vendor_investigation_attachments", + "tableTo": "vendor_investigations", + "columnsFrom": [ + "investigation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigations": { + "name": "vendor_investigations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigations_vendor_id_vendors_id_fk": { + "name": "vendor_investigations_vendor_id_vendors_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk": { + "name": "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendor_pq_submissions", + "columnsFrom": [ + "pq_submission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "vendor_investigations_requester_id_users_id_fk": { + "name": "vendor_investigations_requester_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_qm_manager_id_users_id_fk": { + "name": "vendor_investigations_qm_manager_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "qm_manager_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_submissions": { + "name": "vendor_pq_submissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_number": { + "name": "pq_number", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_pq_submission": { + "name": "unique_pq_submission", + "columns": [ + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_pq_submissions_requester_id_users_id_fk": { + "name": "vendor_pq_submissions_requester_id_users_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_pq_submissions_vendor_id_vendors_id_fk": { + "name": "vendor_pq_submissions_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_submissions_project_id_projects_id_fk": { + "name": "vendor_pq_submissions_project_id_projects_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_pq_submissions_pq_number_unique": { + "name": "vendor_pq_submissions_pq_number_unique", + "nullsNotDistinct": false, + "columns": [ + "pq_number" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_criteria_answers": { + "name": "vendor_pq_criteria_answers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "criteria_id": { + "name": "criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "answer": { + "name": "answer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_criteria_answers_vendor_id_vendors_id_fk": { + "name": "vendor_pq_criteria_answers_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": { + "name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "pq_criterias", + "columnsFrom": [ + "criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_project_id_projects_id_fk": { + "name": "vendor_pq_criteria_answers_project_id_projects_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_review_logs": { + "name": "vendor_pq_review_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_pq_criteria_answer_id": { + "name": "vendor_pq_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "reviewer_comment": { + "name": "reviewer_comment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_pq_review_logs", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_pq_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_project_pqs": { + "name": "vendor_project_pqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_project_pqs_vendor_id_vendors_id_fk": { + "name": "vendor_project_pqs_vendor_id_vendors_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_project_pqs_project_id_projects_id_fk": { + "name": "vendor_project_pqs_project_id_projects_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bidding_projects": { + "name": "bidding_projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "proj_nm": { + "name": "proj_nm", + "type": "varchar(90)", + "primaryKey": false, + "notNull": false + }, + "sector": { + "name": "sector", + "type": "char(1)", + "primaryKey": false, + "notNull": false + }, + "proj_msrm": { + "name": "proj_msrm", + "type": "numeric(3, 0)", + "primaryKey": false, + "notNull": false + }, + "kunnr": { + "name": "kunnr", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "kunnr_nm": { + "name": "kunnr_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "cls_1": { + "name": "cls_1", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "cls1_nm": { + "name": "cls1_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "ptype": { + "name": "ptype", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "ptype_nm": { + "name": "ptype_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_cd": { + "name": "pmodel_cd", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "pmodel_nm": { + "name": "pmodel_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_sz": { + "name": "pmodel_sz", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "pmodel_uom": { + "name": "pmodel_uom", + "type": "char(5)", + "primaryKey": false, + "notNull": false + }, + "txt04": { + "name": "txt04", + "type": "char(4)", + "primaryKey": false, + "notNull": false + }, + "txt30": { + "name": "txt30", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "estm_pm": { + "name": "estm_pm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "bidding_projects_pspid_unique": { + "name": "bidding_projects_pspid_unique", + "nullsNotDistinct": false, + "columns": [ + "pspid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_series": { + "name": "project_series", + "schema": "", + "columns": { + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "sers_no": { + "name": "sers_no", + "type": "char(3)", + "primaryKey": false, + "notNull": true + }, + "sc_dt": { + "name": "sc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "kl_dt": { + "name": "kl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "lc_dt": { + "name": "lc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dl_dt": { + "name": "dl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dock_no": { + "name": "dock_no", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "dock_nm": { + "name": "dock_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "proj_no": { + "name": "proj_no", + "type": "char(24)", + "primaryKey": false, + "notNull": false + }, + "post1": { + "name": "post1", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "project_sersNo_unique": { + "name": "project_sersNo_unique", + "columns": [ + { + "expression": "pspid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sers_no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "project_series_pspid_bidding_projects_pspid_fk": { + "name": "project_series_pspid_bidding_projects_pspid_fk", + "tableFrom": "project_series", + "tableTo": "bidding_projects", + "columnsFrom": [ + "pspid" + ], + "columnsTo": [ + "pspid" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projects": { + "name": "projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cbe_evaluations": { + "name": "cbe_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluated_by": { + "name": "evaluated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluated_at": { + "name": "evaluated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "result": { + "name": "result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "total_cost": { + "name": "total_cost", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_schedule": { + "name": "delivery_schedule", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "cbe_evaluations_rfq_id_rfqs_id_fk": { + "name": "cbe_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_vendor_id_vendors_id_fk": { + "name": "cbe_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_evaluated_by_users_id_fk": { + "name": "cbe_evaluations_evaluated_by_users_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "users", + "columnsFrom": [ + "evaluated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_attachments": { + "name": "rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_attachments_rfq_id_rfqs_id_fk": { + "name": "rfq_attachments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_vendor_id_vendors_id_fk": { + "name": "rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_attachments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_cbe_id_cbe_evaluations_id_fk": { + "name": "rfq_attachments_cbe_id_cbe_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "cbe_evaluations", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_comment_id_rfq_comments_id_fk": { + "name": "rfq_attachments_comment_id_rfq_comments_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_comments": { + "name": "rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "comment_text": { + "name": "comment_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "commented_by": { + "name": "commented_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_comments_rfq_id_rfqs_id_fk": { + "name": "rfq_comments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_vendor_id_vendors_id_fk": { + "name": "rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_commented_by_users_id_fk": { + "name": "rfq_comments_commented_by_users_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "commented_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_comments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_cbe_id_vendor_responses_id_fk": { + "name": "rfq_comments_cbe_id_vendor_responses_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_evaluations": { + "name": "rfq_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "eval_type": { + "name": "eval_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "result": { + "name": "result", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_evaluations_rfq_id_rfqs_id_fk": { + "name": "rfq_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_evaluations_vendor_id_vendors_id_fk": { + "name": "rfq_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_items": { + "name": "rfq_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_items_rfq_id_rfqs_id_fk": { + "name": "rfq_items_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_items", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "rfq_items_item_code_items_item_code_fk": { + "name": "rfq_items_item_code_items_item_code_fk", + "tableFrom": "rfq_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfqs": { + "name": "rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "bid_project_id": { + "name": "bid_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false, + "default": "'PURCHASE'" + }, + "parent_rfq_id": { + "name": "parent_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfqs_project_id_projects_id_fk": { + "name": "rfqs_project_id_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_bid_project_id_bidding_projects_id_fk": { + "name": "rfqs_bid_project_id_bidding_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bid_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_created_by_users_id_fk": { + "name": "rfqs_created_by_users_id_fk", + "tableFrom": "rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_parent_rfq_id_rfqs_id_fk": { + "name": "rfqs_parent_rfq_id_rfqs_id_fk", + "tableFrom": "rfqs", + "tableTo": "rfqs", + "columnsFrom": [ + "parent_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "rfqs_rfq_code_unique": { + "name": "rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_commercial_responses": { + "name": "vendor_commercial_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "total_price": { + "name": "total_price", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_period": { + "name": "delivery_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "warranty_period": { + "name": "warranty_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "validity_period": { + "name": "validity_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "price_breakdown": { + "name": "price_breakdown", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "commercial_notes": { + "name": "commercial_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_commercial_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_commercial_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_commercial_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_attachments": { + "name": "vendor_response_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "technical_response_id": { + "name": "technical_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "commercial_response_id": { + "name": "commercial_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_attachments_response_id_vendor_responses_id_fk": { + "name": "vendor_response_attachments_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk": { + "name": "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_technical_responses", + "columnsFrom": [ + "technical_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk": { + "name": "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_commercial_responses", + "columnsFrom": [ + "commercial_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_responses": { + "name": "vendor_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'REVIEWING'" + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "responded_by": { + "name": "responded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "responded_at": { + "name": "responded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "vendor_response_unique": { + "name": "vendor_response_unique", + "columns": [ + { + "expression": "rfq_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_responses_rfq_id_rfqs_id_fk": { + "name": "vendor_responses_rfq_id_rfqs_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_responses_vendor_id_vendors_id_fk": { + "name": "vendor_responses_vendor_id_vendors_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_technical_responses": { + "name": "vendor_technical_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_technical_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_technical_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_technical_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.otps": { + "name": "otps", + "schema": "", + "columns": { + "email": { + "name": "email", + "type": "varchar(256)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(6)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "otpToken": { + "name": "otpToken", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "otp_expires": { + "name": "otp_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permissions": { + "name": "permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "permissions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "permission_key": { + "name": "permission_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.role_permissions": { + "name": "role_permissions", + "schema": "", + "columns": { + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "permission_id": { + "name": "permission_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "role_permissions_role_id_roles_id_fk": { + "name": "role_permissions_role_id_roles_id_fk", + "tableFrom": "role_permissions", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "role_permissions_permission_id_permissions_id_fk": { + "name": "role_permissions_permission_id_permissions_id_fk", + "tableFrom": "role_permissions", + "tableTo": "permissions", + "columnsFrom": [ + "permission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.roles": { + "name": "roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "roles_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "roles_company_id_vendors_id_fk": { + "name": "roles_company_id_vendors_id_fk", + "tableFrom": "roles", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_roles": { + "name": "user_roles", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_roles_user_id_users_id_fk": { + "name": "user_roles_user_id_users_id_fk", + "tableFrom": "user_roles", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_roles_role_id_roles_id_fk": { + "name": "user_roles_role_id_roles_id_fk", + "tableFrom": "user_roles", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "users_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'partners'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "image_url": { + "name": "image_url", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "language": { + "name": "language", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'en'" + } + }, + "indexes": {}, + "foreignKeys": { + "users_company_id_vendors_id_fk": { + "name": "users_company_id_vendors_id_fk", + "tableFrom": "users", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_entries": { + "name": "form_entries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_entries_contract_item_id_contract_items_id_fk": { + "name": "form_entries_contract_item_id_contract_items_id_fk", + "tableFrom": "form_entries", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_metas": { + "name": "form_metas", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "columns": { + "name": "columns", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_metas_project_id_projects_id_fk": { + "name": "form_metas_project_id_projects_id_fk", + "tableFrom": "form_metas", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "form_code_project_unique": { + "name": "form_code_project_unique", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.forms": { + "name": "forms", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "forms_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "eng": { + "name": "eng", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "im": { + "name": "im", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_item_form_code_unique": { + "name": "contract_item_form_code_unique", + "columns": [ + { + "expression": "contract_item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "form_code", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "forms_contract_item_id_contract_items_id_fk": { + "name": "forms_contract_item_id_contract_items_id_fk", + "tableFrom": "forms", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_class_attributes": { + "name": "tag_class_attributes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_class_attributes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "tag_class_id": { + "name": "tag_class_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "att_id": { + "name": "att_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "def_val": { + "name": "def_val", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uom_id": { + "name": "uom_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "seq": { + "name": "seq", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "tag_class_attributes_seq_idx": { + "name": "tag_class_attributes_seq_idx", + "columns": [ + { + "expression": "seq", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "tag_class_attributes_tag_class_id_tag_classes_id_fk": { + "name": "tag_class_attributes_tag_class_id_tag_classes_id_fk", + "tableFrom": "tag_class_attributes", + "tableTo": "tag_classes", + "columnsFrom": [ + "tag_class_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_att_id_in_tag_class": { + "name": "uniq_att_id_in_tag_class", + "nullsNotDistinct": false, + "columns": [ + "tag_class_id", + "att_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_classes": { + "name": "tag_classes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_classes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_classes_project_id_projects_id_fk": { + "name": "tag_classes_project_id_projects_id_fk", + "tableFrom": "tag_classes", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk": { + "name": "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk", + "tableFrom": "tag_classes", + "tableTo": "tag_types", + "columnsFrom": [ + "tag_type_code", + "project_id" + ], + "columnsTo": [ + "code", + "project_id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_code_in_project": { + "name": "uniq_code_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfield_options": { + "name": "tag_subfield_options", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfield_options_project_id_projects_id_fk": { + "name": "tag_subfield_options_project_id_projects_id_fk", + "tableFrom": "tag_subfield_options", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_attribute_project_code": { + "name": "uniq_attribute_project_code", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "attributes_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfields": { + "name": "tag_subfields", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfields_project_id_projects_id_fk": { + "name": "tag_subfields_project_id_projects_id_fk", + "tableFrom": "tag_subfields", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_tag_type_attribute": { + "name": "uniq_tag_type_attribute", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_code", + "attributes_id" + ] + }, + "uniq_attribute_id_project": { + "name": "uniq_attribute_id_project", + "nullsNotDistinct": false, + "columns": [ + "attributes_id", + "project_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_type_class_form_mappings": { + "name": "tag_type_class_form_mappings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_label": { + "name": "tag_type_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "class_label": { + "name": "class_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "ep": { + "name": "ep", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_mapping_in_project": { + "name": "uniq_mapping_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_label", + "class_label", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_types": { + "name": "tag_types", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_types_project_id_projects_id_fk": { + "name": "tag_types_project_id_projects_id_fk", + "tableFrom": "tag_types", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "tag_types_code_project_id_pk": { + "name": "tag_types_code_project_id_pk", + "columns": [ + "code", + "project_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tags": { + "name": "tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tags_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "tag_type": { + "name": "tag_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "class": { + "name": "class", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tags_contract_item_id_contract_items_id_fk": { + "name": "tags_contract_item_id_contract_items_id_fk", + "tableFrom": "tags", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_form_id_forms_id_fk": { + "name": "tags_form_id_forms_id_fk", + "tableFrom": "tags", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_item_tag_no_unique": { + "name": "contract_item_tag_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_item_id", + "tag_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_data_report_temps": { + "name": "vendor_data_report_temps", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_data_report_temps_contract_item_id_contract_items_id_fk": { + "name": "vendor_data_report_temps_contract_item_id_contract_items_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_data_report_temps_form_id_forms_id_fk": { + "name": "vendor_data_report_temps_form_id_forms_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.change_logs": { + "name": "change_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "changed_fields": { + "name": "changed_fields", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "old_values": { + "name": "old_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "new_values": { + "name": "new_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_name": { + "name": "user_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_synced": { + "name": "is_synced", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "sync_attempts": { + "name": "sync_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_sync_error": { + "name": "last_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "synced_at": { + "name": "synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "target_systems": { + "name": "target_systems", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + } + }, + "indexes": { + "idx_change_logs_contract_synced": { + "name": "idx_change_logs_contract_synced", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_synced", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_created_at": { + "name": "idx_change_logs_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_entity": { + "name": "idx_change_logs_entity", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_sync_attempts": { + "name": "idx_change_logs_sync_attempts", + "columns": [ + { + "expression": "sync_attempts", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.document_attachments": { + "name": "document_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "document_attachments_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "revision_id": { + "name": "revision_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "upload_id": { + "name": "upload_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "file_id": { + "name": "file_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "dolce_file_path": { + "name": "dolce_file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "document_attachments_revision_id_revisions_id_fk": { + "name": "document_attachments_revision_id_revisions_id_fk", + "tableFrom": "document_attachments", + "tableTo": "revisions", + "columnsFrom": [ + "revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.documents": { + "name": "documents", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "documents_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "drawing_move_gbn": { + "name": "drawing_move_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "discipline": { + "name": "discipline", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "external_document_id": { + "name": "external_document_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "external_system_type": { + "name": "external_system_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "external_synced_at": { + "name": "external_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "shi_drawing_no": { + "name": "shi_drawing_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager": { + "name": "manager", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_enm": { + "name": "manager_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_no": { + "name": "manager_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "register_group": { + "name": "register_group", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "register_group_id": { + "name": "register_group_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "create_user_no": { + "name": "create_user_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "create_user_id": { + "name": "create_user_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "create_user_enm": { + "name": "create_user_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_contract_doc_status": { + "name": "unique_contract_doc_status", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_contract_vendor_doc": { + "name": "unique_contract_vendor_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"vendor_doc_number\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_external_doc": { + "name": "unique_external_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_system_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"external_document_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "drawing_kind_idx": { + "name": "drawing_kind_idx", + "columns": [ + { + "expression": "drawing_kind", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "documents_contract_id_contracts_id_fk": { + "name": "documents_contract_id_contracts_id_fk", + "tableFrom": "documents", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.issue_stages": { + "name": "issue_stages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "issue_stages_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_name": { + "name": "stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "plan_date": { + "name": "plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "actual_date": { + "name": "actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "stage_status": { + "name": "stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "stage_order": { + "name": "stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "priority": { + "name": "priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'MEDIUM'" + }, + "assignee_id": { + "name": "assignee_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "assignee_name": { + "name": "assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "reminder_days": { + "name": "reminder_days", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_document_stage": { + "name": "unique_document_stage", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_stage_order": { + "name": "document_stage_order", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "issue_stages_document_id_documents_id_fk": { + "name": "issue_stages_document_id_documents_id_fk", + "tableFrom": "issue_stages", + "tableTo": "documents", + "columnsFrom": [ + "document_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.revisions": { + "name": "revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "revisions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "issue_stage_id": { + "name": "issue_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "revision": { + "name": "revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "uploader_type": { + "name": "uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'vendor'" + }, + "uploader_id": { + "name": "uploader_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploader_name": { + "name": "uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "usage": { + "name": "usage", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "revision_status": { + "name": "revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'SUBMITTED'" + }, + "submitted_date": { + "name": "submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "review_start_date": { + "name": "review_start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "approved_date": { + "name": "approved_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "rejected_date": { + "name": "rejected_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "reviewer_id": { + "name": "reviewer_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "review_comments": { + "name": "review_comments", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "external_upload_id": { + "name": "external_upload_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_stage_rev": { + "name": "unique_stage_rev", + "columns": [ + { + "expression": "issue_stage_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "revision", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_batches": { + "name": "sync_batches", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "batch_size": { + "name": "batch_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "retry_count": { + "name": "retry_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "change_log_ids": { + "name": "change_log_ids", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "success_count": { + "name": "success_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "failure_count": { + "name": "failure_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sync_metadata": { + "name": "sync_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_batches_contract_system": { + "name": "idx_sync_batches_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_status": { + "name": "idx_sync_batches_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_created_at": { + "name": "idx_sync_batches_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_configs": { + "name": "sync_configs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "sync_interval_minutes": { + "name": "sync_interval_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 30 + }, + "last_successful_sync": { + "name": "last_successful_sync", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_sync_attempt": { + "name": "last_sync_attempt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "endpoint_url": { + "name": "endpoint_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "auth_token": { + "name": "auth_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "api_version": { + "name": "api_version", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'v1'" + }, + "max_batch_size": { + "name": "max_batch_size", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 100 + }, + "retry_max_attempts": { + "name": "retry_max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_configs_contract_system": { + "name": "idx_sync_configs_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sync_configs_contract_id_contracts_id_fk": { + "name": "sync_configs_contract_id_contracts_id_fk", + "tableFrom": "sync_configs", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_attachments": { + "name": "vendor_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'GENERAL'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_attachments_vendor_id_vendors_id_fk": { + "name": "vendor_attachments_vendor_id_vendors_id_fk", + "tableFrom": "vendor_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidates": { + "name": "vendor_candidates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidates_vendor_id_vendors_id_fk": { + "name": "vendor_candidates_vendor_id_vendors_id_fk", + "tableFrom": "vendor_candidates", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_contacts": { + "name": "vendor_contacts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contact_name": { + "name": "contact_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_position": { + "name": "contact_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "is_primary": { + "name": "is_primary", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_contacts_vendor_id_vendors_id_fk": { + "name": "vendor_contacts_vendor_id_vendors_id_fk", + "tableFrom": "vendor_contacts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_items": { + "name": "vendor_possible_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_items_vendor_id_vendors_id_fk": { + "name": "vendor_possible_items_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_items_item_code_items_item_code_fk": { + "name": "vendor_possible_items_item_code_items_item_code_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_materials": { + "name": "vendor_possible_materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_materials_vendor_id_vendors_id_fk": { + "name": "vendor_possible_materials_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_materials_item_code_materials_item_code_fk": { + "name": "vendor_possible_materials_item_code_materials_item_code_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "materials", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_types": { + "name": "vendor_types", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_types_code_unique": { + "name": "vendor_types_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors": { + "name": "vendors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "vendor_type_id": { + "name": "vendor_type_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_vendor_type_id_vendor_types_id_fk": { + "name": "vendors_vendor_type_id_vendor_types_id_fk", + "tableFrom": "vendors", + "tableTo": "vendor_types", + "columnsFrom": [ + "vendor_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tasks": { + "name": "tasks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'todo'" + }, + "label": { + "name": "label", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'bug'" + }, + "priority": { + "name": "priority", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'low'" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "current_timestamp" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tasks_code_unique": { + "name": "tasks_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidate_logs": { + "name": "vendor_candidate_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_candidate_id": { + "name": "vendor_candidate_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk": { + "name": "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "vendor_candidates", + "columnsFrom": [ + "vendor_candidate_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_candidate_logs_user_id_users_id_fk": { + "name": "vendor_candidate_logs_user_id_users_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors_logs": { + "name": "vendors_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_logs_vendor_id_vendors_id_fk": { + "name": "vendors_logs_vendor_id_vendors_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendors_logs_user_id_users_id_fk": { + "name": "vendors_logs_user_id_users_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract": { + "name": "basic_contract", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_id": { + "name": "template_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requested_by": { + "name": "requested_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "basic_contract_template_id_basic_contract_templates_id_fk": { + "name": "basic_contract_template_id_basic_contract_templates_id_fk", + "tableFrom": "basic_contract", + "tableTo": "basic_contract_templates", + "columnsFrom": [ + "template_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_vendor_id_vendors_id_fk": { + "name": "basic_contract_vendor_id_vendors_id_fk", + "tableFrom": "basic_contract", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_requested_by_users_id_fk": { + "name": "basic_contract_requested_by_users_id_fk", + "tableFrom": "basic_contract", + "tableTo": "users", + "columnsFrom": [ + "requested_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract_templates": { + "name": "basic_contract_templates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_templates_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_name": { + "name": "template_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "validity_period": { + "name": "validity_period", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.incoterms": { + "name": "incoterms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(20)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "incoterms_created_by_users_id_fk": { + "name": "incoterms_created_by_users_id_fk", + "tableFrom": "incoterms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payment_terms": { + "name": "payment_terms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "payment_terms_created_by_users_id_fk": { + "name": "payment_terms_created_by_users_id_fk", + "tableFrom": "payment_terms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pr_items": { + "name": "pr_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "pr_items", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_attachments": { + "name": "procurement_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "procurement_rfq_details_id": { + "name": "procurement_rfq_details_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk": { + "name": "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfq_details", + "columnsFrom": [ + "procurement_rfq_details_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_created_by_users_id_fk": { + "name": "procurement_attachments_created_by_users_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "attachment_type_check": { + "name": "attachment_type_check", + "value": "\"procurement_attachments\".\"procurement_rfqs_id\" IS NOT NULL OR \"procurement_attachments\".\"procurement_rfq_details_id\" IS NOT NULL" + } + }, + "isRLSEnabled": false + }, + "public.procurement_quotation_items": { + "name": "procurement_quotation_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pr_item_id": { + "name": "pr_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "material_code": { + "name": "material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "uom": { + "name": "uom", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "unit_price": { + "name": "unit_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "vendor_material_code": { + "name": "vendor_material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_material_description": { + "name": "vendor_material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "lead_time_in_days": { + "name": "lead_time_in_days", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_rate": { + "name": "discount_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_amount": { + "name": "discount_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_alternative": { + "name": "is_alternative", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_recommended": { + "name": "is_recommended", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_quotation_items_pr_item_id_pr_items_id_fk": { + "name": "procurement_quotation_items_pr_item_id_pr_items_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "pr_items", + "columnsFrom": [ + "pr_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_attachments": { + "name": "procurement_rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_uploaded_by_users_id_fk": { + "name": "procurement_rfq_attachments_uploaded_by_users_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_comments": { + "name": "procurement_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_comments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_user_id_users_id_fk": { + "name": "procurement_rfq_comments_user_id_users_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_details": { + "name": "procurement_rfq_details", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendors_id": { + "name": "vendors_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'VV'" + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_vendors_id_vendors_id_fk": { + "name": "procurement_rfq_details_vendors_id_vendors_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "vendors", + "columnsFrom": [ + "vendors_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_rfq_details_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_incoterms_code_incoterms_code_fk": { + "name": "procurement_rfq_details_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_updated_by_users_id_fk": { + "name": "procurement_rfq_details_updated_by_users_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfqs": { + "name": "procurement_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "series": { + "name": "series", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "rfq_sealed_yn": { + "name": "rfq_sealed_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfqs_project_id_projects_id_fk": { + "name": "procurement_rfqs_project_id_projects_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_sent_by_users_id_fk": { + "name": "procurement_rfqs_sent_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_created_by_users_id_fk": { + "name": "procurement_rfqs_created_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_updated_by_users_id_fk": { + "name": "procurement_rfqs_updated_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "procurement_rfqs_rfq_code_unique": { + "name": "procurement_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_vendor_quotations": { + "name": "procurement_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_items_count": { + "name": "total_items_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sub_total": { + "name": "sub_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "tax_total": { + "name": "tax_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "discount_total": { + "name": "discount_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "estimated_delivery_date": { + "name": "estimated_delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "procurement_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_incoterms_code_incoterms_code_fk": { + "name": "procurement_vendor_quotations_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.preset_shares": { + "name": "preset_shares", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "preset_id": { + "name": "preset_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "shared_with_user_id": { + "name": "shared_with_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'read'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "preset_shares_preset_id_table_presets_id_fk": { + "name": "preset_shares_preset_id_table_presets_id_fk", + "tableFrom": "preset_shares", + "tableTo": "table_presets", + "columnsFrom": [ + "preset_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_presets": { + "name": "table_presets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_shared": { + "name": "is_shared", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_attachments": { + "name": "tech_sales_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "tech_sales_rfq_id": { + "name": "tech_sales_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "tech_sales_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_attachments_created_by_users_id_fk": { + "name": "tech_sales_attachments_created_by_users_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comment_attachments": { + "name": "tech_sales_rfq_comment_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk": { + "name": "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk": { + "name": "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comments": { + "name": "tech_sales_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_user_id_users_id_fk": { + "name": "tech_sales_rfq_comments_user_id_users_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfqs": { + "name": "tech_sales_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_shipbuilding_id": { + "name": "item_shipbuilding_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "bidding_project_id": { + "name": "bidding_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_snapshot": { + "name": "project_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "series_snapshot": { + "name": "series_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk": { + "name": "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "item_shipbuilding", + "columnsFrom": [ + "item_shipbuilding_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk": { + "name": "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bidding_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_sent_by_users_id_fk": { + "name": "tech_sales_rfqs_sent_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_created_by_users_id_fk": { + "name": "tech_sales_rfqs_created_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_updated_by_users_id_fk": { + "name": "tech_sales_rfqs_updated_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tech_sales_rfqs_rfq_code_unique": { + "name": "tech_sales_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_vendor_quotations": { + "name": "tech_sales_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "tech_sales_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rotation_attempts": { + "name": "ocr_rotation_attempts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "rotation": { + "name": "rotation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "tables_found": { + "name": "tables_found", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "text_quality": { + "name": "text_quality", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "keyword_count": { + "name": "keyword_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "score": { + "name": "score", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "extracted_rows_count": { + "name": "extracted_rows_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_rotation_attempts_session_id_ocr_sessions_id_fk": { + "name": "ocr_rotation_attempts_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rotation_attempts", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rows": { + "name": "ocr_rows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "table_id": { + "name": "table_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "row_index": { + "name": "row_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "report_no": { + "name": "report_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "no": { + "name": "no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "identification_no": { + "name": "identification_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_no": { + "name": "joint_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_type": { + "name": "joint_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "welding_date": { + "name": "welding_date", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "source_table": { + "name": "source_table", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "source_row": { + "name": "source_row", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_ocr_report_no_unique": { + "name": "idx_ocr_report_no_unique", + "columns": [ + { + "expression": "report_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "tag_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "joint_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "joint_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "ocr_rows_table_id_ocr_tables_id_fk": { + "name": "ocr_rows_table_id_ocr_tables_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_tables", + "columnsFrom": [ + "table_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_session_id_ocr_sessions_id_fk": { + "name": "ocr_rows_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_user_id_users_id_fk": { + "name": "ocr_rows_user_id_users_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_sessions": { + "name": "ocr_sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "processing_time": { + "name": "processing_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "best_rotation": { + "name": "best_rotation", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_tables": { + "name": "total_tables", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_rows": { + "name": "total_rows", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "image_enhanced": { + "name": "image_enhanced", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pdf_converted": { + "name": "pdf_converted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "success": { + "name": "success", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "warnings": { + "name": "warnings", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_tables": { + "name": "ocr_tables", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "table_index": { + "name": "table_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "row_count": { + "name": "row_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_tables_session_id_ocr_sessions_id_fk": { + "name": "ocr_tables_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_tables", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.b_rfq_attachment_revisions": { + "name": "b_rfq_attachment_revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_id": { + "name": "attachment_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "revision_no": { + "name": "revision_no", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "is_latest": { + "name": "is_latest", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "revision_comment": { + "name": "revision_comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "latest_revision_idx": { + "name": "latest_revision_idx", + "columns": [ + { + "expression": "attachment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_latest", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "b_rfq_attachment_revisions_attachment_id_b_rfq_attachments_id_fk": { + "name": "b_rfq_attachment_revisions_attachment_id_b_rfq_attachments_id_fk", + "tableFrom": "b_rfq_attachment_revisions", + "tableTo": "b_rfq_attachments", + "columnsFrom": [ + "attachment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "b_rfq_attachment_revisions_created_by_users_id_fk": { + "name": "b_rfq_attachment_revisions_created_by_users_id_fk", + "tableFrom": "b_rfq_attachment_revisions", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.b_rfqs": { + "name": "b_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pic_name": { + "name": "pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "eng_pic_name": { + "name": "eng_pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_company": { + "name": "project_company", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_flag": { + "name": "project_flag", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_site": { + "name": "project_site", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "package_no": { + "name": "package_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "package_name": { + "name": "package_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "b_rfqs_project_id_projects_id_fk": { + "name": "b_rfqs_project_id_projects_id_fk", + "tableFrom": "b_rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "b_rfqs_created_by_users_id_fk": { + "name": "b_rfqs_created_by_users_id_fk", + "tableFrom": "b_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "b_rfqs_updated_by_users_id_fk": { + "name": "b_rfqs_updated_by_users_id_fk", + "tableFrom": "b_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "b_rfqs_rfq_code_unique": { + "name": "b_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.b_rfq_attachments": { + "name": "b_rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "serial_no": { + "name": "serial_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "b_rfq_attachments_rfq_id_b_rfqs_id_fk": { + "name": "b_rfq_attachments_rfq_id_b_rfqs_id_fk", + "tableFrom": "b_rfq_attachments", + "tableTo": "b_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "b_rfq_attachments_created_by_users_id_fk": { + "name": "b_rfq_attachments_created_by_users_id_fk", + "tableFrom": "b_rfq_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.final_rfq": { + "name": "final_rfq", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "final_rfq_status": { + "name": "final_rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "valid_date": { + "name": "valid_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "gtc": { + "name": "gtc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "gtc_valid_date": { + "name": "gtc_valid_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sparepart": { + "name": "sparepart", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "short_list": { + "name": "short_list", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "return_yn": { + "name": "return_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "cp_request_yn": { + "name": "cp_request_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "prject_gtc_yn": { + "name": "prject_gtc_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "return_revision": { + "name": "return_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'VV'" + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "firsttime_yn": { + "name": "firsttime_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vendor_remark": { + "name": "vendor_remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "final_rfq_rfq_id_b_rfqs_id_fk": { + "name": "final_rfq_rfq_id_b_rfqs_id_fk", + "tableFrom": "final_rfq", + "tableTo": "b_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "final_rfq_vendor_id_vendors_id_fk": { + "name": "final_rfq_vendor_id_vendors_id_fk", + "tableFrom": "final_rfq", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "final_rfq_incoterms_code_incoterms_code_fk": { + "name": "final_rfq_incoterms_code_incoterms_code_fk", + "tableFrom": "final_rfq", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "final_rfq_payment_terms_code_payment_terms_code_fk": { + "name": "final_rfq_payment_terms_code_payment_terms_code_fk", + "tableFrom": "final_rfq", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.initial_rfq": { + "name": "initial_rfq", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "initial_rfq_status": { + "name": "initial_rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "valid_date": { + "name": "valid_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "gtc": { + "name": "gtc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "gtc_valid_date": { + "name": "gtc_valid_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sparepart": { + "name": "sparepart", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "short_list": { + "name": "short_list", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "return_yn": { + "name": "return_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "cp_request_yn": { + "name": "cp_request_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "prject_gtc_yn": { + "name": "prject_gtc_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "return_revision": { + "name": "return_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "initial_rfq_rfq_id_b_rfqs_id_fk": { + "name": "initial_rfq_rfq_id_b_rfqs_id_fk", + "tableFrom": "initial_rfq", + "tableTo": "b_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "initial_rfq_vendor_id_vendors_id_fk": { + "name": "initial_rfq_vendor_id_vendors_id_fk", + "tableFrom": "initial_rfq", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "initial_rfq_incoterms_code_incoterms_code_fk": { + "name": "initial_rfq_incoterms_code_incoterms_code_fk", + "tableFrom": "initial_rfq", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_attachment_responses": { + "name": "vendor_attachment_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_id": { + "name": "attachment_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "rfq_record_id": { + "name": "rfq_record_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'NOT_RESPONDED'" + }, + "current_revision": { + "name": "current_revision", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'Rev.0'" + }, + "responded_revision": { + "name": "responded_revision", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "response_comment": { + "name": "response_comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vendor_comment": { + "name": "vendor_comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "responded_at": { + "name": "responded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "vendor_response_idx": { + "name": "vendor_response_idx", + "columns": [ + { + "expression": "attachment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "rfq_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_attachment_responses_attachment_id_b_rfq_attachments_id_fk": { + "name": "vendor_attachment_responses_attachment_id_b_rfq_attachments_id_fk", + "tableFrom": "vendor_attachment_responses", + "tableTo": "b_rfq_attachments", + "columnsFrom": [ + "attachment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_attachment_responses_vendor_id_vendors_id_fk": { + "name": "vendor_attachment_responses_vendor_id_vendors_id_fk", + "tableFrom": "vendor_attachment_responses", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_attachments_b": { + "name": "vendor_response_attachments_b", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_response_id": { + "name": "vendor_response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_attachments_b_vendor_response_id_vendor_attachment_responses_id_fk": { + "name": "vendor_response_attachments_b_vendor_response_id_vendor_attachment_responses_id_fk", + "tableFrom": "vendor_response_attachments_b", + "tableTo": "vendor_attachment_responses", + "columnsFrom": [ + "vendor_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_b_uploaded_by_users_id_fk": { + "name": "vendor_response_attachments_b_uploaded_by_users_id_fk", + "tableFrom": "vendor_response_attachments_b", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_history": { + "name": "vendor_response_history", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_response_id": { + "name": "vendor_response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "previous_status": { + "name": "previous_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "action_by": { + "name": "action_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "action_at": { + "name": "action_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_history_vendor_response_id_vendor_attachment_responses_id_fk": { + "name": "vendor_response_history_vendor_response_id_vendor_attachment_responses_id_fk", + "tableFrom": "vendor_response_history", + "tableTo": "vendor_attachment_responses", + "columnsFrom": [ + "vendor_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_history_action_by_users_id_fk": { + "name": "vendor_response_history_action_by_users_id_fk", + "tableFrom": "vendor_response_history", + "tableTo": "users", + "columnsFrom": [ + "action_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.offshore_hull_work_type": { + "name": "offshore_hull_work_type", + "schema": "public", + "values": [ + "HA", + "HE", + "HH", + "HM", + "NC" + ] + }, + "public.offshore_top_work_type": { + "name": "offshore_top_work_type", + "schema": "public", + "values": [ + "TM", + "TS", + "TE", + "TP" + ] + }, + "public.work_type": { + "name": "work_type", + "schema": "public", + "values": [ + "기장", + "전장", + "선실", + "배관", + "철의" + ] + }, + "public.user_domain": { + "name": "user_domain", + "schema": "public", + "values": [ + "evcp", + "partners" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": { + "public.contracts_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"contracts\".\"id\", \"contracts\".\"contract_no\", \"contracts\".\"contract_name\", \"contracts\".\"status\", \"contracts\".\"start_date\", \"contracts\".\"end_date\", \"contracts\".\"project_id\", \"projects\".\"code\", \"projects\".\"name\", \"contracts\".\"vendor_id\", \"vendors\".\"vendor_name\", \"contracts\".\"payment_terms\", \"contracts\".\"delivery_terms\", \"contracts\".\"delivery_date\", \"contracts\".\"delivery_location\", \"contracts\".\"currency\", \"contracts\".\"total_amount\", \"contracts\".\"discount\", \"contracts\".\"tax\", \"contracts\".\"shipping_fee\", \"contracts\".\"net_total\", \"contracts\".\"partial_shipping_allowed\", \"contracts\".\"partial_payment_allowed\", \"contracts\".\"remarks\", \"contracts\".\"version\", \"contracts\".\"created_at\", \"contracts\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"contracts\".\"id\"\n ) as \"has_signature\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "contracts_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.poa_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", + "name": "poa_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.project_approved_vendors": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"status\", \"vendor_types\".\"name_ko\", \"vendor_types\".\"name_en\", \"projects\".\"code\", \"projects\".\"name\", \"projects\".\"type\", \"vendor_pq_submissions\".\"submitted_at\", \"vendor_pq_submissions\".\"approved_at\" from \"vendors\" inner join \"vendor_pq_submissions\" on \"vendor_pq_submissions\".\"vendor_id\" = \"vendors\".\"id\" inner join \"projects\" on \"vendor_pq_submissions\".\"project_id\" = \"projects\".\"id\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\" where \"vendor_pq_submissions\".\"status\" = 'APPROVED'", + "name": "project_approved_vendors", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_investigations_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"vendor_id\", \"vendor_investigations\".\"pq_submission_id\", \"vendor_investigations\".\"requester_id\", \"vendor_investigations\".\"qm_manager_id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"evaluation_type\", \"vendor_investigations\".\"investigation_address\", \"vendor_investigations\".\"investigation_method\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"forecasted_at\", \"vendor_investigations\".\"requested_at\", \"vendor_investigations\".\"confirmed_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"evaluation_score\", \"vendor_investigations\".\"evaluation_result\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", requester.name as \"requesterName\", requester.email as \"requesterEmail\", qm_manager.name as \"qmManagerName\", qm_manager.email as \"qmManagerEmail\", (\n CASE \n WHEN EXISTS (\n SELECT 1 FROM vendor_investigation_attachments via \n WHERE via.investigation_id = \"vendor_investigations\".\"id\"\n ) \n THEN true \n ELSE false \n END\n ) as \"hasAttachments\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\" left join users AS requester on \"vendor_investigations\".\"requester_id\" = requester.id left join users AS qm_manager on \"vendor_investigations\".\"qm_manager_id\" = qm_manager.id", + "name": "vendor_investigations_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.cbe_view": { + "columns": {}, + "definition": "select \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"rfq_id\" as \"rfq_id\", \"cbe_evaluations\".\"vendor_id\" as \"vendor_id\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"result\" as \"result\", \"cbe_evaluations\".\"notes\" as \"notes\", \"cbe_evaluations\".\"evaluated_by\" as \"evaluated_by\", \"cbe_evaluations\".\"evaluated_at\" as \"evaluated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"name\" as \"evaluator_name\", \"users\".\"email\" as \"evaluator_email\" from \"cbe_evaluations\" inner join \"rfqs\" on \"cbe_evaluations\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"cbe_evaluations\".\"evaluated_by\" = \"users\".\"id\"", + "name": "cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.rfqs_view": { + "columns": {}, + "definition": "select \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"rfqs\".\"parent_rfq_id\" as \"parent_rfq_id\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"email\" as \"user_email\", \"users\".\"name\" as \"user_name\", (\n SELECT COUNT(*) \n FROM \"rfq_items\" \n WHERE \"rfq_items\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"item_count\", (\n SELECT COUNT(*) \n FROM \"rfq_attachments\" \n WHERE \"rfq_attachments\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"attachment_count\" from \"rfqs\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"rfqs\".\"created_by\" = \"users\".\"id\"", + "name": "rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_cbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", \"cbe_evaluations\".\"notes\" as \"cbe_note\", \"cbe_evaluations\".\"updated_at\" as \"cbe_updated\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"delivery_schedule\" as \"delivery_schedule\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_response_cbe_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"notes\" as \"response_notes\", \"vendor_responses\".\"responded_by\" as \"responded_by\", \"vendor_responses\".\"responded_at\" as \"responded_at\", \"vendor_responses\".\"updated_at\" as \"response_updated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"status\" as \"vendor_status\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"response_status\" as \"commercial_response_status\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"vendor_commercial_responses\".\"payment_terms\" as \"payment_terms\", \"vendor_commercial_responses\".\"incoterms\" as \"incoterms\", \"vendor_commercial_responses\".\"delivery_period\" as \"delivery_period\", \"vendor_commercial_responses\".\"warranty_period\" as \"warranty_period\", \"vendor_commercial_responses\".\"validity_period\" as \"validity_period\", \"vendor_commercial_responses\".\"price_breakdown\" as \"price_breakdown\", \"vendor_commercial_responses\".\"commercial_notes\" as \"commercial_notes\", \"vendor_commercial_responses\".\"created_at\" as \"commercial_created_at\", \"vendor_commercial_responses\".\"updated_at\" as \"commercial_updated_at\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"commercial_response_id\" = \"vendor_commercial_responses\".\"id\"\n ) as \"commercial_attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n AND \"vendor_response_attachments\".\"attachment_type\" = 'TECHNICAL_SPEC'\n ) as \"technical_attachment_count\", (\n SELECT MAX(\"uploaded_at\") \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"latest_attachment_date\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\"", + "name": "vendor_response_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_responses_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"created_at\" as \"rfq_created_at\", \"rfqs\".\"updated_at\" as \"rfq_updated_at\", \"rfqs\".\"created_by\" as \"rfq_created_by\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"responded_at\" as \"responded_at\", CASE WHEN \"vendor_technical_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_technical_response\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", CASE WHEN \"vendor_commercial_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_commercial_response\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"rfq_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE') left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"cbe_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\")", + "name": "vendor_responses_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_rfq_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", + "name": "vendor_rfq_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_tbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", \"vendor_technical_responses\".\"response_status\" as \"technical_response_status\", \"vendor_technical_responses\".\"summary\" as \"technical_summary\", \"vendor_technical_responses\".\"notes\" as \"technical_notes\", \"vendor_technical_responses\".\"updated_at\" as \"technical_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"rfq_evaluations\".\"notes\" as \"tbe_note\", \"rfq_evaluations\".\"updated_at\" as \"tbe_updated\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_tbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.role_view": { + "columns": {}, + "definition": "select \"roles\".\"id\" as \"id\", \"roles\".\"name\" as \"name\", \"roles\".\"description\" as \"description\", \"roles\".\"domain\" as \"domain\", \"roles\".\"created_at\" as \"created_at\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", COUNT(\"users\".\"id\") as \"user_count\" from \"roles\" left join \"user_roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" left join \"users\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"vendors\" on \"roles\".\"company_id\" = \"vendors\".\"id\" group by \"roles\".\"id\", \"vendors\".\"id\"", + "name": "role_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.user_view": { + "columns": {}, + "definition": "select \"users\".\"id\" as \"user_id\", \"users\".\"name\" as \"user_name\", \"users\".\"email\" as \"user_email\", \"users\".\"domain\" as \"user_domain\", \"users\".\"image_url\" as \"user_image\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"vendors\" on \"users\".\"company_id\" = \"vendors\".\"id\" left join \"user_roles\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" group by \"users\".\"id\", \"vendors\".\"id\"", + "name": "user_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.form_lists_view": { + "columns": {}, + "definition": "select \"tag_type_class_form_mappings\".\"id\" as \"id\", \"tag_type_class_form_mappings\".\"project_id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"tag_type_class_form_mappings\".\"tag_type_label\" as \"tag_type_label\", \"tag_type_class_form_mappings\".\"class_label\" as \"class_label\", \"tag_type_class_form_mappings\".\"form_code\" as \"form_code\", \"tag_type_class_form_mappings\".\"form_name\" as \"form_name\", \"tag_type_class_form_mappings\".\"ep\" as \"ep\", \"tag_type_class_form_mappings\".\"remark\" as \"remark\", \"tag_type_class_form_mappings\".\"created_at\" as \"created_at\", \"tag_type_class_form_mappings\".\"updated_at\" as \"updated_at\" from \"tag_type_class_form_mappings\" inner join \"projects\" on \"tag_type_class_form_mappings\".\"project_id\" = \"projects\".\"id\"", + "name": "form_lists_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.view_tag_subfields": { + "columns": { + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "definition": "select \"tag_subfields\".\"id\" as \"id\", \"tag_subfields\".\"tag_type_code\", \"tag_types\".\"description\", \"tag_subfields\".\"attributes_id\", \"tag_subfields\".\"attributes_description\", \"tag_subfields\".\"expression\", \"tag_subfields\".\"delimiter\", \"tag_subfields\".\"sort_order\", \"tag_subfields\".\"created_at\", \"tag_subfields\".\"updated_at\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\", \"projects\".\"name\" from \"tag_subfields\" inner join \"tag_types\" on (\"tag_subfields\".\"tag_type_code\" = \"tag_types\".\"code\" and \"tag_subfields\".\"project_id\" = \"tag_types\".\"project_id\") inner join \"projects\" on \"tag_subfields\".\"project_id\" = \"projects\".\"id\"", + "name": "view_tag_subfields", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.document_stages_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_count": { + "name": "stage_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_list": { + "name": "stage_list", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT\n d.id AS document_id,\n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n d.contract_id,\n (SELECT COUNT(*) FROM issue_stages WHERE document_id = d.id) AS stage_count,\n COALESCE( \n (SELECT json_agg(i.stage_name) FROM issue_stages i WHERE i.document_id = d.id), \n '[]'\n ) AS stage_list,\n d.created_at,\n d.updated_at\n FROM documents d\n", + "name": "document_stages_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.enhanced_documents_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_id": { + "name": "current_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_name": { + "name": "current_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_status": { + "name": "current_stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_order": { + "name": "current_stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_plan_date": { + "name": "current_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_actual_date": { + "name": "current_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_assignee_name": { + "name": "current_stage_assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_priority": { + "name": "current_stage_priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "days_until_due": { + "name": "days_until_due", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_overdue": { + "name": "is_overdue", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "days_difference": { + "name": "days_difference", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "total_stages": { + "name": "total_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "completed_stages": { + "name": "completed_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "progress_percentage": { + "name": "progress_percentage", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_status": { + "name": "latest_revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_submitted_date": { + "name": "latest_submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "all_stages": { + "name": "all_stages", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n WITH document_stats AS (\n SELECT \n d.id as document_id,\n COUNT(ist.id) as total_stages,\n COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) as completed_stages,\n CASE \n WHEN COUNT(ist.id) > 0 \n THEN ROUND((COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) * 100.0) / COUNT(ist.id))\n ELSE 0 \n END as progress_percentage\n FROM documents d\n LEFT JOIN issue_stages ist ON d.id = ist.document_id\n GROUP BY d.id\n ),\n current_stage_info AS (\n SELECT DISTINCT ON (document_id)\n document_id,\n id as current_stage_id,\n stage_name as current_stage_name,\n stage_status as current_stage_status,\n stage_order as current_stage_order,\n plan_date as current_stage_plan_date,\n actual_date as current_stage_actual_date,\n assignee_name as current_stage_assignee_name,\n priority as current_stage_priority,\n CASE \n WHEN actual_date IS NULL AND plan_date IS NOT NULL \n THEN plan_date - CURRENT_DATE\n ELSE NULL \n END as days_until_due,\n CASE \n WHEN actual_date IS NULL AND plan_date < CURRENT_DATE \n THEN true\n WHEN actual_date IS NOT NULL AND actual_date > plan_date \n THEN true\n ELSE false \n END as is_overdue,\n CASE \n WHEN actual_date IS NOT NULL AND plan_date IS NOT NULL \n THEN actual_date - plan_date\n ELSE NULL \n END as days_difference\n FROM issue_stages\n WHERE stage_status NOT IN ('COMPLETED', 'APPROVED')\n ORDER BY document_id, stage_order ASC, priority DESC\n ),\n latest_revision_info AS (\n SELECT DISTINCT ON (ist.document_id)\n ist.document_id,\n r.id as latest_revision_id,\n r.revision as latest_revision,\n r.revision_status as latest_revision_status,\n r.uploader_name as latest_revision_uploader_name,\n r.submitted_date as latest_submitted_date\n FROM revisions r\n JOIN issue_stages ist ON r.issue_stage_id = ist.id\n ORDER BY ist.document_id, r.created_at DESC\n ),\n -- 리비전별 첨부파일 집계\n revision_attachments AS (\n SELECT \n r.id as revision_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', da.id,\n 'revisionId', da.revision_id,\n 'fileName', da.file_name,\n 'filePath', da.file_path,\n 'fileSize', da.file_size,\n 'fileType', da.file_type,\n 'createdAt', da.created_at,\n 'updatedAt', da.updated_at\n ) ORDER BY da.created_at\n ) FILTER (WHERE da.id IS NOT NULL),\n '[]'::json\n ) as attachments\n FROM revisions r\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY r.id\n ),\n -- 스테이지별 리비전 집계 (첨부파일 포함)\n stage_revisions AS (\n SELECT \n ist.id as stage_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', r.id,\n 'issueStageId', r.issue_stage_id,\n 'revision', r.revision,\n 'uploaderType', r.uploader_type,\n 'uploaderId', r.uploader_id,\n 'uploaderName', r.uploader_name,\n 'comment', r.comment,\n 'usage', r.usage,\n 'revisionStatus', r.revision_status,\n 'submittedDate', r.submitted_date,\n 'uploadedAt', r.uploaded_at,\n 'approvedDate', r.approved_date,\n 'reviewStartDate', r.review_start_date,\n 'rejectedDate', r.rejected_date,\n 'reviewerId', r.reviewer_id,\n 'reviewerName', r.reviewer_name,\n 'reviewComments', r.review_comments,\n 'createdAt', r.created_at,\n 'updatedAt', r.updated_at,\n 'attachments', ra.attachments\n ) ORDER BY r.created_at\n ) FILTER (WHERE r.id IS NOT NULL),\n '[]'::json\n ) as revisions\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN revision_attachments ra ON r.id = ra.revision_id\n GROUP BY ist.id\n ),\n -- 문서별 스테이지 집계 (리비전 포함)\n stage_aggregation AS (\n SELECT \n ist.document_id,\n json_agg(\n json_build_object(\n 'id', ist.id,\n 'stageName', ist.stage_name,\n 'stageStatus', ist.stage_status,\n 'stageOrder', ist.stage_order,\n 'planDate', ist.plan_date,\n 'actualDate', ist.actual_date,\n 'assigneeName', ist.assignee_name,\n 'priority', ist.priority,\n 'revisions', sr.revisions\n ) ORDER BY ist.stage_order\n ) as all_stages\n FROM issue_stages ist\n LEFT JOIN stage_revisions sr ON ist.id = sr.stage_id\n GROUP BY ist.document_id\n ),\n attachment_counts AS (\n SELECT \n ist.document_id,\n COUNT(da.id) as attachment_count\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY ist.document_id\n )\n \n SELECT \n d.id as document_id,\n d.doc_number,\n d.drawing_kind,\n d.vendor_doc_number, -- ✅ 벤더 문서 번호 추가\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n\n d.c_gbn,\n d.d_gbn,\n d.degree_gbn,\n d.dept_gbn,\n d.s_gbn,\n\n\n \n -- ✅ 프로젝트 및 벤더 정보 추가\n p.code as project_code,\n v.vendor_name as vendor_name,\n v.vendor_code as vendor_code,\n \n -- 현재 스테이지 정보\n csi.current_stage_id,\n csi.current_stage_name,\n csi.current_stage_status,\n csi.current_stage_order,\n csi.current_stage_plan_date,\n csi.current_stage_actual_date,\n csi.current_stage_assignee_name,\n csi.current_stage_priority,\n \n -- 계산 필드\n csi.days_until_due,\n csi.is_overdue,\n csi.days_difference,\n \n -- 진행률 정보\n ds.total_stages,\n ds.completed_stages,\n ds.progress_percentage,\n \n -- 최신 리비전 정보\n lri.latest_revision_id,\n lri.latest_revision,\n lri.latest_revision_status,\n lri.latest_revision_uploader_name,\n lri.latest_submitted_date,\n \n -- 전체 스테이지 (리비전 및 첨부파일 포함)\n COALESCE(sa.all_stages, '[]'::json) as all_stages,\n \n -- 기타\n COALESCE(ac.attachment_count, 0) as attachment_count,\n d.created_at,\n d.updated_at\n \n FROM documents d\n -- ✅ contracts, projects, vendors 테이블 JOIN 추가\n LEFT JOIN contracts c ON d.contract_id = c.id\n LEFT JOIN projects p ON c.project_id = p.id\n LEFT JOIN vendors v ON c.vendor_id = v.id\n \n LEFT JOIN document_stats ds ON d.id = ds.document_id\n LEFT JOIN current_stage_info csi ON d.id = csi.document_id\n LEFT JOIN latest_revision_info lri ON d.id = lri.document_id\n LEFT JOIN stage_aggregation sa ON d.id = sa.document_id\n LEFT JOIN attachment_counts ac ON d.id = ac.document_id\n \n ORDER BY d.created_at DESC\n", + "name": "enhanced_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.sync_status_view": { + "columns": { + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "total_changes": { + "name": "total_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pending_changes": { + "name": "pending_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "synced_changes": { + "name": "synced_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "failed_changes": { + "name": "failed_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "last_sync_at": { + "name": "last_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_sync_at": { + "name": "next_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n WITH change_stats AS (\n SELECT \n cl.contract_id,\n sc.target_system,\n COUNT(*) as total_changes,\n COUNT(CASE WHEN cl.is_synced = false AND cl.sync_attempts < sc.retry_max_attempts THEN 1 END) as pending_changes,\n COUNT(CASE WHEN cl.is_synced = true THEN 1 END) as synced_changes,\n COUNT(CASE WHEN cl.sync_attempts >= sc.retry_max_attempts AND cl.is_synced = false THEN 1 END) as failed_changes,\n MAX(cl.synced_at) as last_sync_at\n FROM change_logs cl\n CROSS JOIN sync_configs sc \n WHERE cl.contract_id = sc.contract_id\n AND (cl.target_systems IS NULL OR cl.target_systems @> to_jsonb(sc.target_system))\n GROUP BY cl.contract_id, sc.target_system\n )\n SELECT \n cs.contract_id,\n cs.target_system,\n COALESCE(cs.total_changes, 0) as total_changes,\n COALESCE(cs.pending_changes, 0) as pending_changes,\n COALESCE(cs.synced_changes, 0) as synced_changes,\n COALESCE(cs.failed_changes, 0) as failed_changes,\n cs.last_sync_at,\n CASE \n WHEN sc.sync_enabled = true AND sc.last_successful_sync IS NOT NULL \n THEN sc.last_successful_sync + (sc.sync_interval_minutes || ' minutes')::interval\n ELSE NULL\n END as next_sync_at,\n sc.sync_enabled\n FROM sync_configs sc\n LEFT JOIN change_stats cs ON sc.contract_id = cs.contract_id AND sc.target_system = cs.target_system\n", + "name": "sync_status_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_documents_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "latest_stage_id": { + "name": "latest_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_stage_name": { + "name": "latest_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_stage_plan_date": { + "name": "latest_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_stage_actual_date": { + "name": "latest_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_type": { + "name": "latest_revision_uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT \n d.id, \n d.doc_number,\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n (SELECT id FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_id,\n (SELECT stage_name FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_name,\n (SELECT plan_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_plan_date,\n (SELECT actual_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_actual_date,\n \n (SELECT r.id FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_id,\n (SELECT r.revision FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision,\n (SELECT r.uploader_type FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_type,\n (SELECT r.uploader_name FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_name,\n \n (SELECT COUNT(*) FROM document_attachments a JOIN revisions r ON a.revision_id = r.id JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id) AS attachment_count,\n \n d.created_at,\n d.updated_at\n FROM documents d\n JOIN contracts c ON d.contract_id = c.id\n ", + "name": "vendor_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_candidates_with_vendor_info": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_candidates\".\"id\", \"vendor_candidates\".\"company_name\", \"vendor_candidates\".\"contact_email\", \"vendor_candidates\".\"contact_phone\", \"vendor_candidates\".\"tax_id\", \"vendor_candidates\".\"address\", \"vendor_candidates\".\"country\", \"vendor_candidates\".\"source\", \"vendor_candidates\".\"status\", \"vendor_candidates\".\"items\", \"vendor_candidates\".\"remark\", \"vendor_candidates\".\"created_at\", \"vendor_candidates\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"created_at\" as \"vendor_created_at\", (\n SELECT l2.\"created_at\"\n FROM \"vendor_candidate_logs\" l2\n WHERE l2.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l2.\"action\" = 'status_change'\n ORDER BY l2.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_at\", (\n SELECT u.\"name\"\n FROM \"users\" u\n JOIN \"vendor_candidate_logs\" l3\n ON l3.\"user_id\" = u.\"id\"\n WHERE l3.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l3.\"action\" = 'status_change'\n ORDER BY l3.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_by\", (\n SELECT l4.\"created_at\"\n FROM \"vendor_candidate_logs\" l4\n WHERE l4.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l4.\"action\" = 'invite_sent'\n ORDER BY l4.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_at\", (\n SELECT u2.\"name\"\n FROM \"users\" u2\n JOIN \"vendor_candidate_logs\" l5\n ON l5.\"user_id\" = u2.\"id\"\n WHERE l5.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l5.\"action\" = 'invite_sent'\n ORDER BY l5.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_by\" from \"vendor_candidates\" left join \"vendors\" on \"vendor_candidates\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "vendor_candidates_with_vendor_info", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"business_size\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"", + "name": "vendor_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", + "name": "vendor_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_materials_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_materials\".\"id\", \"vendor_possible_materials\".\"vendor_id\", \"materials\".\"item_name\", \"materials\".\"item_code\", \"materials\".\"description\", \"materials\".\"unit_of_measure\", \"materials\".\"steel_type\", \"materials\".\"grade_material\", \"vendor_possible_materials\".\"created_at\", \"vendor_possible_materials\".\"updated_at\" from \"vendor_possible_materials\" left join \"materials\" on \"vendor_possible_materials\".\"item_code\" = \"materials\".\"item_code\"", + "name": "vendor_materials_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendors_with_types": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"tax_id\" as \"tax_id\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"phone\" as \"phone\", \"vendors\".\"email\" as \"email\", \"vendors\".\"business_size\" as \"business_size\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"status\", \"vendors\".\"vendor_type_id\" as \"vendor_type_id\", \"vendors\".\"representative_name\" as \"representative_name\", \"vendors\".\"representative_birth\" as \"representative_birth\", \"vendors\".\"representative_email\" as \"representative_email\", \"vendors\".\"representative_phone\" as \"representative_phone\", \"vendors\".\"corporate_registration_number\" as \"corporate_registration_number\", \"vendors\".\"items\" as \"items\", \"vendors\".\"credit_agency\" as \"credit_agency\", \"vendors\".\"credit_rating\" as \"credit_rating\", \"vendors\".\"cash_flow_rating\" as \"cash_flow_rating\", \"vendors\".\"created_at\" as \"created_at\", \"vendors\".\"updated_at\" as \"updated_at\", \"vendor_types\".\"name_ko\" as \"vendor_type_name\", \"vendor_types\".\"name_en\" as \"vendor_type_name_en\", \"vendor_types\".\"code\" as \"vendor_type_code\", \n CASE\n WHEN \"vendors\".\"status\" = 'ACTIVE' THEN '정규업체'\n WHEN \"vendors\".\"status\" IN ('INACTIVE', 'BLACKLISTED', 'REJECTED') THEN ''\n ELSE '잠재업체'\n END\n as \"vendor_category\" from \"vendors\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\"", + "name": "vendors_with_types", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.basic_contract_view": { + "columns": {}, + "definition": "select \"basic_contract\".\"id\" as \"id\", \"basic_contract\".\"template_id\" as \"template_id\", \"basic_contract\".\"vendor_id\" as \"vendor_id\", \"basic_contract\".\"requested_by\" as \"requested_by\", \"basic_contract\".\"status\" as \"basic_contract_status\", \"basic_contract\".\"created_at\" as \"created_at\", \"basic_contract\".\"updated_at\" as \"updated_at\", \"basic_contract\".\"updated_at\" as \"completed_at\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"email\" as \"vendor_email\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"users\".\"name\" as \"user_name\", \"basic_contract_templates\".\"template_name\" as \"template_name\", \"basic_contract_templates\".\"validity_period\" as \"validityPeriod\", \"basic_contract_templates\".\"file_path\" as \"file_path\", \"basic_contract_templates\".\"file_name\" as \"file_name\", \"basic_contract\".\"file_path\" as \"signed_file_path\" from \"basic_contract\" left join \"vendors\" on \"basic_contract\".\"vendor_id\" = \"vendors\".\"id\" left join \"users\" on \"basic_contract\".\"requested_by\" = \"users\".\"id\" left join \"basic_contract_templates\" on \"basic_contract\".\"template_id\" = \"basic_contract_templates\".\"id\"", + "name": "basic_contract_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.pr_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"pr_items\".\"id\", \"pr_items\".\"procurement_rfqs_id\", \"pr_items\".\"rfq_item\", \"pr_items\".\"pr_item\", \"pr_items\".\"pr_no\", \"pr_items\".\"material_code\", \"pr_items\".\"material_category\", \"pr_items\".\"acc\", \"pr_items\".\"material_description\", \"pr_items\".\"size\", \"pr_items\".\"delivery_date\", \"pr_items\".\"quantity\", \"pr_items\".\"uom\", \"pr_items\".\"gross_weight\", \"pr_items\".\"gw_uom\", \"pr_items\".\"spec_no\", \"pr_items\".\"spec_url\", \"pr_items\".\"tracking_no\", \"pr_items\".\"major_yn\", \"pr_items\".\"project_def\", \"pr_items\".\"project_sc\", \"pr_items\".\"project_kl\", \"pr_items\".\"project_lc\", \"pr_items\".\"project_dl\", \"pr_items\".\"remark\", \"procurement_rfqs\".\"rfq_code\", \"procurement_rfqs\".\"item_code\", \"procurement_rfqs\".\"item_name\" from \"pr_items\" left join \"procurement_rfqs\" on \"pr_items\".\"procurement_rfqs_id\" = \"procurement_rfqs\".\"id\"", + "name": "pr_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfq_details_view": { + "columns": {}, + "definition": "select \"rfq_details\".\"id\" as \"detail_id\", \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfqs\".\"item_code\" as \"item_code\", \"rfqs\".\"item_name\" as \"item_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"country\" as \"vendor_country\", \"rfq_details\".\"currency\" as \"currency\", \"payment_terms\".\"code\" as \"payment_terms_code\", \"payment_terms\".\"description\" as \"payment_terms_description\", \"incoterms\".\"code\" as \"incoterms_code\", \"incoterms\".\"description\" as \"incoterms_description\", \"rfq_details\".\"incoterms_detail\" as \"incoterms_detail\", \"rfq_details\".\"delivery_date\" as \"delivery_date\", \"rfq_details\".\"tax_code\" as \"tax_code\", \"rfq_details\".\"place_of_shipping\" as \"place_of_shipping\", \"rfq_details\".\"place_of_destination\" as \"place_of_destination\", \"rfq_details\".\"material_price_related_yn\" as \"material_price_related_yn\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"rfq_details\".\"updated_at\" as \"updated_at\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\"\n ) as \"pr_items_count\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\" \n AND major_yn = true\n ) as \"major_items_count\", (\n SELECT COUNT(*) \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"comment_count\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_comment_date\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\" AND is_vendor_comment = true\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_vendor_comment_date\", (\n SELECT COUNT(*) \n FROM procurement_rfq_attachments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) > 0\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"has_quotation\", (\n SELECT status\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_status\", (\n SELECT total_price\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_total_price\", (\n SELECT quotation_version\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"quotation_version\", (\n SELECT COUNT(DISTINCT quotation_version)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"quotation_version_count\", (\n SELECT created_at\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"last_quotation_date\" from \"procurement_rfq_details\" \"rfq_details\" left join \"procurement_rfqs\" \"rfqs\" on \"rfq_details\".\"procurement_rfqs_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"rfq_details\".\"vendors_id\" = \"vendors\".\"id\" left join \"payment_terms\" on \"rfq_details\".\"payment_terms_code\" = \"payment_terms\".\"code\" left join \"incoterms\" on \"rfq_details\".\"incoterms_code\" = \"incoterms\".\"code\" left join \"users\" \"updated_by_user\" on \"rfq_details\".\"updated_by\" = \"updated_by_user\".\"id\"", + "name": "procurement_rfq_details_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfqs_view": { + "columns": {}, + "definition": "select \"procurement_rfqs\".\"id\" as \"id\", \"procurement_rfqs\".\"rfq_code\" as \"rfq_code\", \"procurement_rfqs\".\"series\" as \"series\", \"procurement_rfqs\".\"rfq_sealed_yn\" as \"rfq_sealed_yn\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"procurement_rfqs\".\"item_code\" as \"item_code\", \"procurement_rfqs\".\"item_name\" as \"item_name\", \"procurement_rfqs\".\"status\" as \"status\", \"procurement_rfqs\".\"pic_code\" as \"pic_code\", \"procurement_rfqs\".\"rfq_send_date\" as \"rfq_send_date\", \"procurement_rfqs\".\"due_date\" as \"due_date\", (\n SELECT MIN(submitted_at)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"procurement_rfqs\".\"id\"\n AND submitted_at IS NOT NULL\n ) as \"earliest_quotation_submitted_at\", \"created_by_user\".\"name\" as \"created_by_user_name\", \"sent_by_user\".\"name\" as \"sent_by_user_name\", \"procurement_rfqs\".\"updated_at\" as \"updated_at\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"procurement_rfqs\".\"remark\" as \"remark\", (\n SELECT material_code \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"major_item_material_code\", (\n SELECT pr_no \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"po_no\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n ) as \"pr_items_count\" from \"procurement_rfqs\" left join \"projects\" on \"procurement_rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" \"created_by_user\" on \"procurement_rfqs\".\"created_by\" = \"created_by_user\".\"id\" left join \"users\" \"updated_by_user\" on \"procurement_rfqs\".\"updated_by\" = \"updated_by_user\".\"id\" left join \"users\" \"sent_by_user\" on \"procurement_rfqs\".\"sent_by\" = \"sent_by_user\".\"id\"", + "name": "procurement_rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.b_rfqs_master": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pic_name": { + "name": "pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "eng_pic_name": { + "name": "eng_pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "package_no": { + "name": "package_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "package_name": { + "name": "package_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_name": { + "name": "project_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_type": { + "name": "project_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "project_company": { + "name": "project_company", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_flag": { + "name": "project_flag", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_site": { + "name": "project_site", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "total_attachments": { + "name": "total_attachments", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.description,\n br.status,\n br.due_date,\n br.pic_code,\n br.pic_name,\n br.eng_pic_name,\n br.package_no,\n br.package_name,\n br.project_id,\n p.code as project_code,\n p.name as project_name,\n p.type as project_type,\n br.project_company,\n br.project_flag,\n br.project_site,\n COALESCE(att_count.total_attachments, 0) as total_attachments,\n br.created_at,\n br.updated_at\n FROM b_rfqs br\n LEFT JOIN projects p ON br.project_id = p.id\n LEFT JOIN (\n SELECT rfq_id, COUNT(*) as total_attachments\n FROM b_rfq_attachments\n GROUP BY rfq_id\n ) att_count ON br.id = att_count.rfq_id\n", + "name": "b_rfqs_master", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.final_rfq_detail": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "rfq_status": { + "name": "rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "final_rfq_id": { + "name": "final_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "final_rfq_status": { + "name": "final_rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_country": { + "name": "vendor_country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "vendor_business_size": { + "name": "vendor_business_size", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "valid_date": { + "name": "valid_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_description": { + "name": "incoterms_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "payment_terms_description": { + "name": "payment_terms_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "short_list": { + "name": "short_list", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "return_yn": { + "name": "return_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "cp_request_yn": { + "name": "cp_request_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "prject_gtc_yn": { + "name": "prject_gtc_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "firsttime_yn": { + "name": "firsttime_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "return_revision": { + "name": "return_revision", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "gtc": { + "name": "gtc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "gtc_valid_date": { + "name": "gtc_valid_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sparepart": { + "name": "sparepart", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vendor_remark": { + "name": "vendor_remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.status as rfq_status,\n fr.id as final_rfq_id,\n fr.final_rfq_status,\n fr.vendor_id,\n v.vendor_code,\n v.vendor_name,\n v.country as vendor_country,\n v.business_size as vendor_business_size,\n fr.due_date,\n fr.valid_date,\n fr.delivery_date,\n fr.incoterms_code,\n inc.description as incoterms_description,\n fr.payment_terms_code,\n pt.description as payment_terms_description,\n fr.currency,\n fr.tax_code,\n fr.place_of_shipping,\n fr.place_of_destination,\n fr.short_list,\n fr.return_yn,\n fr.cp_request_yn,\n fr.prject_gtc_yn,\n fr.firsttime_yn,\n fr.material_price_related_yn,\n fr.return_revision,\n fr.gtc,\n fr.gtc_valid_date,\n fr.classification,\n fr.sparepart,\n fr.remark,\n fr.vendor_remark,\n fr.created_at,\n fr.updated_at\n FROM b_rfqs br\n JOIN final_rfq fr ON br.id = fr.rfq_id\n LEFT JOIN vendors v ON fr.vendor_id = v.id\n LEFT JOIN incoterms inc ON fr.incoterms_code = inc.code\n LEFT JOIN payment_terms pt ON fr.payment_terms_code = pt.code\n", + "name": "final_rfq_detail", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.initial_rfq_detail": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "rfq_status": { + "name": "rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "initial_rfq_id": { + "name": "initial_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "initial_rfq_status": { + "name": "initial_rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_country": { + "name": "vendor_country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "vendor_business_size": { + "name": "vendor_business_size", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "valid_date": { + "name": "valid_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_description": { + "name": "incoterms_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "short_list": { + "name": "short_list", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "return_yn": { + "name": "return_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "cp_request_yn": { + "name": "cp_request_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "prject_gtc_yn": { + "name": "prject_gtc_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "return_revision": { + "name": "return_revision", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "gtc": { + "name": "gtc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "gtc_valid_date": { + "name": "gtc_valid_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sparepart": { + "name": "sparepart", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.status as rfq_status,\n ir.id as initial_rfq_id,\n ir.initial_rfq_status,\n ir.vendor_id,\n v.vendor_code,\n v.vendor_name,\n v.country as vendor_country,\n v.business_size as vendor_business_size,\n ir.due_date,\n ir.valid_date,\n ir.incoterms_code,\n inc.description as incoterms_description,\n ir.short_list,\n ir.return_yn,\n ir.cp_request_yn,\n ir.prject_gtc_yn,\n ir.return_revision,\n ir.gtc,\n ir.gtc_valid_date,\n ir.classification,\n ir.sparepart,\n ir.created_at,\n ir.updated_at\n FROM b_rfqs br\n JOIN initial_rfq ir ON br.id = ir.rfq_id\n LEFT JOIN vendors v ON ir.vendor_id = v.id\n LEFT JOIN incoterms inc ON ir.incoterms_code = inc.code\n", + "name": "initial_rfq_detail", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.rfq_dashboard": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_name": { + "name": "project_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "package_no": { + "name": "package_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "package_name": { + "name": "package_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pic_name": { + "name": "pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "eng_pic_name": { + "name": "eng_pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "total_attachments": { + "name": "total_attachments", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "initial_vendor_count": { + "name": "initial_vendor_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "final_vendor_count": { + "name": "final_vendor_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "initial_response_rate": { + "name": "initial_response_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "final_response_rate": { + "name": "final_response_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "overall_progress": { + "name": "overall_progress", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "days_to_deadline": { + "name": "days_to_deadline", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.description,\n br.status,\n br.due_date,\n p.code as project_code,\n p.name as project_name,\n br.package_no,\n br.package_name,\n br.pic_code,\n br.pic_name,\n br.eng_pic_name,\n COALESCE(att_count.total_attachments, 0) as total_attachments,\n COALESCE(init_summary.vendor_count, 0) as initial_vendor_count,\n COALESCE(final_summary.vendor_count, 0) as final_vendor_count,\n COALESCE(init_summary.avg_response_rate, 0) as initial_response_rate,\n COALESCE(final_summary.avg_response_rate, 0) as final_response_rate,\n CASE \n WHEN br.status = 'DRAFT' THEN 0\n WHEN br.status = 'Doc. Received' THEN 10\n WHEN br.status = 'PIC Assigned' THEN 20\n WHEN br.status = 'Doc. Confirmed' THEN 30\n WHEN br.status = 'Init. RFQ Sent' THEN 40\n WHEN br.status = 'Init. RFQ Answered' THEN 50\n WHEN br.status = 'TBE started' THEN 60\n WHEN br.status = 'TBE finished' THEN 70\n WHEN br.status = 'Final RFQ Sent' THEN 80\n WHEN br.status = 'Quotation Received' THEN 90\n WHEN br.status = 'Vendor Selected' THEN 100\n ELSE 0\n END as overall_progress,\n (br.due_date - CURRENT_DATE) as days_to_deadline,\n br.created_at\n FROM b_rfqs br\n LEFT JOIN projects p ON br.project_id = p.id\n LEFT JOIN (\n SELECT rfq_id, COUNT(*) as total_attachments\n FROM b_rfq_attachments\n GROUP BY rfq_id\n ) att_count ON br.id = att_count.rfq_id\n LEFT JOIN (\n SELECT \n rfq_id, \n COUNT(DISTINCT vendor_id) as vendor_count,\n AVG(response_rate) as avg_response_rate\n FROM vendor_response_summary\n WHERE rfq_type = 'INITIAL'\n GROUP BY rfq_id\n ) init_summary ON br.id = init_summary.rfq_id\n LEFT JOIN (\n SELECT \n rfq_id, \n COUNT(DISTINCT vendor_id) as vendor_count,\n AVG(response_rate) as avg_response_rate\n FROM vendor_response_summary\n WHERE rfq_type = 'FINAL'\n GROUP BY rfq_id\n ) final_summary ON br.id = final_summary.rfq_id\n", + "name": "rfq_dashboard", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_response_summary": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "rfq_status": { + "name": "rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_country": { + "name": "vendor_country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "vendor_business_size": { + "name": "vendor_business_size", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "total_attachments": { + "name": "total_attachments", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "responded_count": { + "name": "responded_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "pending_count": { + "name": "pending_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "waived_count": { + "name": "waived_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "revision_requested_count": { + "name": "revision_requested_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "response_rate": { + "name": "response_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "completion_rate": { + "name": "completion_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.status as rfq_status,\n v.id as vendor_id,\n v.vendor_code,\n v.vendor_name,\n v.country as vendor_country,\n v.business_size as vendor_business_size,\n var.rfq_type,\n COUNT(var.id) as total_attachments,\n COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) as responded_count,\n COUNT(CASE WHEN var.response_status = 'NOT_RESPONDED' THEN 1 END) as pending_count,\n COUNT(CASE WHEN var.response_status = 'WAIVED' THEN 1 END) as waived_count,\n COUNT(CASE WHEN var.response_status = 'REVISION_REQUESTED' THEN 1 END) as revision_requested_count,\n ROUND(\n (COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) * 100.0 / \n NULLIF(COUNT(CASE WHEN var.response_status != 'WAIVED' THEN 1 END), 0)), \n 2\n ) as response_rate,\n ROUND(\n ((COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) + \n COUNT(CASE WHEN var.response_status = 'WAIVED' THEN 1 END)) * 100.0 / COUNT(var.id)), \n 2\n ) as completion_rate\n FROM b_rfqs br\n JOIN b_rfq_attachments bra ON br.id = bra.rfq_id\n JOIN vendor_attachment_responses var ON bra.id = var.attachment_id\n JOIN vendors v ON var.vendor_id = v.id\n GROUP BY br.id, br.rfq_code, br.status, v.id, v.vendor_code, v.vendor_name, v.country, v.business_size, var.rfq_type\n", + "name": "vendor_response_summary", + "schema": "public", + "isExisting": false, + "materialized": false + } + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db/migrations/meta/0126_snapshot.json b/db/migrations/meta/0126_snapshot.json new file mode 100644 index 00000000..4a533e43 --- /dev/null +++ b/db/migrations/meta/0126_snapshot.json @@ -0,0 +1,14065 @@ +{ + "id": "3a6bd142-152d-477c-8b3d-314ff7ced199", + "prevId": "ad5f9af6-a0ee-4e8f-a2a6-c0e408e211b0", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.companies": { + "name": "companies", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "companies_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "taxID": { + "name": "taxID", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_envelopes": { + "name": "contract_envelopes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_envelopes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "envelope_id": { + "name": "envelope_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": true + }, + "document_id": { + "name": "document_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": false + }, + "envelope_status": { + "name": "envelope_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_envelopes_contract_id_contracts_id_fk": { + "name": "contract_envelopes_contract_id_contracts_id_fk", + "tableFrom": "contract_envelopes", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_items": { + "name": "contract_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_items_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_id": { + "name": "item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "unit_price": { + "name": "unit_price", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "total_line_amount": { + "name": "total_line_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_items_contract_item_idx": { + "name": "contract_items_contract_item_idx", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "contract_items_contract_id_contracts_id_fk": { + "name": "contract_items_contract_id_contracts_id_fk", + "tableFrom": "contract_items", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_items_item_id_items_id_fk": { + "name": "contract_items_item_id_items_id_fk", + "tableFrom": "contract_items", + "tableTo": "items", + "columnsFrom": [ + "item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_items_contract_id_item_id_unique": { + "name": "contract_items_contract_id_item_id_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_id", + "item_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_signers": { + "name": "contract_signers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_signers_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "envelope_id": { + "name": "envelope_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_contact_id": { + "name": "vendor_contact_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "signer_type": { + "name": "signer_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'VENDOR'" + }, + "signer_email": { + "name": "signer_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "signer_name": { + "name": "signer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "signer_position": { + "name": "signer_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "signer_status": { + "name": "signer_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "signed_at": { + "name": "signed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_signers_envelope_id_contract_envelopes_id_fk": { + "name": "contract_signers_envelope_id_contract_envelopes_id_fk", + "tableFrom": "contract_signers", + "tableTo": "contract_envelopes", + "columnsFrom": [ + "envelope_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_signers_vendor_contact_id_vendor_contacts_id_fk": { + "name": "contract_signers_vendor_contact_id_vendor_contacts_id_fk", + "tableFrom": "contract_signers", + "tableTo": "vendor_contacts", + "columnsFrom": [ + "vendor_contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contracts": { + "name": "contracts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contracts_project_id_projects_id_fk": { + "name": "contracts_project_id_projects_id_fk", + "tableFrom": "contracts", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contracts_vendor_id_vendors_id_fk": { + "name": "contracts_vendor_id_vendors_id_fk", + "tableFrom": "contracts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contracts_contract_no_unique": { + "name": "contracts_contract_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.poa": { + "name": "poa", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "original_contract_no": { + "name": "original_contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "original_contract_name": { + "name": "original_contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_status": { + "name": "original_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "poa_original_contract_no_contracts_contract_no_fk": { + "name": "poa_original_contract_no_contracts_contract_no_fk", + "tableFrom": "poa", + "tableTo": "contracts", + "columnsFrom": [ + "original_contract_no" + ], + "columnsTo": [ + "contract_no" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_project_id_projects_id_fk": { + "name": "poa_project_id_projects_id_fk", + "tableFrom": "poa", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_vendor_id_vendors_id_fk": { + "name": "poa_vendor_id_vendors_id_fk", + "tableFrom": "poa", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_hull": { + "name": "item_offshore_hull", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_hull_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_hull_item_code_items_item_code_fk": { + "name": "item_offshore_hull_item_code_items_item_code_fk", + "tableFrom": "item_offshore_hull", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_top": { + "name": "item_offshore_top", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_top_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_top_item_code_items_item_code_fk": { + "name": "item_offshore_top_item_code_items_item_code_fk", + "tableFrom": "item_offshore_top", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_shipbuilding": { + "name": "item_shipbuilding", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ship_types": { + "name": "ship_types", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'OPTION'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_shipbuilding_item_code_items_item_code_fk": { + "name": "item_shipbuilding_item_code_items_item_code_fk", + "tableFrom": "item_shipbuilding", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.items": { + "name": "items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_no": { + "name": "project_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "package_code": { + "name": "package_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "sm_code": { + "name": "sm_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "items_item_code_unique": { + "name": "items_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.materials": { + "name": "materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "materials_item_code_unique": { + "name": "materials_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias": { + "name": "pq_criterias", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "check_point": { + "name": "check_point", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "group_name": { + "name": "group_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias_extension": { + "name": "pq_criterias_extension", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_criteria_id": { + "name": "pq_criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_info": { + "name": "contract_info", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "additional_requirement": { + "name": "additional_requirement", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk": { + "name": "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "pq_criterias", + "columnsFrom": [ + "pq_criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "pq_criterias_extension_project_id_projects_id_fk": { + "name": "pq_criterias_extension_project_id_projects_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_criteria_attachments": { + "name": "vendor_criteria_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_criteria_answer_id": { + "name": "vendor_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_criteria_attachments", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigation_attachments": { + "name": "vendor_investigation_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "investigation_id": { + "name": "investigation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'REPORT'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { + "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", + "tableFrom": "vendor_investigation_attachments", + "tableTo": "vendor_investigations", + "columnsFrom": [ + "investigation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigations": { + "name": "vendor_investigations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigations_vendor_id_vendors_id_fk": { + "name": "vendor_investigations_vendor_id_vendors_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk": { + "name": "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendor_pq_submissions", + "columnsFrom": [ + "pq_submission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "vendor_investigations_requester_id_users_id_fk": { + "name": "vendor_investigations_requester_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_qm_manager_id_users_id_fk": { + "name": "vendor_investigations_qm_manager_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "qm_manager_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_submissions": { + "name": "vendor_pq_submissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_number": { + "name": "pq_number", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_pq_submission": { + "name": "unique_pq_submission", + "columns": [ + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_pq_submissions_requester_id_users_id_fk": { + "name": "vendor_pq_submissions_requester_id_users_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_pq_submissions_vendor_id_vendors_id_fk": { + "name": "vendor_pq_submissions_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_submissions_project_id_projects_id_fk": { + "name": "vendor_pq_submissions_project_id_projects_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_pq_submissions_pq_number_unique": { + "name": "vendor_pq_submissions_pq_number_unique", + "nullsNotDistinct": false, + "columns": [ + "pq_number" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_criteria_answers": { + "name": "vendor_pq_criteria_answers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "criteria_id": { + "name": "criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "answer": { + "name": "answer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_criteria_answers_vendor_id_vendors_id_fk": { + "name": "vendor_pq_criteria_answers_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": { + "name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "pq_criterias", + "columnsFrom": [ + "criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_project_id_projects_id_fk": { + "name": "vendor_pq_criteria_answers_project_id_projects_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_review_logs": { + "name": "vendor_pq_review_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_pq_criteria_answer_id": { + "name": "vendor_pq_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "reviewer_comment": { + "name": "reviewer_comment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_pq_review_logs", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_pq_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_project_pqs": { + "name": "vendor_project_pqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_project_pqs_vendor_id_vendors_id_fk": { + "name": "vendor_project_pqs_vendor_id_vendors_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_project_pqs_project_id_projects_id_fk": { + "name": "vendor_project_pqs_project_id_projects_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bidding_projects": { + "name": "bidding_projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "proj_nm": { + "name": "proj_nm", + "type": "varchar(90)", + "primaryKey": false, + "notNull": false + }, + "sector": { + "name": "sector", + "type": "char(1)", + "primaryKey": false, + "notNull": false + }, + "proj_msrm": { + "name": "proj_msrm", + "type": "numeric(3, 0)", + "primaryKey": false, + "notNull": false + }, + "kunnr": { + "name": "kunnr", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "kunnr_nm": { + "name": "kunnr_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "cls_1": { + "name": "cls_1", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "cls1_nm": { + "name": "cls1_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "ptype": { + "name": "ptype", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "ptype_nm": { + "name": "ptype_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_cd": { + "name": "pmodel_cd", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "pmodel_nm": { + "name": "pmodel_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_sz": { + "name": "pmodel_sz", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "pmodel_uom": { + "name": "pmodel_uom", + "type": "char(5)", + "primaryKey": false, + "notNull": false + }, + "txt04": { + "name": "txt04", + "type": "char(4)", + "primaryKey": false, + "notNull": false + }, + "txt30": { + "name": "txt30", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "estm_pm": { + "name": "estm_pm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "bidding_projects_pspid_unique": { + "name": "bidding_projects_pspid_unique", + "nullsNotDistinct": false, + "columns": [ + "pspid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_series": { + "name": "project_series", + "schema": "", + "columns": { + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "sers_no": { + "name": "sers_no", + "type": "char(3)", + "primaryKey": false, + "notNull": true + }, + "sc_dt": { + "name": "sc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "kl_dt": { + "name": "kl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "lc_dt": { + "name": "lc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dl_dt": { + "name": "dl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dock_no": { + "name": "dock_no", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "dock_nm": { + "name": "dock_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "proj_no": { + "name": "proj_no", + "type": "char(24)", + "primaryKey": false, + "notNull": false + }, + "post1": { + "name": "post1", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "project_sersNo_unique": { + "name": "project_sersNo_unique", + "columns": [ + { + "expression": "pspid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sers_no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "project_series_pspid_bidding_projects_pspid_fk": { + "name": "project_series_pspid_bidding_projects_pspid_fk", + "tableFrom": "project_series", + "tableTo": "bidding_projects", + "columnsFrom": [ + "pspid" + ], + "columnsTo": [ + "pspid" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projects": { + "name": "projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cbe_evaluations": { + "name": "cbe_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluated_by": { + "name": "evaluated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluated_at": { + "name": "evaluated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "result": { + "name": "result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "total_cost": { + "name": "total_cost", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_schedule": { + "name": "delivery_schedule", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "cbe_evaluations_rfq_id_rfqs_id_fk": { + "name": "cbe_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_vendor_id_vendors_id_fk": { + "name": "cbe_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_evaluated_by_users_id_fk": { + "name": "cbe_evaluations_evaluated_by_users_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "users", + "columnsFrom": [ + "evaluated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_attachments": { + "name": "rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_attachments_rfq_id_rfqs_id_fk": { + "name": "rfq_attachments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_vendor_id_vendors_id_fk": { + "name": "rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_attachments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_cbe_id_cbe_evaluations_id_fk": { + "name": "rfq_attachments_cbe_id_cbe_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "cbe_evaluations", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_comment_id_rfq_comments_id_fk": { + "name": "rfq_attachments_comment_id_rfq_comments_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_comments": { + "name": "rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "comment_text": { + "name": "comment_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "commented_by": { + "name": "commented_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_comments_rfq_id_rfqs_id_fk": { + "name": "rfq_comments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_vendor_id_vendors_id_fk": { + "name": "rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_commented_by_users_id_fk": { + "name": "rfq_comments_commented_by_users_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "commented_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_comments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_cbe_id_vendor_responses_id_fk": { + "name": "rfq_comments_cbe_id_vendor_responses_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_evaluations": { + "name": "rfq_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "eval_type": { + "name": "eval_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "result": { + "name": "result", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_evaluations_rfq_id_rfqs_id_fk": { + "name": "rfq_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_evaluations_vendor_id_vendors_id_fk": { + "name": "rfq_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_items": { + "name": "rfq_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_items_rfq_id_rfqs_id_fk": { + "name": "rfq_items_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_items", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "rfq_items_item_code_items_item_code_fk": { + "name": "rfq_items_item_code_items_item_code_fk", + "tableFrom": "rfq_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfqs": { + "name": "rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "bid_project_id": { + "name": "bid_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false, + "default": "'PURCHASE'" + }, + "parent_rfq_id": { + "name": "parent_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfqs_project_id_projects_id_fk": { + "name": "rfqs_project_id_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_bid_project_id_bidding_projects_id_fk": { + "name": "rfqs_bid_project_id_bidding_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bid_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_created_by_users_id_fk": { + "name": "rfqs_created_by_users_id_fk", + "tableFrom": "rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_parent_rfq_id_rfqs_id_fk": { + "name": "rfqs_parent_rfq_id_rfqs_id_fk", + "tableFrom": "rfqs", + "tableTo": "rfqs", + "columnsFrom": [ + "parent_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "rfqs_rfq_code_unique": { + "name": "rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_commercial_responses": { + "name": "vendor_commercial_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "total_price": { + "name": "total_price", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_period": { + "name": "delivery_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "warranty_period": { + "name": "warranty_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "validity_period": { + "name": "validity_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "price_breakdown": { + "name": "price_breakdown", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "commercial_notes": { + "name": "commercial_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_commercial_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_commercial_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_commercial_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_attachments": { + "name": "vendor_response_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "technical_response_id": { + "name": "technical_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "commercial_response_id": { + "name": "commercial_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_attachments_response_id_vendor_responses_id_fk": { + "name": "vendor_response_attachments_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk": { + "name": "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_technical_responses", + "columnsFrom": [ + "technical_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk": { + "name": "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_commercial_responses", + "columnsFrom": [ + "commercial_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_responses": { + "name": "vendor_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'REVIEWING'" + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "responded_by": { + "name": "responded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "responded_at": { + "name": "responded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "vendor_response_unique": { + "name": "vendor_response_unique", + "columns": [ + { + "expression": "rfq_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_responses_rfq_id_rfqs_id_fk": { + "name": "vendor_responses_rfq_id_rfqs_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_responses_vendor_id_vendors_id_fk": { + "name": "vendor_responses_vendor_id_vendors_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_technical_responses": { + "name": "vendor_technical_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_technical_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_technical_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_technical_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.otps": { + "name": "otps", + "schema": "", + "columns": { + "email": { + "name": "email", + "type": "varchar(256)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(6)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "otpToken": { + "name": "otpToken", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "otp_expires": { + "name": "otp_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permissions": { + "name": "permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "permissions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "permission_key": { + "name": "permission_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.role_permissions": { + "name": "role_permissions", + "schema": "", + "columns": { + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "permission_id": { + "name": "permission_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "role_permissions_role_id_roles_id_fk": { + "name": "role_permissions_role_id_roles_id_fk", + "tableFrom": "role_permissions", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "role_permissions_permission_id_permissions_id_fk": { + "name": "role_permissions_permission_id_permissions_id_fk", + "tableFrom": "role_permissions", + "tableTo": "permissions", + "columnsFrom": [ + "permission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.roles": { + "name": "roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "roles_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "roles_company_id_vendors_id_fk": { + "name": "roles_company_id_vendors_id_fk", + "tableFrom": "roles", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_roles": { + "name": "user_roles", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_roles_user_id_users_id_fk": { + "name": "user_roles_user_id_users_id_fk", + "tableFrom": "user_roles", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_roles_role_id_roles_id_fk": { + "name": "user_roles_role_id_roles_id_fk", + "tableFrom": "user_roles", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "users_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'partners'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "image_url": { + "name": "image_url", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "language": { + "name": "language", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'en'" + } + }, + "indexes": {}, + "foreignKeys": { + "users_company_id_vendors_id_fk": { + "name": "users_company_id_vendors_id_fk", + "tableFrom": "users", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_entries": { + "name": "form_entries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_entries_contract_item_id_contract_items_id_fk": { + "name": "form_entries_contract_item_id_contract_items_id_fk", + "tableFrom": "form_entries", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_metas": { + "name": "form_metas", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "columns": { + "name": "columns", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_metas_project_id_projects_id_fk": { + "name": "form_metas_project_id_projects_id_fk", + "tableFrom": "form_metas", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "form_code_project_unique": { + "name": "form_code_project_unique", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.forms": { + "name": "forms", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "forms_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "eng": { + "name": "eng", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "im": { + "name": "im", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_item_form_code_unique": { + "name": "contract_item_form_code_unique", + "columns": [ + { + "expression": "contract_item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "form_code", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "forms_contract_item_id_contract_items_id_fk": { + "name": "forms_contract_item_id_contract_items_id_fk", + "tableFrom": "forms", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_class_attributes": { + "name": "tag_class_attributes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_class_attributes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "tag_class_id": { + "name": "tag_class_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "att_id": { + "name": "att_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "def_val": { + "name": "def_val", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uom_id": { + "name": "uom_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "seq": { + "name": "seq", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "tag_class_attributes_seq_idx": { + "name": "tag_class_attributes_seq_idx", + "columns": [ + { + "expression": "seq", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "tag_class_attributes_tag_class_id_tag_classes_id_fk": { + "name": "tag_class_attributes_tag_class_id_tag_classes_id_fk", + "tableFrom": "tag_class_attributes", + "tableTo": "tag_classes", + "columnsFrom": [ + "tag_class_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_att_id_in_tag_class": { + "name": "uniq_att_id_in_tag_class", + "nullsNotDistinct": false, + "columns": [ + "tag_class_id", + "att_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_classes": { + "name": "tag_classes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_classes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_classes_project_id_projects_id_fk": { + "name": "tag_classes_project_id_projects_id_fk", + "tableFrom": "tag_classes", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk": { + "name": "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk", + "tableFrom": "tag_classes", + "tableTo": "tag_types", + "columnsFrom": [ + "tag_type_code", + "project_id" + ], + "columnsTo": [ + "code", + "project_id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_code_in_project": { + "name": "uniq_code_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfield_options": { + "name": "tag_subfield_options", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfield_options_project_id_projects_id_fk": { + "name": "tag_subfield_options_project_id_projects_id_fk", + "tableFrom": "tag_subfield_options", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_attribute_project_code": { + "name": "uniq_attribute_project_code", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "attributes_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfields": { + "name": "tag_subfields", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfields_project_id_projects_id_fk": { + "name": "tag_subfields_project_id_projects_id_fk", + "tableFrom": "tag_subfields", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_tag_type_attribute": { + "name": "uniq_tag_type_attribute", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_code", + "attributes_id" + ] + }, + "uniq_attribute_id_project": { + "name": "uniq_attribute_id_project", + "nullsNotDistinct": false, + "columns": [ + "attributes_id", + "project_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_type_class_form_mappings": { + "name": "tag_type_class_form_mappings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_label": { + "name": "tag_type_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "class_label": { + "name": "class_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "ep": { + "name": "ep", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_mapping_in_project": { + "name": "uniq_mapping_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_label", + "class_label", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_types": { + "name": "tag_types", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_types_project_id_projects_id_fk": { + "name": "tag_types_project_id_projects_id_fk", + "tableFrom": "tag_types", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "tag_types_code_project_id_pk": { + "name": "tag_types_code_project_id_pk", + "columns": [ + "code", + "project_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tags": { + "name": "tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tags_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "tag_type": { + "name": "tag_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "class": { + "name": "class", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tags_contract_item_id_contract_items_id_fk": { + "name": "tags_contract_item_id_contract_items_id_fk", + "tableFrom": "tags", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_form_id_forms_id_fk": { + "name": "tags_form_id_forms_id_fk", + "tableFrom": "tags", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_item_tag_no_unique": { + "name": "contract_item_tag_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_item_id", + "tag_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_data_report_temps": { + "name": "vendor_data_report_temps", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_data_report_temps_contract_item_id_contract_items_id_fk": { + "name": "vendor_data_report_temps_contract_item_id_contract_items_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_data_report_temps_form_id_forms_id_fk": { + "name": "vendor_data_report_temps_form_id_forms_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.change_logs": { + "name": "change_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "changed_fields": { + "name": "changed_fields", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "old_values": { + "name": "old_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "new_values": { + "name": "new_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_name": { + "name": "user_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_synced": { + "name": "is_synced", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "sync_attempts": { + "name": "sync_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_sync_error": { + "name": "last_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "synced_at": { + "name": "synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "target_systems": { + "name": "target_systems", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + } + }, + "indexes": { + "idx_change_logs_contract_synced": { + "name": "idx_change_logs_contract_synced", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_synced", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_created_at": { + "name": "idx_change_logs_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_entity": { + "name": "idx_change_logs_entity", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_sync_attempts": { + "name": "idx_change_logs_sync_attempts", + "columns": [ + { + "expression": "sync_attempts", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.document_attachments": { + "name": "document_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "document_attachments_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "revision_id": { + "name": "revision_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "upload_id": { + "name": "upload_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "file_id": { + "name": "file_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "dolce_file_path": { + "name": "dolce_file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "document_attachments_revision_id_revisions_id_fk": { + "name": "document_attachments_revision_id_revisions_id_fk", + "tableFrom": "document_attachments", + "tableTo": "revisions", + "columnsFrom": [ + "revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.documents": { + "name": "documents", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "documents_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "drawing_move_gbn": { + "name": "drawing_move_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "discipline": { + "name": "discipline", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "external_document_id": { + "name": "external_document_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "external_system_type": { + "name": "external_system_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "external_synced_at": { + "name": "external_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "shi_drawing_no": { + "name": "shi_drawing_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager": { + "name": "manager", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_enm": { + "name": "manager_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_no": { + "name": "manager_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "register_group": { + "name": "register_group", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "register_group_id": { + "name": "register_group_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "create_user_no": { + "name": "create_user_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "create_user_id": { + "name": "create_user_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "create_user_enm": { + "name": "create_user_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_contract_doc_status": { + "name": "unique_contract_doc_status", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_contract_vendor_doc": { + "name": "unique_contract_vendor_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"vendor_doc_number\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_external_doc": { + "name": "unique_external_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_system_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"external_document_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "drawing_kind_idx": { + "name": "drawing_kind_idx", + "columns": [ + { + "expression": "drawing_kind", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "documents_contract_id_contracts_id_fk": { + "name": "documents_contract_id_contracts_id_fk", + "tableFrom": "documents", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.issue_stages": { + "name": "issue_stages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "issue_stages_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_name": { + "name": "stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "plan_date": { + "name": "plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "actual_date": { + "name": "actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "stage_status": { + "name": "stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "stage_order": { + "name": "stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "priority": { + "name": "priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'MEDIUM'" + }, + "assignee_id": { + "name": "assignee_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "assignee_name": { + "name": "assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "reminder_days": { + "name": "reminder_days", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_document_stage": { + "name": "unique_document_stage", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_stage_order": { + "name": "document_stage_order", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "issue_stages_document_id_documents_id_fk": { + "name": "issue_stages_document_id_documents_id_fk", + "tableFrom": "issue_stages", + "tableTo": "documents", + "columnsFrom": [ + "document_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.revisions": { + "name": "revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "revisions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "issue_stage_id": { + "name": "issue_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "revision": { + "name": "revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "uploader_type": { + "name": "uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'vendor'" + }, + "uploader_id": { + "name": "uploader_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploader_name": { + "name": "uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "usage": { + "name": "usage", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "revision_status": { + "name": "revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'SUBMITTED'" + }, + "submitted_date": { + "name": "submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "review_start_date": { + "name": "review_start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "approved_date": { + "name": "approved_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "rejected_date": { + "name": "rejected_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "reviewer_id": { + "name": "reviewer_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "review_comments": { + "name": "review_comments", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "external_upload_id": { + "name": "external_upload_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_stage_rev": { + "name": "unique_stage_rev", + "columns": [ + { + "expression": "issue_stage_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "revision", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_batches": { + "name": "sync_batches", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "batch_size": { + "name": "batch_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "retry_count": { + "name": "retry_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "change_log_ids": { + "name": "change_log_ids", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "success_count": { + "name": "success_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "failure_count": { + "name": "failure_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sync_metadata": { + "name": "sync_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_batches_contract_system": { + "name": "idx_sync_batches_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_status": { + "name": "idx_sync_batches_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_created_at": { + "name": "idx_sync_batches_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_configs": { + "name": "sync_configs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "sync_interval_minutes": { + "name": "sync_interval_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 30 + }, + "last_successful_sync": { + "name": "last_successful_sync", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_sync_attempt": { + "name": "last_sync_attempt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "endpoint_url": { + "name": "endpoint_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "auth_token": { + "name": "auth_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "api_version": { + "name": "api_version", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'v1'" + }, + "max_batch_size": { + "name": "max_batch_size", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 100 + }, + "retry_max_attempts": { + "name": "retry_max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_configs_contract_system": { + "name": "idx_sync_configs_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sync_configs_contract_id_contracts_id_fk": { + "name": "sync_configs_contract_id_contracts_id_fk", + "tableFrom": "sync_configs", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_attachments": { + "name": "vendor_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'GENERAL'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_attachments_vendor_id_vendors_id_fk": { + "name": "vendor_attachments_vendor_id_vendors_id_fk", + "tableFrom": "vendor_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidates": { + "name": "vendor_candidates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidates_vendor_id_vendors_id_fk": { + "name": "vendor_candidates_vendor_id_vendors_id_fk", + "tableFrom": "vendor_candidates", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_contacts": { + "name": "vendor_contacts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contact_name": { + "name": "contact_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_position": { + "name": "contact_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "is_primary": { + "name": "is_primary", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_contacts_vendor_id_vendors_id_fk": { + "name": "vendor_contacts_vendor_id_vendors_id_fk", + "tableFrom": "vendor_contacts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_items": { + "name": "vendor_possible_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_items_vendor_id_vendors_id_fk": { + "name": "vendor_possible_items_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_items_item_code_items_item_code_fk": { + "name": "vendor_possible_items_item_code_items_item_code_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_materials": { + "name": "vendor_possible_materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_materials_vendor_id_vendors_id_fk": { + "name": "vendor_possible_materials_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_materials_item_code_materials_item_code_fk": { + "name": "vendor_possible_materials_item_code_materials_item_code_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "materials", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_types": { + "name": "vendor_types", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_types_code_unique": { + "name": "vendor_types_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors": { + "name": "vendors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "vendor_type_id": { + "name": "vendor_type_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_vendor_type_id_vendor_types_id_fk": { + "name": "vendors_vendor_type_id_vendor_types_id_fk", + "tableFrom": "vendors", + "tableTo": "vendor_types", + "columnsFrom": [ + "vendor_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tasks": { + "name": "tasks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'todo'" + }, + "label": { + "name": "label", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'bug'" + }, + "priority": { + "name": "priority", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'low'" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "current_timestamp" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tasks_code_unique": { + "name": "tasks_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidate_logs": { + "name": "vendor_candidate_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_candidate_id": { + "name": "vendor_candidate_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk": { + "name": "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "vendor_candidates", + "columnsFrom": [ + "vendor_candidate_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_candidate_logs_user_id_users_id_fk": { + "name": "vendor_candidate_logs_user_id_users_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors_logs": { + "name": "vendors_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_logs_vendor_id_vendors_id_fk": { + "name": "vendors_logs_vendor_id_vendors_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendors_logs_user_id_users_id_fk": { + "name": "vendors_logs_user_id_users_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract": { + "name": "basic_contract", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_id": { + "name": "template_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requested_by": { + "name": "requested_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "basic_contract_template_id_basic_contract_templates_id_fk": { + "name": "basic_contract_template_id_basic_contract_templates_id_fk", + "tableFrom": "basic_contract", + "tableTo": "basic_contract_templates", + "columnsFrom": [ + "template_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_vendor_id_vendors_id_fk": { + "name": "basic_contract_vendor_id_vendors_id_fk", + "tableFrom": "basic_contract", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_requested_by_users_id_fk": { + "name": "basic_contract_requested_by_users_id_fk", + "tableFrom": "basic_contract", + "tableTo": "users", + "columnsFrom": [ + "requested_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract_templates": { + "name": "basic_contract_templates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_templates_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_name": { + "name": "template_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "validity_period": { + "name": "validity_period", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.incoterms": { + "name": "incoterms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(20)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "incoterms_created_by_users_id_fk": { + "name": "incoterms_created_by_users_id_fk", + "tableFrom": "incoterms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payment_terms": { + "name": "payment_terms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "payment_terms_created_by_users_id_fk": { + "name": "payment_terms_created_by_users_id_fk", + "tableFrom": "payment_terms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pr_items": { + "name": "pr_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "pr_items", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_attachments": { + "name": "procurement_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "procurement_rfq_details_id": { + "name": "procurement_rfq_details_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk": { + "name": "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfq_details", + "columnsFrom": [ + "procurement_rfq_details_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_created_by_users_id_fk": { + "name": "procurement_attachments_created_by_users_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "attachment_type_check": { + "name": "attachment_type_check", + "value": "\"procurement_attachments\".\"procurement_rfqs_id\" IS NOT NULL OR \"procurement_attachments\".\"procurement_rfq_details_id\" IS NOT NULL" + } + }, + "isRLSEnabled": false + }, + "public.procurement_quotation_items": { + "name": "procurement_quotation_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pr_item_id": { + "name": "pr_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "material_code": { + "name": "material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "uom": { + "name": "uom", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "unit_price": { + "name": "unit_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "vendor_material_code": { + "name": "vendor_material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_material_description": { + "name": "vendor_material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "lead_time_in_days": { + "name": "lead_time_in_days", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_rate": { + "name": "discount_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_amount": { + "name": "discount_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_alternative": { + "name": "is_alternative", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_recommended": { + "name": "is_recommended", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_quotation_items_pr_item_id_pr_items_id_fk": { + "name": "procurement_quotation_items_pr_item_id_pr_items_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "pr_items", + "columnsFrom": [ + "pr_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_attachments": { + "name": "procurement_rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_uploaded_by_users_id_fk": { + "name": "procurement_rfq_attachments_uploaded_by_users_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_comments": { + "name": "procurement_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_comments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_user_id_users_id_fk": { + "name": "procurement_rfq_comments_user_id_users_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_details": { + "name": "procurement_rfq_details", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendors_id": { + "name": "vendors_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'VV'" + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_vendors_id_vendors_id_fk": { + "name": "procurement_rfq_details_vendors_id_vendors_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "vendors", + "columnsFrom": [ + "vendors_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_rfq_details_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_incoterms_code_incoterms_code_fk": { + "name": "procurement_rfq_details_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_updated_by_users_id_fk": { + "name": "procurement_rfq_details_updated_by_users_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfqs": { + "name": "procurement_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "series": { + "name": "series", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "rfq_sealed_yn": { + "name": "rfq_sealed_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfqs_project_id_projects_id_fk": { + "name": "procurement_rfqs_project_id_projects_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_sent_by_users_id_fk": { + "name": "procurement_rfqs_sent_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_created_by_users_id_fk": { + "name": "procurement_rfqs_created_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_updated_by_users_id_fk": { + "name": "procurement_rfqs_updated_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "procurement_rfqs_rfq_code_unique": { + "name": "procurement_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_vendor_quotations": { + "name": "procurement_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_items_count": { + "name": "total_items_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sub_total": { + "name": "sub_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "tax_total": { + "name": "tax_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "discount_total": { + "name": "discount_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "estimated_delivery_date": { + "name": "estimated_delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "procurement_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_incoterms_code_incoterms_code_fk": { + "name": "procurement_vendor_quotations_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.preset_shares": { + "name": "preset_shares", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "preset_id": { + "name": "preset_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "shared_with_user_id": { + "name": "shared_with_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'read'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "preset_shares_preset_id_table_presets_id_fk": { + "name": "preset_shares_preset_id_table_presets_id_fk", + "tableFrom": "preset_shares", + "tableTo": "table_presets", + "columnsFrom": [ + "preset_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_presets": { + "name": "table_presets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_shared": { + "name": "is_shared", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_attachments": { + "name": "tech_sales_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "tech_sales_rfq_id": { + "name": "tech_sales_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "tech_sales_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_attachments_created_by_users_id_fk": { + "name": "tech_sales_attachments_created_by_users_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comment_attachments": { + "name": "tech_sales_rfq_comment_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk": { + "name": "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk": { + "name": "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comments": { + "name": "tech_sales_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_user_id_users_id_fk": { + "name": "tech_sales_rfq_comments_user_id_users_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfqs": { + "name": "tech_sales_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_shipbuilding_id": { + "name": "item_shipbuilding_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "bidding_project_id": { + "name": "bidding_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_snapshot": { + "name": "project_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "series_snapshot": { + "name": "series_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk": { + "name": "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "item_shipbuilding", + "columnsFrom": [ + "item_shipbuilding_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk": { + "name": "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bidding_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_sent_by_users_id_fk": { + "name": "tech_sales_rfqs_sent_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_created_by_users_id_fk": { + "name": "tech_sales_rfqs_created_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_updated_by_users_id_fk": { + "name": "tech_sales_rfqs_updated_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tech_sales_rfqs_rfq_code_unique": { + "name": "tech_sales_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_vendor_quotations": { + "name": "tech_sales_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "tech_sales_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rotation_attempts": { + "name": "ocr_rotation_attempts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "rotation": { + "name": "rotation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "tables_found": { + "name": "tables_found", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "text_quality": { + "name": "text_quality", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "keyword_count": { + "name": "keyword_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "score": { + "name": "score", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "extracted_rows_count": { + "name": "extracted_rows_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_rotation_attempts_session_id_ocr_sessions_id_fk": { + "name": "ocr_rotation_attempts_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rotation_attempts", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rows": { + "name": "ocr_rows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "table_id": { + "name": "table_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "row_index": { + "name": "row_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "report_no": { + "name": "report_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "no": { + "name": "no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "identification_no": { + "name": "identification_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_no": { + "name": "joint_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_type": { + "name": "joint_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "welding_date": { + "name": "welding_date", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "source_table": { + "name": "source_table", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "source_row": { + "name": "source_row", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_ocr_report_no_unique": { + "name": "idx_ocr_report_no_unique", + "columns": [ + { + "expression": "report_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "tag_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "joint_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "joint_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "ocr_rows_table_id_ocr_tables_id_fk": { + "name": "ocr_rows_table_id_ocr_tables_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_tables", + "columnsFrom": [ + "table_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_session_id_ocr_sessions_id_fk": { + "name": "ocr_rows_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_user_id_users_id_fk": { + "name": "ocr_rows_user_id_users_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_sessions": { + "name": "ocr_sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "processing_time": { + "name": "processing_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "best_rotation": { + "name": "best_rotation", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_tables": { + "name": "total_tables", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_rows": { + "name": "total_rows", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "image_enhanced": { + "name": "image_enhanced", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pdf_converted": { + "name": "pdf_converted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "success": { + "name": "success", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "warnings": { + "name": "warnings", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_tables": { + "name": "ocr_tables", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "table_index": { + "name": "table_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "row_count": { + "name": "row_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_tables_session_id_ocr_sessions_id_fk": { + "name": "ocr_tables_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_tables", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.b_rfq_attachment_revisions": { + "name": "b_rfq_attachment_revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_id": { + "name": "attachment_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "revision_no": { + "name": "revision_no", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "is_latest": { + "name": "is_latest", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "revision_comment": { + "name": "revision_comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "latest_revision_idx": { + "name": "latest_revision_idx", + "columns": [ + { + "expression": "attachment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_latest", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "b_rfq_attachment_revisions_attachment_id_b_rfq_attachments_id_fk": { + "name": "b_rfq_attachment_revisions_attachment_id_b_rfq_attachments_id_fk", + "tableFrom": "b_rfq_attachment_revisions", + "tableTo": "b_rfq_attachments", + "columnsFrom": [ + "attachment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "b_rfq_attachment_revisions_created_by_users_id_fk": { + "name": "b_rfq_attachment_revisions_created_by_users_id_fk", + "tableFrom": "b_rfq_attachment_revisions", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.b_rfqs": { + "name": "b_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pic_name": { + "name": "pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "eng_pic_name": { + "name": "eng_pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_company": { + "name": "project_company", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_flag": { + "name": "project_flag", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_site": { + "name": "project_site", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "package_no": { + "name": "package_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "package_name": { + "name": "package_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "b_rfqs_project_id_projects_id_fk": { + "name": "b_rfqs_project_id_projects_id_fk", + "tableFrom": "b_rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "b_rfqs_created_by_users_id_fk": { + "name": "b_rfqs_created_by_users_id_fk", + "tableFrom": "b_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "b_rfqs_updated_by_users_id_fk": { + "name": "b_rfqs_updated_by_users_id_fk", + "tableFrom": "b_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "b_rfqs_rfq_code_unique": { + "name": "b_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.b_rfq_attachments": { + "name": "b_rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "serial_no": { + "name": "serial_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "b_rfq_attachments_rfq_id_b_rfqs_id_fk": { + "name": "b_rfq_attachments_rfq_id_b_rfqs_id_fk", + "tableFrom": "b_rfq_attachments", + "tableTo": "b_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "b_rfq_attachments_created_by_users_id_fk": { + "name": "b_rfq_attachments_created_by_users_id_fk", + "tableFrom": "b_rfq_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.final_rfq": { + "name": "final_rfq", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "final_rfq_status": { + "name": "final_rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "valid_date": { + "name": "valid_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "gtc": { + "name": "gtc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "gtc_valid_date": { + "name": "gtc_valid_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sparepart": { + "name": "sparepart", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "short_list": { + "name": "short_list", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "return_yn": { + "name": "return_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "cp_request_yn": { + "name": "cp_request_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "prject_gtc_yn": { + "name": "prject_gtc_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "return_revision": { + "name": "return_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'VV'" + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "firsttime_yn": { + "name": "firsttime_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vendor_remark": { + "name": "vendor_remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "final_rfq_rfq_id_b_rfqs_id_fk": { + "name": "final_rfq_rfq_id_b_rfqs_id_fk", + "tableFrom": "final_rfq", + "tableTo": "b_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "final_rfq_vendor_id_vendors_id_fk": { + "name": "final_rfq_vendor_id_vendors_id_fk", + "tableFrom": "final_rfq", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "final_rfq_incoterms_code_incoterms_code_fk": { + "name": "final_rfq_incoterms_code_incoterms_code_fk", + "tableFrom": "final_rfq", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "final_rfq_payment_terms_code_payment_terms_code_fk": { + "name": "final_rfq_payment_terms_code_payment_terms_code_fk", + "tableFrom": "final_rfq", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.initial_rfq": { + "name": "initial_rfq", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "initial_rfq_status": { + "name": "initial_rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "valid_date": { + "name": "valid_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "gtc": { + "name": "gtc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "gtc_valid_date": { + "name": "gtc_valid_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sparepart": { + "name": "sparepart", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "short_list": { + "name": "short_list", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "return_yn": { + "name": "return_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "cp_request_yn": { + "name": "cp_request_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "prject_gtc_yn": { + "name": "prject_gtc_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "return_revision": { + "name": "return_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "initial_rfq_rfq_id_b_rfqs_id_fk": { + "name": "initial_rfq_rfq_id_b_rfqs_id_fk", + "tableFrom": "initial_rfq", + "tableTo": "b_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "initial_rfq_vendor_id_vendors_id_fk": { + "name": "initial_rfq_vendor_id_vendors_id_fk", + "tableFrom": "initial_rfq", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "initial_rfq_incoterms_code_incoterms_code_fk": { + "name": "initial_rfq_incoterms_code_incoterms_code_fk", + "tableFrom": "initial_rfq", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_attachment_responses": { + "name": "vendor_attachment_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_id": { + "name": "attachment_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "rfq_record_id": { + "name": "rfq_record_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'NOT_RESPONDED'" + }, + "current_revision": { + "name": "current_revision", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'Rev.0'" + }, + "responded_revision": { + "name": "responded_revision", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "response_comment": { + "name": "response_comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vendor_comment": { + "name": "vendor_comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "responded_at": { + "name": "responded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "vendor_response_idx": { + "name": "vendor_response_idx", + "columns": [ + { + "expression": "attachment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "rfq_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_attachment_responses_attachment_id_b_rfq_attachments_id_fk": { + "name": "vendor_attachment_responses_attachment_id_b_rfq_attachments_id_fk", + "tableFrom": "vendor_attachment_responses", + "tableTo": "b_rfq_attachments", + "columnsFrom": [ + "attachment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_attachment_responses_vendor_id_vendors_id_fk": { + "name": "vendor_attachment_responses_vendor_id_vendors_id_fk", + "tableFrom": "vendor_attachment_responses", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_attachments_b": { + "name": "vendor_response_attachments_b", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_response_id": { + "name": "vendor_response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_attachments_b_vendor_response_id_vendor_attachment_responses_id_fk": { + "name": "vendor_response_attachments_b_vendor_response_id_vendor_attachment_responses_id_fk", + "tableFrom": "vendor_response_attachments_b", + "tableTo": "vendor_attachment_responses", + "columnsFrom": [ + "vendor_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_b_uploaded_by_users_id_fk": { + "name": "vendor_response_attachments_b_uploaded_by_users_id_fk", + "tableFrom": "vendor_response_attachments_b", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_history": { + "name": "vendor_response_history", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_response_id": { + "name": "vendor_response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "previous_status": { + "name": "previous_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "action_by": { + "name": "action_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "action_at": { + "name": "action_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_history_vendor_response_id_vendor_attachment_responses_id_fk": { + "name": "vendor_response_history_vendor_response_id_vendor_attachment_responses_id_fk", + "tableFrom": "vendor_response_history", + "tableTo": "vendor_attachment_responses", + "columnsFrom": [ + "vendor_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_history_action_by_users_id_fk": { + "name": "vendor_response_history_action_by_users_id_fk", + "tableFrom": "vendor_response_history", + "tableTo": "users", + "columnsFrom": [ + "action_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.offshore_hull_work_type": { + "name": "offshore_hull_work_type", + "schema": "public", + "values": [ + "HA", + "HE", + "HH", + "HM", + "NC" + ] + }, + "public.offshore_top_work_type": { + "name": "offshore_top_work_type", + "schema": "public", + "values": [ + "TM", + "TS", + "TE", + "TP" + ] + }, + "public.work_type": { + "name": "work_type", + "schema": "public", + "values": [ + "기장", + "전장", + "선실", + "배관", + "철의" + ] + }, + "public.user_domain": { + "name": "user_domain", + "schema": "public", + "values": [ + "evcp", + "partners" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": { + "public.contracts_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"contracts\".\"id\", \"contracts\".\"contract_no\", \"contracts\".\"contract_name\", \"contracts\".\"status\", \"contracts\".\"start_date\", \"contracts\".\"end_date\", \"contracts\".\"project_id\", \"projects\".\"code\", \"projects\".\"name\", \"contracts\".\"vendor_id\", \"vendors\".\"vendor_name\", \"contracts\".\"payment_terms\", \"contracts\".\"delivery_terms\", \"contracts\".\"delivery_date\", \"contracts\".\"delivery_location\", \"contracts\".\"currency\", \"contracts\".\"total_amount\", \"contracts\".\"discount\", \"contracts\".\"tax\", \"contracts\".\"shipping_fee\", \"contracts\".\"net_total\", \"contracts\".\"partial_shipping_allowed\", \"contracts\".\"partial_payment_allowed\", \"contracts\".\"remarks\", \"contracts\".\"version\", \"contracts\".\"created_at\", \"contracts\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"contracts\".\"id\"\n ) as \"has_signature\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "contracts_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.poa_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", + "name": "poa_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.project_approved_vendors": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"status\", \"vendor_types\".\"name_ko\", \"vendor_types\".\"name_en\", \"projects\".\"code\", \"projects\".\"name\", \"projects\".\"type\", \"vendor_pq_submissions\".\"submitted_at\", \"vendor_pq_submissions\".\"approved_at\" from \"vendors\" inner join \"vendor_pq_submissions\" on \"vendor_pq_submissions\".\"vendor_id\" = \"vendors\".\"id\" inner join \"projects\" on \"vendor_pq_submissions\".\"project_id\" = \"projects\".\"id\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\" where \"vendor_pq_submissions\".\"status\" = 'APPROVED'", + "name": "project_approved_vendors", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_investigations_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"vendor_id\", \"vendor_investigations\".\"pq_submission_id\", \"vendor_investigations\".\"requester_id\", \"vendor_investigations\".\"qm_manager_id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"evaluation_type\", \"vendor_investigations\".\"investigation_address\", \"vendor_investigations\".\"investigation_method\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"forecasted_at\", \"vendor_investigations\".\"requested_at\", \"vendor_investigations\".\"confirmed_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"evaluation_score\", \"vendor_investigations\".\"evaluation_result\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", requester.name as \"requesterName\", requester.email as \"requesterEmail\", qm_manager.name as \"qmManagerName\", qm_manager.email as \"qmManagerEmail\", (\n CASE \n WHEN EXISTS (\n SELECT 1 FROM vendor_investigation_attachments via \n WHERE via.investigation_id = \"vendor_investigations\".\"id\"\n ) \n THEN true \n ELSE false \n END\n ) as \"hasAttachments\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\" left join users AS requester on \"vendor_investigations\".\"requester_id\" = requester.id left join users AS qm_manager on \"vendor_investigations\".\"qm_manager_id\" = qm_manager.id", + "name": "vendor_investigations_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.cbe_view": { + "columns": {}, + "definition": "select \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"rfq_id\" as \"rfq_id\", \"cbe_evaluations\".\"vendor_id\" as \"vendor_id\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"result\" as \"result\", \"cbe_evaluations\".\"notes\" as \"notes\", \"cbe_evaluations\".\"evaluated_by\" as \"evaluated_by\", \"cbe_evaluations\".\"evaluated_at\" as \"evaluated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"name\" as \"evaluator_name\", \"users\".\"email\" as \"evaluator_email\" from \"cbe_evaluations\" inner join \"rfqs\" on \"cbe_evaluations\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"cbe_evaluations\".\"evaluated_by\" = \"users\".\"id\"", + "name": "cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.rfqs_view": { + "columns": {}, + "definition": "select \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"rfqs\".\"parent_rfq_id\" as \"parent_rfq_id\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"email\" as \"user_email\", \"users\".\"name\" as \"user_name\", (\n SELECT COUNT(*) \n FROM \"rfq_items\" \n WHERE \"rfq_items\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"item_count\", (\n SELECT COUNT(*) \n FROM \"rfq_attachments\" \n WHERE \"rfq_attachments\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"attachment_count\" from \"rfqs\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"rfqs\".\"created_by\" = \"users\".\"id\"", + "name": "rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_cbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", \"cbe_evaluations\".\"notes\" as \"cbe_note\", \"cbe_evaluations\".\"updated_at\" as \"cbe_updated\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"delivery_schedule\" as \"delivery_schedule\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_response_cbe_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"notes\" as \"response_notes\", \"vendor_responses\".\"responded_by\" as \"responded_by\", \"vendor_responses\".\"responded_at\" as \"responded_at\", \"vendor_responses\".\"updated_at\" as \"response_updated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"status\" as \"vendor_status\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"response_status\" as \"commercial_response_status\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"vendor_commercial_responses\".\"payment_terms\" as \"payment_terms\", \"vendor_commercial_responses\".\"incoterms\" as \"incoterms\", \"vendor_commercial_responses\".\"delivery_period\" as \"delivery_period\", \"vendor_commercial_responses\".\"warranty_period\" as \"warranty_period\", \"vendor_commercial_responses\".\"validity_period\" as \"validity_period\", \"vendor_commercial_responses\".\"price_breakdown\" as \"price_breakdown\", \"vendor_commercial_responses\".\"commercial_notes\" as \"commercial_notes\", \"vendor_commercial_responses\".\"created_at\" as \"commercial_created_at\", \"vendor_commercial_responses\".\"updated_at\" as \"commercial_updated_at\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"commercial_response_id\" = \"vendor_commercial_responses\".\"id\"\n ) as \"commercial_attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n AND \"vendor_response_attachments\".\"attachment_type\" = 'TECHNICAL_SPEC'\n ) as \"technical_attachment_count\", (\n SELECT MAX(\"uploaded_at\") \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"latest_attachment_date\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\"", + "name": "vendor_response_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_responses_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"created_at\" as \"rfq_created_at\", \"rfqs\".\"updated_at\" as \"rfq_updated_at\", \"rfqs\".\"created_by\" as \"rfq_created_by\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"responded_at\" as \"responded_at\", CASE WHEN \"vendor_technical_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_technical_response\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", CASE WHEN \"vendor_commercial_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_commercial_response\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"rfq_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE') left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"cbe_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\")", + "name": "vendor_responses_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_rfq_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", + "name": "vendor_rfq_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_tbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", \"vendor_technical_responses\".\"response_status\" as \"technical_response_status\", \"vendor_technical_responses\".\"summary\" as \"technical_summary\", \"vendor_technical_responses\".\"notes\" as \"technical_notes\", \"vendor_technical_responses\".\"updated_at\" as \"technical_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"rfq_evaluations\".\"notes\" as \"tbe_note\", \"rfq_evaluations\".\"updated_at\" as \"tbe_updated\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_tbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.role_view": { + "columns": {}, + "definition": "select \"roles\".\"id\" as \"id\", \"roles\".\"name\" as \"name\", \"roles\".\"description\" as \"description\", \"roles\".\"domain\" as \"domain\", \"roles\".\"created_at\" as \"created_at\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", COUNT(\"users\".\"id\") as \"user_count\" from \"roles\" left join \"user_roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" left join \"users\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"vendors\" on \"roles\".\"company_id\" = \"vendors\".\"id\" group by \"roles\".\"id\", \"vendors\".\"id\"", + "name": "role_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.user_view": { + "columns": {}, + "definition": "select \"users\".\"id\" as \"user_id\", \"users\".\"name\" as \"user_name\", \"users\".\"email\" as \"user_email\", \"users\".\"domain\" as \"user_domain\", \"users\".\"image_url\" as \"user_image\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"vendors\" on \"users\".\"company_id\" = \"vendors\".\"id\" left join \"user_roles\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" group by \"users\".\"id\", \"vendors\".\"id\"", + "name": "user_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.form_lists_view": { + "columns": {}, + "definition": "select \"tag_type_class_form_mappings\".\"id\" as \"id\", \"tag_type_class_form_mappings\".\"project_id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"tag_type_class_form_mappings\".\"tag_type_label\" as \"tag_type_label\", \"tag_type_class_form_mappings\".\"class_label\" as \"class_label\", \"tag_type_class_form_mappings\".\"form_code\" as \"form_code\", \"tag_type_class_form_mappings\".\"form_name\" as \"form_name\", \"tag_type_class_form_mappings\".\"ep\" as \"ep\", \"tag_type_class_form_mappings\".\"remark\" as \"remark\", \"tag_type_class_form_mappings\".\"created_at\" as \"created_at\", \"tag_type_class_form_mappings\".\"updated_at\" as \"updated_at\" from \"tag_type_class_form_mappings\" inner join \"projects\" on \"tag_type_class_form_mappings\".\"project_id\" = \"projects\".\"id\"", + "name": "form_lists_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.view_tag_subfields": { + "columns": { + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "definition": "select \"tag_subfields\".\"id\" as \"id\", \"tag_subfields\".\"tag_type_code\", \"tag_types\".\"description\", \"tag_subfields\".\"attributes_id\", \"tag_subfields\".\"attributes_description\", \"tag_subfields\".\"expression\", \"tag_subfields\".\"delimiter\", \"tag_subfields\".\"sort_order\", \"tag_subfields\".\"created_at\", \"tag_subfields\".\"updated_at\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\", \"projects\".\"name\" from \"tag_subfields\" inner join \"tag_types\" on (\"tag_subfields\".\"tag_type_code\" = \"tag_types\".\"code\" and \"tag_subfields\".\"project_id\" = \"tag_types\".\"project_id\") inner join \"projects\" on \"tag_subfields\".\"project_id\" = \"projects\".\"id\"", + "name": "view_tag_subfields", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.document_stages_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_count": { + "name": "stage_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_list": { + "name": "stage_list", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT\n d.id AS document_id,\n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n d.contract_id,\n (SELECT COUNT(*) FROM issue_stages WHERE document_id = d.id) AS stage_count,\n COALESCE( \n (SELECT json_agg(i.stage_name) FROM issue_stages i WHERE i.document_id = d.id), \n '[]'\n ) AS stage_list,\n d.created_at,\n d.updated_at\n FROM documents d\n", + "name": "document_stages_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.enhanced_documents_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_id": { + "name": "current_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_name": { + "name": "current_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_status": { + "name": "current_stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_order": { + "name": "current_stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_plan_date": { + "name": "current_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_actual_date": { + "name": "current_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_assignee_name": { + "name": "current_stage_assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_priority": { + "name": "current_stage_priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "days_until_due": { + "name": "days_until_due", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_overdue": { + "name": "is_overdue", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "days_difference": { + "name": "days_difference", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "total_stages": { + "name": "total_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "completed_stages": { + "name": "completed_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "progress_percentage": { + "name": "progress_percentage", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_status": { + "name": "latest_revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_submitted_date": { + "name": "latest_submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "all_stages": { + "name": "all_stages", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n WITH document_stats AS (\n SELECT \n d.id as document_id,\n COUNT(ist.id) as total_stages,\n COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) as completed_stages,\n CASE \n WHEN COUNT(ist.id) > 0 \n THEN ROUND((COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) * 100.0) / COUNT(ist.id))\n ELSE 0 \n END as progress_percentage\n FROM documents d\n LEFT JOIN issue_stages ist ON d.id = ist.document_id\n GROUP BY d.id\n ),\n current_stage_info AS (\n SELECT DISTINCT ON (document_id)\n document_id,\n id as current_stage_id,\n stage_name as current_stage_name,\n stage_status as current_stage_status,\n stage_order as current_stage_order,\n plan_date as current_stage_plan_date,\n actual_date as current_stage_actual_date,\n assignee_name as current_stage_assignee_name,\n priority as current_stage_priority,\n CASE \n WHEN actual_date IS NULL AND plan_date IS NOT NULL \n THEN plan_date - CURRENT_DATE\n ELSE NULL \n END as days_until_due,\n CASE \n WHEN actual_date IS NULL AND plan_date < CURRENT_DATE \n THEN true\n WHEN actual_date IS NOT NULL AND actual_date > plan_date \n THEN true\n ELSE false \n END as is_overdue,\n CASE \n WHEN actual_date IS NOT NULL AND plan_date IS NOT NULL \n THEN actual_date - plan_date\n ELSE NULL \n END as days_difference\n FROM issue_stages\n WHERE stage_status NOT IN ('COMPLETED', 'APPROVED')\n ORDER BY document_id, stage_order ASC, priority DESC\n ),\n latest_revision_info AS (\n SELECT DISTINCT ON (ist.document_id)\n ist.document_id,\n r.id as latest_revision_id,\n r.revision as latest_revision,\n r.revision_status as latest_revision_status,\n r.uploader_name as latest_revision_uploader_name,\n r.submitted_date as latest_submitted_date\n FROM revisions r\n JOIN issue_stages ist ON r.issue_stage_id = ist.id\n ORDER BY ist.document_id, r.created_at DESC\n ),\n -- 리비전별 첨부파일 집계\n revision_attachments AS (\n SELECT \n r.id as revision_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', da.id,\n 'revisionId', da.revision_id,\n 'fileName', da.file_name,\n 'filePath', da.file_path,\n 'fileSize', da.file_size,\n 'fileType', da.file_type,\n 'createdAt', da.created_at,\n 'updatedAt', da.updated_at\n ) ORDER BY da.created_at\n ) FILTER (WHERE da.id IS NOT NULL),\n '[]'::json\n ) as attachments\n FROM revisions r\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY r.id\n ),\n -- 스테이지별 리비전 집계 (첨부파일 포함)\n stage_revisions AS (\n SELECT \n ist.id as stage_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', r.id,\n 'issueStageId', r.issue_stage_id,\n 'revision', r.revision,\n 'uploaderType', r.uploader_type,\n 'uploaderId', r.uploader_id,\n 'uploaderName', r.uploader_name,\n 'comment', r.comment,\n 'usage', r.usage,\n 'revisionStatus', r.revision_status,\n 'submittedDate', r.submitted_date,\n 'uploadedAt', r.uploaded_at,\n 'approvedDate', r.approved_date,\n 'reviewStartDate', r.review_start_date,\n 'rejectedDate', r.rejected_date,\n 'reviewerId', r.reviewer_id,\n 'reviewerName', r.reviewer_name,\n 'reviewComments', r.review_comments,\n 'createdAt', r.created_at,\n 'updatedAt', r.updated_at,\n 'attachments', ra.attachments\n ) ORDER BY r.created_at\n ) FILTER (WHERE r.id IS NOT NULL),\n '[]'::json\n ) as revisions\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN revision_attachments ra ON r.id = ra.revision_id\n GROUP BY ist.id\n ),\n -- 문서별 스테이지 집계 (리비전 포함)\n stage_aggregation AS (\n SELECT \n ist.document_id,\n json_agg(\n json_build_object(\n 'id', ist.id,\n 'stageName', ist.stage_name,\n 'stageStatus', ist.stage_status,\n 'stageOrder', ist.stage_order,\n 'planDate', ist.plan_date,\n 'actualDate', ist.actual_date,\n 'assigneeName', ist.assignee_name,\n 'priority', ist.priority,\n 'revisions', sr.revisions\n ) ORDER BY ist.stage_order\n ) as all_stages\n FROM issue_stages ist\n LEFT JOIN stage_revisions sr ON ist.id = sr.stage_id\n GROUP BY ist.document_id\n ),\n attachment_counts AS (\n SELECT \n ist.document_id,\n COUNT(da.id) as attachment_count\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY ist.document_id\n )\n \n SELECT \n d.id as document_id,\n d.doc_number,\n d.drawing_kind,\n d.vendor_doc_number, -- ✅ 벤더 문서 번호 추가\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n\n d.c_gbn,\n d.d_gbn,\n d.degree_gbn,\n d.dept_gbn,\n d.s_gbn,\n\n\n \n -- ✅ 프로젝트 및 벤더 정보 추가\n p.code as project_code,\n v.vendor_name as vendor_name,\n v.vendor_code as vendor_code,\n \n -- 현재 스테이지 정보\n csi.current_stage_id,\n csi.current_stage_name,\n csi.current_stage_status,\n csi.current_stage_order,\n csi.current_stage_plan_date,\n csi.current_stage_actual_date,\n csi.current_stage_assignee_name,\n csi.current_stage_priority,\n \n -- 계산 필드\n csi.days_until_due,\n csi.is_overdue,\n csi.days_difference,\n \n -- 진행률 정보\n ds.total_stages,\n ds.completed_stages,\n ds.progress_percentage,\n \n -- 최신 리비전 정보\n lri.latest_revision_id,\n lri.latest_revision,\n lri.latest_revision_status,\n lri.latest_revision_uploader_name,\n lri.latest_submitted_date,\n \n -- 전체 스테이지 (리비전 및 첨부파일 포함)\n COALESCE(sa.all_stages, '[]'::json) as all_stages,\n \n -- 기타\n COALESCE(ac.attachment_count, 0) as attachment_count,\n d.created_at,\n d.updated_at\n \n FROM documents d\n -- ✅ contracts, projects, vendors 테이블 JOIN 추가\n LEFT JOIN contracts c ON d.contract_id = c.id\n LEFT JOIN projects p ON c.project_id = p.id\n LEFT JOIN vendors v ON c.vendor_id = v.id\n \n LEFT JOIN document_stats ds ON d.id = ds.document_id\n LEFT JOIN current_stage_info csi ON d.id = csi.document_id\n LEFT JOIN latest_revision_info lri ON d.id = lri.document_id\n LEFT JOIN stage_aggregation sa ON d.id = sa.document_id\n LEFT JOIN attachment_counts ac ON d.id = ac.document_id\n \n ORDER BY d.created_at DESC\n", + "name": "enhanced_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.sync_status_view": { + "columns": { + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "total_changes": { + "name": "total_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pending_changes": { + "name": "pending_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "synced_changes": { + "name": "synced_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "failed_changes": { + "name": "failed_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "last_sync_at": { + "name": "last_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_sync_at": { + "name": "next_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n WITH change_stats AS (\n SELECT \n cl.contract_id,\n sc.target_system,\n COUNT(*) as total_changes,\n COUNT(CASE WHEN cl.is_synced = false AND cl.sync_attempts < sc.retry_max_attempts THEN 1 END) as pending_changes,\n COUNT(CASE WHEN cl.is_synced = true THEN 1 END) as synced_changes,\n COUNT(CASE WHEN cl.sync_attempts >= sc.retry_max_attempts AND cl.is_synced = false THEN 1 END) as failed_changes,\n MAX(cl.synced_at) as last_sync_at\n FROM change_logs cl\n CROSS JOIN sync_configs sc \n WHERE cl.contract_id = sc.contract_id\n AND (cl.target_systems IS NULL OR cl.target_systems @> to_jsonb(sc.target_system))\n GROUP BY cl.contract_id, sc.target_system\n )\n SELECT \n cs.contract_id,\n cs.target_system,\n COALESCE(cs.total_changes, 0) as total_changes,\n COALESCE(cs.pending_changes, 0) as pending_changes,\n COALESCE(cs.synced_changes, 0) as synced_changes,\n COALESCE(cs.failed_changes, 0) as failed_changes,\n cs.last_sync_at,\n CASE \n WHEN sc.sync_enabled = true AND sc.last_successful_sync IS NOT NULL \n THEN sc.last_successful_sync + (sc.sync_interval_minutes || ' minutes')::interval\n ELSE NULL\n END as next_sync_at,\n sc.sync_enabled\n FROM sync_configs sc\n LEFT JOIN change_stats cs ON sc.contract_id = cs.contract_id AND sc.target_system = cs.target_system\n", + "name": "sync_status_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_documents_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "latest_stage_id": { + "name": "latest_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_stage_name": { + "name": "latest_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_stage_plan_date": { + "name": "latest_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_stage_actual_date": { + "name": "latest_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_type": { + "name": "latest_revision_uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT \n d.id, \n d.doc_number,\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n (SELECT id FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_id,\n (SELECT stage_name FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_name,\n (SELECT plan_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_plan_date,\n (SELECT actual_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_actual_date,\n \n (SELECT r.id FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_id,\n (SELECT r.revision FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision,\n (SELECT r.uploader_type FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_type,\n (SELECT r.uploader_name FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_name,\n \n (SELECT COUNT(*) FROM document_attachments a JOIN revisions r ON a.revision_id = r.id JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id) AS attachment_count,\n \n d.created_at,\n d.updated_at\n FROM documents d\n JOIN contracts c ON d.contract_id = c.id\n ", + "name": "vendor_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_candidates_with_vendor_info": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_candidates\".\"id\", \"vendor_candidates\".\"company_name\", \"vendor_candidates\".\"contact_email\", \"vendor_candidates\".\"contact_phone\", \"vendor_candidates\".\"tax_id\", \"vendor_candidates\".\"address\", \"vendor_candidates\".\"country\", \"vendor_candidates\".\"source\", \"vendor_candidates\".\"status\", \"vendor_candidates\".\"items\", \"vendor_candidates\".\"remark\", \"vendor_candidates\".\"created_at\", \"vendor_candidates\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"created_at\" as \"vendor_created_at\", (\n SELECT l2.\"created_at\"\n FROM \"vendor_candidate_logs\" l2\n WHERE l2.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l2.\"action\" = 'status_change'\n ORDER BY l2.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_at\", (\n SELECT u.\"name\"\n FROM \"users\" u\n JOIN \"vendor_candidate_logs\" l3\n ON l3.\"user_id\" = u.\"id\"\n WHERE l3.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l3.\"action\" = 'status_change'\n ORDER BY l3.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_by\", (\n SELECT l4.\"created_at\"\n FROM \"vendor_candidate_logs\" l4\n WHERE l4.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l4.\"action\" = 'invite_sent'\n ORDER BY l4.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_at\", (\n SELECT u2.\"name\"\n FROM \"users\" u2\n JOIN \"vendor_candidate_logs\" l5\n ON l5.\"user_id\" = u2.\"id\"\n WHERE l5.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l5.\"action\" = 'invite_sent'\n ORDER BY l5.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_by\" from \"vendor_candidates\" left join \"vendors\" on \"vendor_candidates\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "vendor_candidates_with_vendor_info", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"business_size\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"", + "name": "vendor_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", + "name": "vendor_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_materials_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_materials\".\"id\", \"vendor_possible_materials\".\"vendor_id\", \"materials\".\"item_name\", \"materials\".\"item_code\", \"materials\".\"description\", \"materials\".\"unit_of_measure\", \"materials\".\"steel_type\", \"materials\".\"grade_material\", \"vendor_possible_materials\".\"created_at\", \"vendor_possible_materials\".\"updated_at\" from \"vendor_possible_materials\" left join \"materials\" on \"vendor_possible_materials\".\"item_code\" = \"materials\".\"item_code\"", + "name": "vendor_materials_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendors_with_types": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"tax_id\" as \"tax_id\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"phone\" as \"phone\", \"vendors\".\"email\" as \"email\", \"vendors\".\"business_size\" as \"business_size\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"status\", \"vendors\".\"vendor_type_id\" as \"vendor_type_id\", \"vendors\".\"representative_name\" as \"representative_name\", \"vendors\".\"representative_birth\" as \"representative_birth\", \"vendors\".\"representative_email\" as \"representative_email\", \"vendors\".\"representative_phone\" as \"representative_phone\", \"vendors\".\"corporate_registration_number\" as \"corporate_registration_number\", \"vendors\".\"items\" as \"items\", \"vendors\".\"credit_agency\" as \"credit_agency\", \"vendors\".\"credit_rating\" as \"credit_rating\", \"vendors\".\"cash_flow_rating\" as \"cash_flow_rating\", \"vendors\".\"created_at\" as \"created_at\", \"vendors\".\"updated_at\" as \"updated_at\", \"vendor_types\".\"name_ko\" as \"vendor_type_name\", \"vendor_types\".\"name_en\" as \"vendor_type_name_en\", \"vendor_types\".\"code\" as \"vendor_type_code\", \n CASE\n WHEN \"vendors\".\"status\" = 'ACTIVE' THEN '정규업체'\n WHEN \"vendors\".\"status\" IN ('INACTIVE', 'BLACKLISTED', 'REJECTED') THEN ''\n ELSE '잠재업체'\n END\n as \"vendor_category\" from \"vendors\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\"", + "name": "vendors_with_types", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.basic_contract_view": { + "columns": {}, + "definition": "select \"basic_contract\".\"id\" as \"id\", \"basic_contract\".\"template_id\" as \"template_id\", \"basic_contract\".\"vendor_id\" as \"vendor_id\", \"basic_contract\".\"requested_by\" as \"requested_by\", \"basic_contract\".\"status\" as \"basic_contract_status\", \"basic_contract\".\"created_at\" as \"created_at\", \"basic_contract\".\"updated_at\" as \"updated_at\", \"basic_contract\".\"updated_at\" as \"completed_at\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"email\" as \"vendor_email\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"users\".\"name\" as \"user_name\", \"basic_contract_templates\".\"template_name\" as \"template_name\", \"basic_contract_templates\".\"validity_period\" as \"validityPeriod\", \"basic_contract_templates\".\"file_path\" as \"file_path\", \"basic_contract_templates\".\"file_name\" as \"file_name\", \"basic_contract\".\"file_path\" as \"signed_file_path\" from \"basic_contract\" left join \"vendors\" on \"basic_contract\".\"vendor_id\" = \"vendors\".\"id\" left join \"users\" on \"basic_contract\".\"requested_by\" = \"users\".\"id\" left join \"basic_contract_templates\" on \"basic_contract\".\"template_id\" = \"basic_contract_templates\".\"id\"", + "name": "basic_contract_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.pr_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"pr_items\".\"id\", \"pr_items\".\"procurement_rfqs_id\", \"pr_items\".\"rfq_item\", \"pr_items\".\"pr_item\", \"pr_items\".\"pr_no\", \"pr_items\".\"material_code\", \"pr_items\".\"material_category\", \"pr_items\".\"acc\", \"pr_items\".\"material_description\", \"pr_items\".\"size\", \"pr_items\".\"delivery_date\", \"pr_items\".\"quantity\", \"pr_items\".\"uom\", \"pr_items\".\"gross_weight\", \"pr_items\".\"gw_uom\", \"pr_items\".\"spec_no\", \"pr_items\".\"spec_url\", \"pr_items\".\"tracking_no\", \"pr_items\".\"major_yn\", \"pr_items\".\"project_def\", \"pr_items\".\"project_sc\", \"pr_items\".\"project_kl\", \"pr_items\".\"project_lc\", \"pr_items\".\"project_dl\", \"pr_items\".\"remark\", \"procurement_rfqs\".\"rfq_code\", \"procurement_rfqs\".\"item_code\", \"procurement_rfqs\".\"item_name\" from \"pr_items\" left join \"procurement_rfqs\" on \"pr_items\".\"procurement_rfqs_id\" = \"procurement_rfqs\".\"id\"", + "name": "pr_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfq_details_view": { + "columns": {}, + "definition": "select \"rfq_details\".\"id\" as \"detail_id\", \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfqs\".\"item_code\" as \"item_code\", \"rfqs\".\"item_name\" as \"item_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"country\" as \"vendor_country\", \"rfq_details\".\"currency\" as \"currency\", \"payment_terms\".\"code\" as \"payment_terms_code\", \"payment_terms\".\"description\" as \"payment_terms_description\", \"incoterms\".\"code\" as \"incoterms_code\", \"incoterms\".\"description\" as \"incoterms_description\", \"rfq_details\".\"incoterms_detail\" as \"incoterms_detail\", \"rfq_details\".\"delivery_date\" as \"delivery_date\", \"rfq_details\".\"tax_code\" as \"tax_code\", \"rfq_details\".\"place_of_shipping\" as \"place_of_shipping\", \"rfq_details\".\"place_of_destination\" as \"place_of_destination\", \"rfq_details\".\"material_price_related_yn\" as \"material_price_related_yn\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"rfq_details\".\"updated_at\" as \"updated_at\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\"\n ) as \"pr_items_count\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\" \n AND major_yn = true\n ) as \"major_items_count\", (\n SELECT COUNT(*) \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"comment_count\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_comment_date\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\" AND is_vendor_comment = true\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_vendor_comment_date\", (\n SELECT COUNT(*) \n FROM procurement_rfq_attachments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) > 0\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"has_quotation\", (\n SELECT status\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_status\", (\n SELECT total_price\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_total_price\", (\n SELECT quotation_version\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"quotation_version\", (\n SELECT COUNT(DISTINCT quotation_version)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"quotation_version_count\", (\n SELECT created_at\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"last_quotation_date\" from \"procurement_rfq_details\" \"rfq_details\" left join \"procurement_rfqs\" \"rfqs\" on \"rfq_details\".\"procurement_rfqs_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"rfq_details\".\"vendors_id\" = \"vendors\".\"id\" left join \"payment_terms\" on \"rfq_details\".\"payment_terms_code\" = \"payment_terms\".\"code\" left join \"incoterms\" on \"rfq_details\".\"incoterms_code\" = \"incoterms\".\"code\" left join \"users\" \"updated_by_user\" on \"rfq_details\".\"updated_by\" = \"updated_by_user\".\"id\"", + "name": "procurement_rfq_details_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfqs_view": { + "columns": {}, + "definition": "select \"procurement_rfqs\".\"id\" as \"id\", \"procurement_rfqs\".\"rfq_code\" as \"rfq_code\", \"procurement_rfqs\".\"series\" as \"series\", \"procurement_rfqs\".\"rfq_sealed_yn\" as \"rfq_sealed_yn\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"procurement_rfqs\".\"item_code\" as \"item_code\", \"procurement_rfqs\".\"item_name\" as \"item_name\", \"procurement_rfqs\".\"status\" as \"status\", \"procurement_rfqs\".\"pic_code\" as \"pic_code\", \"procurement_rfqs\".\"rfq_send_date\" as \"rfq_send_date\", \"procurement_rfqs\".\"due_date\" as \"due_date\", (\n SELECT MIN(submitted_at)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"procurement_rfqs\".\"id\"\n AND submitted_at IS NOT NULL\n ) as \"earliest_quotation_submitted_at\", \"created_by_user\".\"name\" as \"created_by_user_name\", \"sent_by_user\".\"name\" as \"sent_by_user_name\", \"procurement_rfqs\".\"updated_at\" as \"updated_at\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"procurement_rfqs\".\"remark\" as \"remark\", (\n SELECT material_code \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"major_item_material_code\", (\n SELECT pr_no \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"po_no\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n ) as \"pr_items_count\" from \"procurement_rfqs\" left join \"projects\" on \"procurement_rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" \"created_by_user\" on \"procurement_rfqs\".\"created_by\" = \"created_by_user\".\"id\" left join \"users\" \"updated_by_user\" on \"procurement_rfqs\".\"updated_by\" = \"updated_by_user\".\"id\" left join \"users\" \"sent_by_user\" on \"procurement_rfqs\".\"sent_by\" = \"sent_by_user\".\"id\"", + "name": "procurement_rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.b_rfqs_master": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pic_name": { + "name": "pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "eng_pic_name": { + "name": "eng_pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "package_no": { + "name": "package_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "package_name": { + "name": "package_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_name": { + "name": "project_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_type": { + "name": "project_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "project_company": { + "name": "project_company", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_flag": { + "name": "project_flag", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_site": { + "name": "project_site", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "total_attachments": { + "name": "total_attachments", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.description,\n br.status,\n br.due_date,\n br.pic_code,\n br.pic_name,\n br.eng_pic_name,\n br.package_no,\n br.package_name,\n br.project_id,\n p.code as project_code,\n p.name as project_name,\n p.type as project_type,\n br.project_company,\n br.project_flag,\n br.project_site,\n COALESCE(att_count.total_attachments, 0) as total_attachments,\n br.created_at,\n br.updated_at\n FROM b_rfqs br\n LEFT JOIN projects p ON br.project_id = p.id\n LEFT JOIN (\n SELECT rfq_id, COUNT(*) as total_attachments\n FROM b_rfq_attachments\n GROUP BY rfq_id\n ) att_count ON br.id = att_count.rfq_id\n", + "name": "b_rfqs_master", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.final_rfq_detail": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "rfq_status": { + "name": "rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "final_rfq_id": { + "name": "final_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "final_rfq_status": { + "name": "final_rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_country": { + "name": "vendor_country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "vendor_business_size": { + "name": "vendor_business_size", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "valid_date": { + "name": "valid_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_description": { + "name": "incoterms_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "payment_terms_description": { + "name": "payment_terms_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "short_list": { + "name": "short_list", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "return_yn": { + "name": "return_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "cp_request_yn": { + "name": "cp_request_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "prject_gtc_yn": { + "name": "prject_gtc_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "firsttime_yn": { + "name": "firsttime_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "return_revision": { + "name": "return_revision", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "gtc": { + "name": "gtc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "gtc_valid_date": { + "name": "gtc_valid_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sparepart": { + "name": "sparepart", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vendor_remark": { + "name": "vendor_remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.status as rfq_status,\n fr.id as final_rfq_id,\n fr.final_rfq_status,\n fr.vendor_id,\n v.vendor_code,\n v.vendor_name,\n v.country as vendor_country,\n v.business_size as vendor_business_size,\n fr.due_date,\n fr.valid_date,\n fr.delivery_date,\n fr.incoterms_code,\n inc.description as incoterms_description,\n fr.payment_terms_code,\n pt.description as payment_terms_description,\n fr.currency,\n fr.tax_code,\n fr.place_of_shipping,\n fr.place_of_destination,\n fr.short_list,\n fr.return_yn,\n fr.cp_request_yn,\n fr.prject_gtc_yn,\n fr.firsttime_yn,\n fr.material_price_related_yn,\n fr.return_revision,\n fr.gtc,\n fr.gtc_valid_date,\n fr.classification,\n fr.sparepart,\n fr.remark,\n fr.vendor_remark,\n fr.created_at,\n fr.updated_at\n FROM b_rfqs br\n JOIN final_rfq fr ON br.id = fr.rfq_id\n LEFT JOIN vendors v ON fr.vendor_id = v.id\n LEFT JOIN incoterms inc ON fr.incoterms_code = inc.code\n LEFT JOIN payment_terms pt ON fr.payment_terms_code = pt.code\n", + "name": "final_rfq_detail", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.initial_rfq_detail": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "rfq_status": { + "name": "rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "initial_rfq_id": { + "name": "initial_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "initial_rfq_status": { + "name": "initial_rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_country": { + "name": "vendor_country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "vendor_business_size": { + "name": "vendor_business_size", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "valid_date": { + "name": "valid_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_description": { + "name": "incoterms_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "short_list": { + "name": "short_list", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "return_yn": { + "name": "return_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "cp_request_yn": { + "name": "cp_request_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "prject_gtc_yn": { + "name": "prject_gtc_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "return_revision": { + "name": "return_revision", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "gtc": { + "name": "gtc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "gtc_valid_date": { + "name": "gtc_valid_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sparepart": { + "name": "sparepart", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.status as rfq_status,\n ir.id as initial_rfq_id,\n ir.initial_rfq_status,\n ir.vendor_id,\n v.vendor_code,\n v.vendor_name,\n v.country as vendor_country,\n v.business_size as vendor_business_size,\n ir.due_date,\n ir.valid_date,\n ir.incoterms_code,\n inc.description as incoterms_description,\n ir.short_list,\n ir.return_yn,\n ir.cp_request_yn,\n ir.prject_gtc_yn,\n ir.return_revision,\n ir.gtc,\n ir.gtc_valid_date,\n ir.classification,\n ir.sparepart,\n ir.created_at,\n ir.updated_at\n FROM b_rfqs br\n JOIN initial_rfq ir ON br.id = ir.rfq_id\n LEFT JOIN vendors v ON ir.vendor_id = v.id\n LEFT JOIN incoterms inc ON ir.incoterms_code = inc.code\n", + "name": "initial_rfq_detail", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.rfq_dashboard": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_name": { + "name": "project_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "package_no": { + "name": "package_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "package_name": { + "name": "package_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pic_name": { + "name": "pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "eng_pic_name": { + "name": "eng_pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_company": { + "name": "project_company", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_flag": { + "name": "project_flag", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_site": { + "name": "project_site", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "total_attachments": { + "name": "total_attachments", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "initial_vendor_count": { + "name": "initial_vendor_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "final_vendor_count": { + "name": "final_vendor_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "initial_response_rate": { + "name": "initial_response_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "final_response_rate": { + "name": "final_response_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "overall_progress": { + "name": "overall_progress", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "days_to_deadline": { + "name": "days_to_deadline", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.description,\n br.status,\n br.due_date,\n p.code as project_code,\n p.name as project_name,\n br.package_no,\n br.package_name,\n br.pic_code,\n br.pic_name,\n br.eng_pic_name,\n br.project_company,\n br.project_flag,\n br.project_site,\n br.remark,\n COALESCE(att_count.total_attachments, 0) as total_attachments,\n COALESCE(init_summary.vendor_count, 0) as initial_vendor_count,\n COALESCE(final_summary.vendor_count, 0) as final_vendor_count,\n COALESCE(init_summary.avg_response_rate, 0) as initial_response_rate,\n COALESCE(final_summary.avg_response_rate, 0) as final_response_rate,\n CASE \n WHEN br.status = 'DRAFT' THEN 0\n WHEN br.status = 'Doc. Received' THEN 10\n WHEN br.status = 'PIC Assigned' THEN 20\n WHEN br.status = 'Doc. Confirmed' THEN 30\n WHEN br.status = 'Init. RFQ Sent' THEN 40\n WHEN br.status = 'Init. RFQ Answered' THEN 50\n WHEN br.status = 'TBE started' THEN 60\n WHEN br.status = 'TBE finished' THEN 70\n WHEN br.status = 'Final RFQ Sent' THEN 80\n WHEN br.status = 'Quotation Received' THEN 90\n WHEN br.status = 'Vendor Selected' THEN 100\n ELSE 0\n END as overall_progress,\n (br.due_date - CURRENT_DATE) as days_to_deadline,\n br.created_at,\n br.updated_at\n FROM b_rfqs br\n LEFT JOIN projects p ON br.project_id = p.id\n LEFT JOIN (\n SELECT rfq_id, COUNT(*) as total_attachments\n FROM b_rfq_attachments\n GROUP BY rfq_id\n ) att_count ON br.id = att_count.rfq_id\n LEFT JOIN (\n SELECT \n rfq_id, \n COUNT(DISTINCT vendor_id) as vendor_count,\n AVG(response_rate) as avg_response_rate\n FROM vendor_response_summary\n WHERE rfq_type = 'INITIAL'\n GROUP BY rfq_id\n ) init_summary ON br.id = init_summary.rfq_id\n LEFT JOIN (\n SELECT \n rfq_id, \n COUNT(DISTINCT vendor_id) as vendor_count,\n AVG(response_rate) as avg_response_rate\n FROM vendor_response_summary\n WHERE rfq_type = 'FINAL'\n GROUP BY rfq_id\n ) final_summary ON br.id = final_summary.rfq_id\n", + "name": "rfq_dashboard", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_response_summary": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "rfq_status": { + "name": "rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_country": { + "name": "vendor_country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "vendor_business_size": { + "name": "vendor_business_size", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "total_attachments": { + "name": "total_attachments", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "responded_count": { + "name": "responded_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "pending_count": { + "name": "pending_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "waived_count": { + "name": "waived_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "revision_requested_count": { + "name": "revision_requested_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "response_rate": { + "name": "response_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "completion_rate": { + "name": "completion_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "updated_by_name": { + "name": "updated_by_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "updated_by_email": { + "name": "updated_by_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n -- ② SELECT 절 확장 -------------------------------------------\n SELECT\n br.id AS rfq_id,\n br.rfq_code,\n br.description,\n br.status,\n br.due_date,\n p.code AS project_code,\n p.name AS project_name,\n br.package_no,\n br.package_name,\n br.pic_code,\n br.pic_name,\n br.eng_pic_name,\n br.project_company,\n br.project_flag,\n br.project_site,\n br.remark,\n \n -- 첨부/벤더 요약 -----------------------\n COALESCE(att_count.total_attachments, 0) AS total_attachments,\n COALESCE(init_summary.vendor_count, 0) AS initial_vendor_count,\n COALESCE(final_summary.vendor_count, 0) AS final_vendor_count,\n COALESCE(init_summary.avg_response_rate, 0) AS initial_response_rate,\n COALESCE(final_summary.avg_response_rate, 0) AS final_response_rate,\n \n -- 진행률·마감까지 일수 --------------\n CASE \n WHEN br.status = 'DRAFT' THEN 0\n WHEN br.status = 'Doc. Received' THEN 10\n WHEN br.status = 'PIC Assigned' THEN 20\n WHEN br.status = 'Doc. Confirmed' THEN 30\n WHEN br.status = 'Init. RFQ Sent' THEN 40\n WHEN br.status = 'Init. RFQ Answered' THEN 50\n WHEN br.status = 'TBE started' THEN 60\n WHEN br.status = 'TBE finished' THEN 70\n WHEN br.status = 'Final RFQ Sent' THEN 80\n WHEN br.status = 'Quotation Received' THEN 90\n WHEN br.status = 'Vendor Selected' THEN 100\n ELSE 0\n END AS overall_progress,\n (br.due_date - CURRENT_DATE) AS days_to_deadline,\n \n br.created_at,\n br.updated_at,\n \n -- 💡 추가되는 컬럼 -------------------\n upd.name AS updated_by_name,\n upd.email AS updated_by_email\n FROM b_rfqs br\n LEFT JOIN projects p ON br.project_id = p.id\n \n -- ③ 사용자 정보 조인 --------------------\n LEFT JOIN users upd ON br.updated_by = upd.id\n \n -- (나머지 이미 있던 JOIN 들은 그대로) -----\n LEFT JOIN (\n SELECT rfq_id, COUNT(*) AS total_attachments\n FROM b_rfq_attachments\n GROUP BY rfq_id\n ) att_count ON br.id = att_count.rfq_id\n \n LEFT JOIN (\n SELECT \n rfq_id, \n COUNT(DISTINCT vendor_id) AS vendor_count,\n AVG(response_rate) AS avg_response_rate\n FROM vendor_response_summary\n WHERE rfq_type = 'INITIAL'\n GROUP BY rfq_id\n ) init_summary ON br.id = init_summary.rfq_id\n \n LEFT JOIN (\n SELECT \n rfq_id, \n COUNT(DISTINCT vendor_id) AS vendor_count,\n AVG(response_rate) AS avg_response_rate\n FROM vendor_response_summary\n WHERE rfq_type = 'FINAL'\n GROUP BY rfq_id\n ) final_summary ON br.id = final_summary.rfq_id\n ", + "name": "vendor_response_summary", + "schema": "public", + "isExisting": false, + "materialized": false + } + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db/migrations/meta/0127_snapshot.json b/db/migrations/meta/0127_snapshot.json new file mode 100644 index 00000000..99dbcf77 --- /dev/null +++ b/db/migrations/meta/0127_snapshot.json @@ -0,0 +1,14065 @@ +{ + "id": "4ade0f12-cd16-49cf-a911-89353a9249f7", + "prevId": "3a6bd142-152d-477c-8b3d-314ff7ced199", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.companies": { + "name": "companies", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "companies_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "taxID": { + "name": "taxID", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_envelopes": { + "name": "contract_envelopes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_envelopes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "envelope_id": { + "name": "envelope_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": true + }, + "document_id": { + "name": "document_id", + "type": "varchar(200)", + "primaryKey": false, + "notNull": false + }, + "envelope_status": { + "name": "envelope_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_envelopes_contract_id_contracts_id_fk": { + "name": "contract_envelopes_contract_id_contracts_id_fk", + "tableFrom": "contract_envelopes", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_items": { + "name": "contract_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_items_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_id": { + "name": "item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "unit_price": { + "name": "unit_price", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric(10, 2)", + "primaryKey": false, + "notNull": false + }, + "total_line_amount": { + "name": "total_line_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_items_contract_item_idx": { + "name": "contract_items_contract_item_idx", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "contract_items_contract_id_contracts_id_fk": { + "name": "contract_items_contract_id_contracts_id_fk", + "tableFrom": "contract_items", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_items_item_id_items_id_fk": { + "name": "contract_items_item_id_items_id_fk", + "tableFrom": "contract_items", + "tableTo": "items", + "columnsFrom": [ + "item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_items_contract_id_item_id_unique": { + "name": "contract_items_contract_id_item_id_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_id", + "item_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contract_signers": { + "name": "contract_signers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contract_signers_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "envelope_id": { + "name": "envelope_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_contact_id": { + "name": "vendor_contact_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "signer_type": { + "name": "signer_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'VENDOR'" + }, + "signer_email": { + "name": "signer_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "signer_name": { + "name": "signer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "signer_position": { + "name": "signer_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "signer_status": { + "name": "signer_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "signed_at": { + "name": "signed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contract_signers_envelope_id_contract_envelopes_id_fk": { + "name": "contract_signers_envelope_id_contract_envelopes_id_fk", + "tableFrom": "contract_signers", + "tableTo": "contract_envelopes", + "columnsFrom": [ + "envelope_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contract_signers_vendor_contact_id_vendor_contacts_id_fk": { + "name": "contract_signers_vendor_contact_id_vendor_contacts_id_fk", + "tableFrom": "contract_signers", + "tableTo": "vendor_contacts", + "columnsFrom": [ + "vendor_contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contracts": { + "name": "contracts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "contracts_project_id_projects_id_fk": { + "name": "contracts_project_id_projects_id_fk", + "tableFrom": "contracts", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contracts_vendor_id_vendors_id_fk": { + "name": "contracts_vendor_id_vendors_id_fk", + "tableFrom": "contracts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contracts_contract_no_unique": { + "name": "contracts_contract_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.poa": { + "name": "poa", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "original_contract_no": { + "name": "original_contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "original_contract_name": { + "name": "original_contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_status": { + "name": "original_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "poa_original_contract_no_contracts_contract_no_fk": { + "name": "poa_original_contract_no_contracts_contract_no_fk", + "tableFrom": "poa", + "tableTo": "contracts", + "columnsFrom": [ + "original_contract_no" + ], + "columnsTo": [ + "contract_no" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_project_id_projects_id_fk": { + "name": "poa_project_id_projects_id_fk", + "tableFrom": "poa", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "poa_vendor_id_vendors_id_fk": { + "name": "poa_vendor_id_vendors_id_fk", + "tableFrom": "poa", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_hull": { + "name": "item_offshore_hull", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_hull_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_hull_item_code_items_item_code_fk": { + "name": "item_offshore_hull_item_code_items_item_code_fk", + "tableFrom": "item_offshore_hull", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_offshore_top": { + "name": "item_offshore_top", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "offshore_top_work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sub_item_list": { + "name": "sub_item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_offshore_top_item_code_items_item_code_fk": { + "name": "item_offshore_top_item_code_items_item_code_fk", + "tableFrom": "item_offshore_top", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.item_shipbuilding": { + "name": "item_shipbuilding", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "work_type": { + "name": "work_type", + "type": "work_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "item_list": { + "name": "item_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ship_types": { + "name": "ship_types", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'OPTION'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "item_shipbuilding_item_code_items_item_code_fk": { + "name": "item_shipbuilding_item_code_items_item_code_fk", + "tableFrom": "item_shipbuilding", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.items": { + "name": "items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_no": { + "name": "project_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "package_code": { + "name": "package_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "sm_code": { + "name": "sm_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "items_item_code_unique": { + "name": "items_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.materials": { + "name": "materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_item_code": { + "name": "parent_item_code", + "type": "varchar(18)", + "primaryKey": false, + "notNull": false + }, + "item_level": { + "name": "item_level", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "delete_flag": { + "name": "delete_flag", + "type": "varchar(1)", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "change_date": { + "name": "change_date", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "base_unit_of_measure": { + "name": "base_unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "materials_item_code_unique": { + "name": "materials_item_code_unique", + "nullsNotDistinct": false, + "columns": [ + "item_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias": { + "name": "pq_criterias", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "check_point": { + "name": "check_point", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "group_name": { + "name": "group_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pq_criterias_extension": { + "name": "pq_criterias_extension", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_criteria_id": { + "name": "pq_criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contract_info": { + "name": "contract_info", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "additional_requirement": { + "name": "additional_requirement", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk": { + "name": "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "pq_criterias", + "columnsFrom": [ + "pq_criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "pq_criterias_extension_project_id_projects_id_fk": { + "name": "pq_criterias_extension_project_id_projects_id_fk", + "tableFrom": "pq_criterias_extension", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_criteria_attachments": { + "name": "vendor_criteria_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_criteria_answer_id": { + "name": "vendor_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_criteria_attachments", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigation_attachments": { + "name": "vendor_investigation_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "investigation_id": { + "name": "investigation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'REPORT'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { + "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", + "tableFrom": "vendor_investigation_attachments", + "tableTo": "vendor_investigations", + "columnsFrom": [ + "investigation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_investigations": { + "name": "vendor_investigations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_investigations_vendor_id_vendors_id_fk": { + "name": "vendor_investigations_vendor_id_vendors_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk": { + "name": "vendor_investigations_pq_submission_id_vendor_pq_submissions_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "vendor_pq_submissions", + "columnsFrom": [ + "pq_submission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "vendor_investigations_requester_id_users_id_fk": { + "name": "vendor_investigations_requester_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_investigations_qm_manager_id_users_id_fk": { + "name": "vendor_investigations_qm_manager_id_users_id_fk", + "tableFrom": "vendor_investigations", + "tableTo": "users", + "columnsFrom": [ + "qm_manager_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_submissions": { + "name": "vendor_pq_submissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pq_number": { + "name": "pq_number", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_pq_submission": { + "name": "unique_pq_submission", + "columns": [ + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_pq_submissions_requester_id_users_id_fk": { + "name": "vendor_pq_submissions_requester_id_users_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "users", + "columnsFrom": [ + "requester_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_pq_submissions_vendor_id_vendors_id_fk": { + "name": "vendor_pq_submissions_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_submissions_project_id_projects_id_fk": { + "name": "vendor_pq_submissions_project_id_projects_id_fk", + "tableFrom": "vendor_pq_submissions", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_pq_submissions_pq_number_unique": { + "name": "vendor_pq_submissions_pq_number_unique", + "nullsNotDistinct": false, + "columns": [ + "pq_number" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_criteria_answers": { + "name": "vendor_pq_criteria_answers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "criteria_id": { + "name": "criteria_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "answer": { + "name": "answer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_criteria_answers_vendor_id_vendors_id_fk": { + "name": "vendor_pq_criteria_answers_vendor_id_vendors_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": { + "name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "pq_criterias", + "columnsFrom": [ + "criteria_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_pq_criteria_answers_project_id_projects_id_fk": { + "name": "vendor_pq_criteria_answers_project_id_projects_id_fk", + "tableFrom": "vendor_pq_criteria_answers", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_pq_review_logs": { + "name": "vendor_pq_review_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_pq_criteria_answer_id": { + "name": "vendor_pq_criteria_answer_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "reviewer_comment": { + "name": "reviewer_comment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { + "name": "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk", + "tableFrom": "vendor_pq_review_logs", + "tableTo": "vendor_pq_criteria_answers", + "columnsFrom": [ + "vendor_pq_criteria_answer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_project_pqs": { + "name": "vendor_project_pqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'REQUESTED'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rejected_at": { + "name": "rejected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reject_reason": { + "name": "reject_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_project_pqs_vendor_id_vendors_id_fk": { + "name": "vendor_project_pqs_vendor_id_vendors_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "vendor_project_pqs_project_id_projects_id_fk": { + "name": "vendor_project_pqs_project_id_projects_id_fk", + "tableFrom": "vendor_project_pqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bidding_projects": { + "name": "bidding_projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "proj_nm": { + "name": "proj_nm", + "type": "varchar(90)", + "primaryKey": false, + "notNull": false + }, + "sector": { + "name": "sector", + "type": "char(1)", + "primaryKey": false, + "notNull": false + }, + "proj_msrm": { + "name": "proj_msrm", + "type": "numeric(3, 0)", + "primaryKey": false, + "notNull": false + }, + "kunnr": { + "name": "kunnr", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "kunnr_nm": { + "name": "kunnr_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "cls_1": { + "name": "cls_1", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "cls1_nm": { + "name": "cls1_nm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "ptype": { + "name": "ptype", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "ptype_nm": { + "name": "ptype_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_cd": { + "name": "pmodel_cd", + "type": "char(10)", + "primaryKey": false, + "notNull": false + }, + "pmodel_nm": { + "name": "pmodel_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "pmodel_sz": { + "name": "pmodel_sz", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "pmodel_uom": { + "name": "pmodel_uom", + "type": "char(5)", + "primaryKey": false, + "notNull": false + }, + "txt04": { + "name": "txt04", + "type": "char(4)", + "primaryKey": false, + "notNull": false + }, + "txt30": { + "name": "txt30", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "estm_pm": { + "name": "estm_pm", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "bidding_projects_pspid_unique": { + "name": "bidding_projects_pspid_unique", + "nullsNotDistinct": false, + "columns": [ + "pspid" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_series": { + "name": "project_series", + "schema": "", + "columns": { + "pspid": { + "name": "pspid", + "type": "char(24)", + "primaryKey": false, + "notNull": true + }, + "sers_no": { + "name": "sers_no", + "type": "char(3)", + "primaryKey": false, + "notNull": true + }, + "sc_dt": { + "name": "sc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "kl_dt": { + "name": "kl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "lc_dt": { + "name": "lc_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dl_dt": { + "name": "dl_dt", + "type": "char(8)", + "primaryKey": false, + "notNull": false + }, + "dock_no": { + "name": "dock_no", + "type": "char(3)", + "primaryKey": false, + "notNull": false + }, + "dock_nm": { + "name": "dock_nm", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + }, + "proj_no": { + "name": "proj_no", + "type": "char(24)", + "primaryKey": false, + "notNull": false + }, + "post1": { + "name": "post1", + "type": "varchar(40)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "project_sersNo_unique": { + "name": "project_sersNo_unique", + "columns": [ + { + "expression": "pspid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sers_no", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "project_series_pspid_bidding_projects_pspid_fk": { + "name": "project_series_pspid_bidding_projects_pspid_fk", + "tableFrom": "project_series", + "tableTo": "bidding_projects", + "columnsFrom": [ + "pspid" + ], + "columnsTo": [ + "pspid" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projects": { + "name": "projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cbe_evaluations": { + "name": "cbe_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluated_by": { + "name": "evaluated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluated_at": { + "name": "evaluated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "result": { + "name": "result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "total_cost": { + "name": "total_cost", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_schedule": { + "name": "delivery_schedule", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "cbe_evaluations_rfq_id_rfqs_id_fk": { + "name": "cbe_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_vendor_id_vendors_id_fk": { + "name": "cbe_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cbe_evaluations_evaluated_by_users_id_fk": { + "name": "cbe_evaluations_evaluated_by_users_id_fk", + "tableFrom": "cbe_evaluations", + "tableTo": "users", + "columnsFrom": [ + "evaluated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_attachments": { + "name": "rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_attachments_rfq_id_rfqs_id_fk": { + "name": "rfq_attachments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_vendor_id_vendors_id_fk": { + "name": "rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_attachments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_cbe_id_cbe_evaluations_id_fk": { + "name": "rfq_attachments_cbe_id_cbe_evaluations_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "cbe_evaluations", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_attachments_comment_id_rfq_comments_id_fk": { + "name": "rfq_attachments_comment_id_rfq_comments_id_fk", + "tableFrom": "rfq_attachments", + "tableTo": "rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_comments": { + "name": "rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "comment_text": { + "name": "comment_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "commented_by": { + "name": "commented_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_comments_rfq_id_rfqs_id_fk": { + "name": "rfq_comments_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_vendor_id_vendors_id_fk": { + "name": "rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_commented_by_users_id_fk": { + "name": "rfq_comments_commented_by_users_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "commented_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_evaluation_id_rfq_evaluations_id_fk": { + "name": "rfq_comments_evaluation_id_rfq_evaluations_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "rfq_evaluations", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_comments_cbe_id_vendor_responses_id_fk": { + "name": "rfq_comments_cbe_id_vendor_responses_id_fk", + "tableFrom": "rfq_comments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "cbe_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_evaluations": { + "name": "rfq_evaluations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "eval_type": { + "name": "eval_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "result": { + "name": "result", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_evaluations_rfq_id_rfqs_id_fk": { + "name": "rfq_evaluations_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "rfq_evaluations_vendor_id_vendors_id_fk": { + "name": "rfq_evaluations_vendor_id_vendors_id_fk", + "tableFrom": "rfq_evaluations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfq_items": { + "name": "rfq_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfq_items_rfq_id_rfqs_id_fk": { + "name": "rfq_items_rfq_id_rfqs_id_fk", + "tableFrom": "rfq_items", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "rfq_items_item_code_items_item_code_fk": { + "name": "rfq_items_item_code_items_item_code_fk", + "tableFrom": "rfq_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rfqs": { + "name": "rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "bid_project_id": { + "name": "bid_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false, + "default": "'PURCHASE'" + }, + "parent_rfq_id": { + "name": "parent_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "rfqs_project_id_projects_id_fk": { + "name": "rfqs_project_id_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_bid_project_id_bidding_projects_id_fk": { + "name": "rfqs_bid_project_id_bidding_projects_id_fk", + "tableFrom": "rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bid_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_created_by_users_id_fk": { + "name": "rfqs_created_by_users_id_fk", + "tableFrom": "rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "rfqs_parent_rfq_id_rfqs_id_fk": { + "name": "rfqs_parent_rfq_id_rfqs_id_fk", + "tableFrom": "rfqs", + "tableTo": "rfqs", + "columnsFrom": [ + "parent_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "rfqs_rfq_code_unique": { + "name": "rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_commercial_responses": { + "name": "vendor_commercial_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "total_price": { + "name": "total_price", + "type": "numeric(18, 2)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms": { + "name": "payment_terms", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "incoterms": { + "name": "incoterms", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "delivery_period": { + "name": "delivery_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "warranty_period": { + "name": "warranty_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "validity_period": { + "name": "validity_period", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "price_breakdown": { + "name": "price_breakdown", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "commercial_notes": { + "name": "commercial_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_commercial_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_commercial_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_commercial_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_attachments": { + "name": "vendor_response_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "technical_response_id": { + "name": "technical_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "commercial_response_id": { + "name": "commercial_response_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_attachments_response_id_vendor_responses_id_fk": { + "name": "vendor_response_attachments_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk": { + "name": "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_technical_responses", + "columnsFrom": [ + "technical_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk": { + "name": "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk", + "tableFrom": "vendor_response_attachments", + "tableTo": "vendor_commercial_responses", + "columnsFrom": [ + "commercial_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_responses": { + "name": "vendor_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'REVIEWING'" + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "responded_by": { + "name": "responded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "responded_at": { + "name": "responded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "vendor_response_unique": { + "name": "vendor_response_unique", + "columns": [ + { + "expression": "rfq_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_responses_rfq_id_rfqs_id_fk": { + "name": "vendor_responses_rfq_id_rfqs_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_responses_vendor_id_vendors_id_fk": { + "name": "vendor_responses_vendor_id_vendors_id_fk", + "tableFrom": "vendor_responses", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_technical_responses": { + "name": "vendor_technical_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "response_id": { + "name": "response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_technical_responses_response_id_vendor_responses_id_fk": { + "name": "vendor_technical_responses_response_id_vendor_responses_id_fk", + "tableFrom": "vendor_technical_responses", + "tableTo": "vendor_responses", + "columnsFrom": [ + "response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.otps": { + "name": "otps", + "schema": "", + "columns": { + "email": { + "name": "email", + "type": "varchar(256)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(6)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "otpToken": { + "name": "otpToken", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "otp_expires": { + "name": "otp_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permissions": { + "name": "permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "permissions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "permission_key": { + "name": "permission_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.role_permissions": { + "name": "role_permissions", + "schema": "", + "columns": { + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "permission_id": { + "name": "permission_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "role_permissions_role_id_roles_id_fk": { + "name": "role_permissions_role_id_roles_id_fk", + "tableFrom": "role_permissions", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "role_permissions_permission_id_permissions_id_fk": { + "name": "role_permissions_permission_id_permissions_id_fk", + "tableFrom": "role_permissions", + "tableTo": "permissions", + "columnsFrom": [ + "permission_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.roles": { + "name": "roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "roles_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "roles_company_id_vendors_id_fk": { + "name": "roles_company_id_vendors_id_fk", + "tableFrom": "roles", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_roles": { + "name": "user_roles", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_roles_user_id_users_id_fk": { + "name": "user_roles_user_id_users_id_fk", + "tableFrom": "user_roles", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_roles_role_id_roles_id_fk": { + "name": "user_roles_role_id_roles_id_fk", + "tableFrom": "user_roles", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "users_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "domain": { + "name": "domain", + "type": "user_domain", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'partners'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "image_url": { + "name": "image_url", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "language": { + "name": "language", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'en'" + } + }, + "indexes": {}, + "foreignKeys": { + "users_company_id_vendors_id_fk": { + "name": "users_company_id_vendors_id_fk", + "tableFrom": "users", + "tableTo": "vendors", + "columnsFrom": [ + "company_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_entries": { + "name": "form_entries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_entries_contract_item_id_contract_items_id_fk": { + "name": "form_entries_contract_item_id_contract_items_id_fk", + "tableFrom": "form_entries", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.form_metas": { + "name": "form_metas", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "columns": { + "name": "columns", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "form_metas_project_id_projects_id_fk": { + "name": "form_metas_project_id_projects_id_fk", + "tableFrom": "form_metas", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "form_code_project_unique": { + "name": "form_code_project_unique", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.forms": { + "name": "forms", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "forms_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "eng": { + "name": "eng", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "im": { + "name": "im", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "contract_item_form_code_unique": { + "name": "contract_item_form_code_unique", + "columns": [ + { + "expression": "contract_item_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "form_code", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "forms_contract_item_id_contract_items_id_fk": { + "name": "forms_contract_item_id_contract_items_id_fk", + "tableFrom": "forms", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_class_attributes": { + "name": "tag_class_attributes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_class_attributes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "tag_class_id": { + "name": "tag_class_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "att_id": { + "name": "att_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "def_val": { + "name": "def_val", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uom_id": { + "name": "uom_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "seq": { + "name": "seq", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "tag_class_attributes_seq_idx": { + "name": "tag_class_attributes_seq_idx", + "columns": [ + { + "expression": "seq", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "tag_class_attributes_tag_class_id_tag_classes_id_fk": { + "name": "tag_class_attributes_tag_class_id_tag_classes_id_fk", + "tableFrom": "tag_class_attributes", + "tableTo": "tag_classes", + "columnsFrom": [ + "tag_class_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_att_id_in_tag_class": { + "name": "uniq_att_id_in_tag_class", + "nullsNotDistinct": false, + "columns": [ + "tag_class_id", + "att_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_classes": { + "name": "tag_classes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tag_classes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_classes_project_id_projects_id_fk": { + "name": "tag_classes_project_id_projects_id_fk", + "tableFrom": "tag_classes", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk": { + "name": "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk", + "tableFrom": "tag_classes", + "tableTo": "tag_types", + "columnsFrom": [ + "tag_type_code", + "project_id" + ], + "columnsTo": [ + "code", + "project_id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_code_in_project": { + "name": "uniq_code_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfield_options": { + "name": "tag_subfield_options", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfield_options_project_id_projects_id_fk": { + "name": "tag_subfield_options_project_id_projects_id_fk", + "tableFrom": "tag_subfield_options", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_attribute_project_code": { + "name": "uniq_attribute_project_code", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "attributes_id", + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_subfields": { + "name": "tag_subfields", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_subfields_project_id_projects_id_fk": { + "name": "tag_subfields_project_id_projects_id_fk", + "tableFrom": "tag_subfields", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_tag_type_attribute": { + "name": "uniq_tag_type_attribute", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_code", + "attributes_id" + ] + }, + "uniq_attribute_id_project": { + "name": "uniq_attribute_id_project", + "nullsNotDistinct": false, + "columns": [ + "attributes_id", + "project_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_type_class_form_mappings": { + "name": "tag_type_class_form_mappings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag_type_label": { + "name": "tag_type_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "class_label": { + "name": "class_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "form_code": { + "name": "form_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "form_name": { + "name": "form_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "ep": { + "name": "ep", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uniq_mapping_in_project": { + "name": "uniq_mapping_in_project", + "nullsNotDistinct": false, + "columns": [ + "project_id", + "tag_type_label", + "class_label", + "form_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tag_types": { + "name": "tag_types", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tag_types_project_id_projects_id_fk": { + "name": "tag_types_project_id_projects_id_fk", + "tableFrom": "tag_types", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "tag_types_code_project_id_pk": { + "name": "tag_types_code_project_id_pk", + "columns": [ + "code", + "project_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tags": { + "name": "tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "tags_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "tag_type": { + "name": "tag_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "class": { + "name": "class", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tags_contract_item_id_contract_items_id_fk": { + "name": "tags_contract_item_id_contract_items_id_fk", + "tableFrom": "tags", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_form_id_forms_id_fk": { + "name": "tags_form_id_forms_id_fk", + "tableFrom": "tags", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "contract_item_tag_no_unique": { + "name": "contract_item_tag_no_unique", + "nullsNotDistinct": false, + "columns": [ + "contract_item_id", + "tag_no" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_data_report_temps": { + "name": "vendor_data_report_temps", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_item_id": { + "name": "contract_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "form_id": { + "name": "form_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_data_report_temps_contract_item_id_contract_items_id_fk": { + "name": "vendor_data_report_temps_contract_item_id_contract_items_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "contract_items", + "columnsFrom": [ + "contract_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_data_report_temps_form_id_forms_id_fk": { + "name": "vendor_data_report_temps_form_id_forms_id_fk", + "tableFrom": "vendor_data_report_temps", + "tableTo": "forms", + "columnsFrom": [ + "form_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.change_logs": { + "name": "change_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "changed_fields": { + "name": "changed_fields", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "old_values": { + "name": "old_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "new_values": { + "name": "new_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_name": { + "name": "user_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_synced": { + "name": "is_synced", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "sync_attempts": { + "name": "sync_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_sync_error": { + "name": "last_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "synced_at": { + "name": "synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "target_systems": { + "name": "target_systems", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + } + }, + "indexes": { + "idx_change_logs_contract_synced": { + "name": "idx_change_logs_contract_synced", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_synced", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_created_at": { + "name": "idx_change_logs_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_entity": { + "name": "idx_change_logs_entity", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_change_logs_sync_attempts": { + "name": "idx_change_logs_sync_attempts", + "columns": [ + { + "expression": "sync_attempts", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.document_attachments": { + "name": "document_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "document_attachments_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "revision_id": { + "name": "revision_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "upload_id": { + "name": "upload_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "file_id": { + "name": "file_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "dolce_file_path": { + "name": "dolce_file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "document_attachments_revision_id_revisions_id_fk": { + "name": "document_attachments_revision_id_revisions_id_fk", + "tableFrom": "document_attachments", + "tableTo": "revisions", + "columnsFrom": [ + "revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.documents": { + "name": "documents", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "documents_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "drawing_move_gbn": { + "name": "drawing_move_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "discipline": { + "name": "discipline", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "external_document_id": { + "name": "external_document_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "external_system_type": { + "name": "external_system_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "external_synced_at": { + "name": "external_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "shi_drawing_no": { + "name": "shi_drawing_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager": { + "name": "manager", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_enm": { + "name": "manager_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "manager_no": { + "name": "manager_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "register_group": { + "name": "register_group", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "register_group_id": { + "name": "register_group_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "create_user_no": { + "name": "create_user_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "create_user_id": { + "name": "create_user_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "create_user_enm": { + "name": "create_user_enm", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_contract_doc_status": { + "name": "unique_contract_doc_status", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_contract_vendor_doc": { + "name": "unique_contract_vendor_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_doc_number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"vendor_doc_number\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_external_doc": { + "name": "unique_external_doc", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_system_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"documents\".\"external_document_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "drawing_kind_idx": { + "name": "drawing_kind_idx", + "columns": [ + { + "expression": "drawing_kind", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "documents_contract_id_contracts_id_fk": { + "name": "documents_contract_id_contracts_id_fk", + "tableFrom": "documents", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.issue_stages": { + "name": "issue_stages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "issue_stages_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_name": { + "name": "stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "plan_date": { + "name": "plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "actual_date": { + "name": "actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "stage_status": { + "name": "stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "stage_order": { + "name": "stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "priority": { + "name": "priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'MEDIUM'" + }, + "assignee_id": { + "name": "assignee_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "assignee_name": { + "name": "assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "reminder_days": { + "name": "reminder_days", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_document_stage": { + "name": "unique_document_stage", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_stage_order": { + "name": "document_stage_order", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stage_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "issue_stages_document_id_documents_id_fk": { + "name": "issue_stages_document_id_documents_id_fk", + "tableFrom": "issue_stages", + "tableTo": "documents", + "columnsFrom": [ + "document_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.revisions": { + "name": "revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "revisions_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "issue_stage_id": { + "name": "issue_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "revision": { + "name": "revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "uploader_type": { + "name": "uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'vendor'" + }, + "uploader_id": { + "name": "uploader_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploader_name": { + "name": "uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "usage": { + "name": "usage", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "revision_status": { + "name": "revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'SUBMITTED'" + }, + "submitted_date": { + "name": "submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "review_start_date": { + "name": "review_start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "approved_date": { + "name": "approved_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "rejected_date": { + "name": "rejected_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "reviewer_id": { + "name": "reviewer_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "reviewer_name": { + "name": "reviewer_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "review_comments": { + "name": "review_comments", + "type": "varchar(1000)", + "primaryKey": false, + "notNull": false + }, + "external_upload_id": { + "name": "external_upload_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_stage_rev": { + "name": "unique_stage_rev", + "columns": [ + { + "expression": "issue_stage_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "revision", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_batches": { + "name": "sync_batches", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "batch_size": { + "name": "batch_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "retry_count": { + "name": "retry_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "change_log_ids": { + "name": "change_log_ids", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "success_count": { + "name": "success_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "failure_count": { + "name": "failure_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sync_metadata": { + "name": "sync_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_batches_contract_system": { + "name": "idx_sync_batches_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_status": { + "name": "idx_sync_batches_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_sync_batches_created_at": { + "name": "idx_sync_batches_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sync_configs": { + "name": "sync_configs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "sync_interval_minutes": { + "name": "sync_interval_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 30 + }, + "last_successful_sync": { + "name": "last_successful_sync", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_sync_attempt": { + "name": "last_sync_attempt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "endpoint_url": { + "name": "endpoint_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "auth_token": { + "name": "auth_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "api_version": { + "name": "api_version", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "default": "'v1'" + }, + "max_batch_size": { + "name": "max_batch_size", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 100 + }, + "retry_max_attempts": { + "name": "retry_max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_sync_configs_contract_system": { + "name": "idx_sync_configs_contract_system", + "columns": [ + { + "expression": "contract_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_system", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sync_configs_contract_id_contracts_id_fk": { + "name": "sync_configs_contract_id_contracts_id_fk", + "tableFrom": "sync_configs", + "tableTo": "contracts", + "columnsFrom": [ + "contract_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_attachments": { + "name": "vendor_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'GENERAL'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_attachments_vendor_id_vendors_id_fk": { + "name": "vendor_attachments_vendor_id_vendors_id_fk", + "tableFrom": "vendor_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidates": { + "name": "vendor_candidates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidates_vendor_id_vendors_id_fk": { + "name": "vendor_candidates_vendor_id_vendors_id_fk", + "tableFrom": "vendor_candidates", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_contacts": { + "name": "vendor_contacts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "contact_name": { + "name": "contact_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_position": { + "name": "contact_position", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "is_primary": { + "name": "is_primary", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_contacts_vendor_id_vendors_id_fk": { + "name": "vendor_contacts_vendor_id_vendors_id_fk", + "tableFrom": "vendor_contacts", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_items": { + "name": "vendor_possible_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_items_vendor_id_vendors_id_fk": { + "name": "vendor_possible_items_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_items_item_code_items_item_code_fk": { + "name": "vendor_possible_items_item_code_items_item_code_fk", + "tableFrom": "vendor_possible_items", + "tableTo": "items", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_possible_materials": { + "name": "vendor_possible_materials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_possible_materials_vendor_id_vendors_id_fk": { + "name": "vendor_possible_materials_vendor_id_vendors_id_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendor_possible_materials_item_code_materials_item_code_fk": { + "name": "vendor_possible_materials_item_code_materials_item_code_fk", + "tableFrom": "vendor_possible_materials", + "tableTo": "materials", + "columnsFrom": [ + "item_code" + ], + "columnsTo": [ + "item_code" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_types": { + "name": "vendor_types", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "vendor_types_code_unique": { + "name": "vendor_types_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors": { + "name": "vendors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "vendor_type_id": { + "name": "vendor_type_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_vendor_type_id_vendor_types_id_fk": { + "name": "vendors_vendor_type_id_vendor_types_id_fk", + "tableFrom": "vendors", + "tableTo": "vendor_types", + "columnsFrom": [ + "vendor_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tasks": { + "name": "tasks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'todo'" + }, + "label": { + "name": "label", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'bug'" + }, + "priority": { + "name": "priority", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'low'" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "current_timestamp" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tasks_code_unique": { + "name": "tasks_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_candidate_logs": { + "name": "vendor_candidate_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_candidate_id": { + "name": "vendor_candidate_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk": { + "name": "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "vendor_candidates", + "columnsFrom": [ + "vendor_candidate_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_candidate_logs_user_id_users_id_fk": { + "name": "vendor_candidate_logs_user_id_users_id_fk", + "tableFrom": "vendor_candidate_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors_logs": { + "name": "vendors_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "old_status": { + "name": "old_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_logs_vendor_id_vendors_id_fk": { + "name": "vendors_logs_vendor_id_vendors_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendors_logs_user_id_users_id_fk": { + "name": "vendors_logs_user_id_users_id_fk", + "tableFrom": "vendors_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract": { + "name": "basic_contract", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_id": { + "name": "template_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requested_by": { + "name": "requested_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'PENDING'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "basic_contract_template_id_basic_contract_templates_id_fk": { + "name": "basic_contract_template_id_basic_contract_templates_id_fk", + "tableFrom": "basic_contract", + "tableTo": "basic_contract_templates", + "columnsFrom": [ + "template_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_vendor_id_vendors_id_fk": { + "name": "basic_contract_vendor_id_vendors_id_fk", + "tableFrom": "basic_contract", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "basic_contract_requested_by_users_id_fk": { + "name": "basic_contract_requested_by_users_id_fk", + "tableFrom": "basic_contract", + "tableTo": "users", + "columnsFrom": [ + "requested_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.basic_contract_templates": { + "name": "basic_contract_templates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "basic_contract_templates_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "template_name": { + "name": "template_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "validity_period": { + "name": "validity_period", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.incoterms": { + "name": "incoterms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(20)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "incoterms_created_by_users_id_fk": { + "name": "incoterms_created_by_users_id_fk", + "tableFrom": "incoterms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payment_terms": { + "name": "payment_terms", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "payment_terms_created_by_users_id_fk": { + "name": "payment_terms_created_by_users_id_fk", + "tableFrom": "payment_terms", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pr_items": { + "name": "pr_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "pr_items", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_attachments": { + "name": "procurement_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "procurement_rfq_details_id": { + "name": "procurement_rfq_details_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk": { + "name": "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "procurement_rfq_details", + "columnsFrom": [ + "procurement_rfq_details_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_attachments_created_by_users_id_fk": { + "name": "procurement_attachments_created_by_users_id_fk", + "tableFrom": "procurement_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "attachment_type_check": { + "name": "attachment_type_check", + "value": "\"procurement_attachments\".\"procurement_rfqs_id\" IS NOT NULL OR \"procurement_attachments\".\"procurement_rfq_details_id\" IS NOT NULL" + } + }, + "isRLSEnabled": false + }, + "public.procurement_quotation_items": { + "name": "procurement_quotation_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pr_item_id": { + "name": "pr_item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "material_code": { + "name": "material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "uom": { + "name": "uom", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "unit_price": { + "name": "unit_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "vendor_material_code": { + "name": "vendor_material_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_material_description": { + "name": "vendor_material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "lead_time_in_days": { + "name": "lead_time_in_days", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tax_rate": { + "name": "tax_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "tax_amount": { + "name": "tax_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_rate": { + "name": "discount_rate", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "discount_amount": { + "name": "discount_amount", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_alternative": { + "name": "is_alternative", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_recommended": { + "name": "is_recommended", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_quotation_items_pr_item_id_pr_items_id_fk": { + "name": "procurement_quotation_items_pr_item_id_pr_items_id_fk", + "tableFrom": "procurement_quotation_items", + "tableTo": "pr_items", + "columnsFrom": [ + "pr_item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_attachments": { + "name": "procurement_rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk": { + "name": "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "procurement_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_uploaded_by_users_id_fk": { + "name": "procurement_rfq_attachments_uploaded_by_users_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_attachments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_attachments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_comments": { + "name": "procurement_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_rfq_comments_vendor_id_vendors_id_fk": { + "name": "procurement_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_user_id_users_id_fk": { + "name": "procurement_rfq_comments_user_id_users_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk": { + "name": "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk", + "tableFrom": "procurement_rfq_comments", + "tableTo": "procurement_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfq_details": { + "name": "procurement_rfq_details", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendors_id": { + "name": "vendors_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'VV'" + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk": { + "name": "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "procurement_rfqs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_vendors_id_vendors_id_fk": { + "name": "procurement_rfq_details_vendors_id_vendors_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "vendors", + "columnsFrom": [ + "vendors_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_rfq_details_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_incoterms_code_incoterms_code_fk": { + "name": "procurement_rfq_details_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfq_details_updated_by_users_id_fk": { + "name": "procurement_rfq_details_updated_by_users_id_fk", + "tableFrom": "procurement_rfq_details", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_rfqs": { + "name": "procurement_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "series": { + "name": "series", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "rfq_sealed_yn": { + "name": "rfq_sealed_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_rfqs_project_id_projects_id_fk": { + "name": "procurement_rfqs_project_id_projects_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_sent_by_users_id_fk": { + "name": "procurement_rfqs_sent_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_created_by_users_id_fk": { + "name": "procurement_rfqs_created_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_rfqs_updated_by_users_id_fk": { + "name": "procurement_rfqs_updated_by_users_id_fk", + "tableFrom": "procurement_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "procurement_rfqs_rfq_code_unique": { + "name": "procurement_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.procurement_vendor_quotations": { + "name": "procurement_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_items_count": { + "name": "total_items_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "sub_total": { + "name": "sub_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "tax_total": { + "name": "tax_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "discount_total": { + "name": "discount_total", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'USD'" + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "estimated_delivery_date": { + "name": "estimated_delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_detail": { + "name": "incoterms_detail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk": { + "name": "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "procurement_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "procurement_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk": { + "name": "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "procurement_vendor_quotations_incoterms_code_incoterms_code_fk": { + "name": "procurement_vendor_quotations_incoterms_code_incoterms_code_fk", + "tableFrom": "procurement_vendor_quotations", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.preset_shares": { + "name": "preset_shares", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "preset_id": { + "name": "preset_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "shared_with_user_id": { + "name": "shared_with_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'read'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "preset_shares_preset_id_table_presets_id_fk": { + "name": "preset_shares_preset_id_table_presets_id_fk", + "tableFrom": "preset_shares", + "tableTo": "table_presets", + "columnsFrom": [ + "preset_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_presets": { + "name": "table_presets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_shared": { + "name": "is_shared", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_attachments": { + "name": "tech_sales_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "tech_sales_rfq_id": { + "name": "tech_sales_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_attachments_tech_sales_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "tech_sales_rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_attachments_created_by_users_id_fk": { + "name": "tech_sales_attachments_created_by_users_id_fk", + "tableFrom": "tech_sales_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comment_attachments": { + "name": "tech_sales_rfq_comment_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment_id": { + "name": "comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "quotation_id": { + "name": "quotation_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "file_path": { + "name": "file_path", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true + }, + "is_vendor_upload": { + "name": "is_vendor_upload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comment_attachments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comment_attachments_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk": { + "name": "tech_sales_rfq_comment_attachments_quotation_id_tech_sales_vendor_quotations_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "tech_sales_vendor_quotations", + "columnsFrom": [ + "quotation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk": { + "name": "tech_sales_rfq_comment_attachments_uploaded_by_users_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comment_attachments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comment_attachments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfq_comments": { + "name": "tech_sales_rfq_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_vendor_comment": { + "name": "is_vendor_comment", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_rfq_comments_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_vendor_id_vendors_id_fk": { + "name": "tech_sales_rfq_comments_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_user_id_users_id_fk": { + "name": "tech_sales_rfq_comments_user_id_users_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk": { + "name": "tech_sales_rfq_comments_parent_comment_id_tech_sales_rfq_comments_id_fk", + "tableFrom": "tech_sales_rfq_comments", + "tableTo": "tech_sales_rfq_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_rfqs": { + "name": "tech_sales_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_shipbuilding_id": { + "name": "item_shipbuilding_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "bidding_project_id": { + "name": "bidding_project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "rfq_send_date": { + "name": "rfq_send_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'RFQ Created'" + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sent_by": { + "name": "sent_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "cancel_reason": { + "name": "cancel_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_snapshot": { + "name": "project_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "series_snapshot": { + "name": "series_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk": { + "name": "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "item_shipbuilding", + "columnsFrom": [ + "item_shipbuilding_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk": { + "name": "tech_sales_rfqs_bidding_project_id_bidding_projects_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "bidding_projects", + "columnsFrom": [ + "bidding_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_sent_by_users_id_fk": { + "name": "tech_sales_rfqs_sent_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "sent_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_created_by_users_id_fk": { + "name": "tech_sales_rfqs_created_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tech_sales_rfqs_updated_by_users_id_fk": { + "name": "tech_sales_rfqs_updated_by_users_id_fk", + "tableFrom": "tech_sales_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tech_sales_rfqs_rfq_code_unique": { + "name": "tech_sales_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tech_sales_vendor_quotations": { + "name": "tech_sales_vendor_quotations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quotation_code": { + "name": "quotation_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "quotation_version": { + "name": "quotation_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'Draft'" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk": { + "name": "tech_sales_vendor_quotations_rfq_id_tech_sales_rfqs_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "tech_sales_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tech_sales_vendor_quotations_vendor_id_vendors_id_fk": { + "name": "tech_sales_vendor_quotations_vendor_id_vendors_id_fk", + "tableFrom": "tech_sales_vendor_quotations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rotation_attempts": { + "name": "ocr_rotation_attempts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "rotation": { + "name": "rotation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "tables_found": { + "name": "tables_found", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "text_quality": { + "name": "text_quality", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "keyword_count": { + "name": "keyword_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "score": { + "name": "score", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "extracted_rows_count": { + "name": "extracted_rows_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_rotation_attempts_session_id_ocr_sessions_id_fk": { + "name": "ocr_rotation_attempts_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rotation_attempts", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_rows": { + "name": "ocr_rows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "table_id": { + "name": "table_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "row_index": { + "name": "row_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "report_no": { + "name": "report_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "no": { + "name": "no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "identification_no": { + "name": "identification_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tag_no": { + "name": "tag_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_no": { + "name": "joint_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "joint_type": { + "name": "joint_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "welding_date": { + "name": "welding_date", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "confidence": { + "name": "confidence", + "type": "numeric(5, 4)", + "primaryKey": false, + "notNull": false + }, + "source_table": { + "name": "source_table", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "source_row": { + "name": "source_row", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_ocr_report_no_unique": { + "name": "idx_ocr_report_no_unique", + "columns": [ + { + "expression": "report_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "tag_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "joint_no", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "joint_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "ocr_rows_table_id_ocr_tables_id_fk": { + "name": "ocr_rows_table_id_ocr_tables_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_tables", + "columnsFrom": [ + "table_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_session_id_ocr_sessions_id_fk": { + "name": "ocr_rows_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ocr_rows_user_id_users_id_fk": { + "name": "ocr_rows_user_id_users_id_fk", + "tableFrom": "ocr_rows", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_sessions": { + "name": "ocr_sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_type": { + "name": "file_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "processing_time": { + "name": "processing_time", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "best_rotation": { + "name": "best_rotation", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_tables": { + "name": "total_tables", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_rows": { + "name": "total_rows", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "image_enhanced": { + "name": "image_enhanced", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pdf_converted": { + "name": "pdf_converted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "success": { + "name": "success", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "warnings": { + "name": "warnings", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ocr_tables": { + "name": "ocr_tables", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "table_index": { + "name": "table_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "row_count": { + "name": "row_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ocr_tables_session_id_ocr_sessions_id_fk": { + "name": "ocr_tables_session_id_ocr_sessions_id_fk", + "tableFrom": "ocr_tables", + "tableTo": "ocr_sessions", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.b_rfq_attachment_revisions": { + "name": "b_rfq_attachment_revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_id": { + "name": "attachment_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "revision_no": { + "name": "revision_no", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "is_latest": { + "name": "is_latest", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "revision_comment": { + "name": "revision_comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "latest_revision_idx": { + "name": "latest_revision_idx", + "columns": [ + { + "expression": "attachment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_latest", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "b_rfq_attachment_revisions_attachment_id_b_rfq_attachments_id_fk": { + "name": "b_rfq_attachment_revisions_attachment_id_b_rfq_attachments_id_fk", + "tableFrom": "b_rfq_attachment_revisions", + "tableTo": "b_rfq_attachments", + "columnsFrom": [ + "attachment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "b_rfq_attachment_revisions_created_by_users_id_fk": { + "name": "b_rfq_attachment_revisions_created_by_users_id_fk", + "tableFrom": "b_rfq_attachment_revisions", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.b_rfqs": { + "name": "b_rfqs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pic_name": { + "name": "pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "eng_pic_name": { + "name": "eng_pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_company": { + "name": "project_company", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_flag": { + "name": "project_flag", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_site": { + "name": "project_site", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "package_no": { + "name": "package_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "package_name": { + "name": "package_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_by": { + "name": "updated_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "b_rfqs_project_id_projects_id_fk": { + "name": "b_rfqs_project_id_projects_id_fk", + "tableFrom": "b_rfqs", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "b_rfqs_created_by_users_id_fk": { + "name": "b_rfqs_created_by_users_id_fk", + "tableFrom": "b_rfqs", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "b_rfqs_updated_by_users_id_fk": { + "name": "b_rfqs_updated_by_users_id_fk", + "tableFrom": "b_rfqs", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "b_rfqs_rfq_code_unique": { + "name": "b_rfqs_rfq_code_unique", + "nullsNotDistinct": false, + "columns": [ + "rfq_code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.b_rfq_attachments": { + "name": "b_rfq_attachments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_type": { + "name": "attachment_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "serial_no": { + "name": "serial_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "b_rfq_attachments_rfq_id_b_rfqs_id_fk": { + "name": "b_rfq_attachments_rfq_id_b_rfqs_id_fk", + "tableFrom": "b_rfq_attachments", + "tableTo": "b_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "b_rfq_attachments_created_by_users_id_fk": { + "name": "b_rfq_attachments_created_by_users_id_fk", + "tableFrom": "b_rfq_attachments", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.final_rfq": { + "name": "final_rfq", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "final_rfq_status": { + "name": "final_rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "valid_date": { + "name": "valid_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "gtc": { + "name": "gtc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "gtc_valid_date": { + "name": "gtc_valid_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sparepart": { + "name": "sparepart", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "short_list": { + "name": "short_list", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "return_yn": { + "name": "return_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "cp_request_yn": { + "name": "cp_request_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "prject_gtc_yn": { + "name": "prject_gtc_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "return_revision": { + "name": "return_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'VV'" + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "firsttime_yn": { + "name": "firsttime_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vendor_remark": { + "name": "vendor_remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "final_rfq_rfq_id_b_rfqs_id_fk": { + "name": "final_rfq_rfq_id_b_rfqs_id_fk", + "tableFrom": "final_rfq", + "tableTo": "b_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "final_rfq_vendor_id_vendors_id_fk": { + "name": "final_rfq_vendor_id_vendors_id_fk", + "tableFrom": "final_rfq", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "final_rfq_incoterms_code_incoterms_code_fk": { + "name": "final_rfq_incoterms_code_incoterms_code_fk", + "tableFrom": "final_rfq", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "final_rfq_payment_terms_code_payment_terms_code_fk": { + "name": "final_rfq_payment_terms_code_payment_terms_code_fk", + "tableFrom": "final_rfq", + "tableTo": "payment_terms", + "columnsFrom": [ + "payment_terms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.initial_rfq": { + "name": "initial_rfq", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "initial_rfq_status": { + "name": "initial_rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'DRAFT'" + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "valid_date": { + "name": "valid_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "gtc": { + "name": "gtc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "gtc_valid_date": { + "name": "gtc_valid_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sparepart": { + "name": "sparepart", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "short_list": { + "name": "short_list", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "return_yn": { + "name": "return_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "cp_request_yn": { + "name": "cp_request_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "prject_gtc_yn": { + "name": "prject_gtc_yn", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "return_revision": { + "name": "return_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "initial_rfq_rfq_id_b_rfqs_id_fk": { + "name": "initial_rfq_rfq_id_b_rfqs_id_fk", + "tableFrom": "initial_rfq", + "tableTo": "b_rfqs", + "columnsFrom": [ + "rfq_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "initial_rfq_vendor_id_vendors_id_fk": { + "name": "initial_rfq_vendor_id_vendors_id_fk", + "tableFrom": "initial_rfq", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "initial_rfq_incoterms_code_incoterms_code_fk": { + "name": "initial_rfq_incoterms_code_incoterms_code_fk", + "tableFrom": "initial_rfq", + "tableTo": "incoterms", + "columnsFrom": [ + "incoterms_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_attachment_responses": { + "name": "vendor_attachment_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "attachment_id": { + "name": "attachment_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "rfq_record_id": { + "name": "rfq_record_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "response_status": { + "name": "response_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'NOT_RESPONDED'" + }, + "current_revision": { + "name": "current_revision", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'Rev.0'" + }, + "responded_revision": { + "name": "responded_revision", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "response_comment": { + "name": "response_comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vendor_comment": { + "name": "vendor_comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "responded_at": { + "name": "responded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "vendor_response_idx": { + "name": "vendor_response_idx", + "columns": [ + { + "expression": "attachment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vendor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "rfq_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "vendor_attachment_responses_attachment_id_b_rfq_attachments_id_fk": { + "name": "vendor_attachment_responses_attachment_id_b_rfq_attachments_id_fk", + "tableFrom": "vendor_attachment_responses", + "tableTo": "b_rfq_attachments", + "columnsFrom": [ + "attachment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_attachment_responses_vendor_id_vendors_id_fk": { + "name": "vendor_attachment_responses_vendor_id_vendors_id_fk", + "tableFrom": "vendor_attachment_responses", + "tableTo": "vendors", + "columnsFrom": [ + "vendor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_attachments_b": { + "name": "vendor_response_attachments_b", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_response_id": { + "name": "vendor_response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_name": { + "name": "file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "original_file_name": { + "name": "original_file_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "file_type": { + "name": "file_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_attachments_b_vendor_response_id_vendor_attachment_responses_id_fk": { + "name": "vendor_response_attachments_b_vendor_response_id_vendor_attachment_responses_id_fk", + "tableFrom": "vendor_response_attachments_b", + "tableTo": "vendor_attachment_responses", + "columnsFrom": [ + "vendor_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_attachments_b_uploaded_by_users_id_fk": { + "name": "vendor_response_attachments_b_uploaded_by_users_id_fk", + "tableFrom": "vendor_response_attachments_b", + "tableTo": "users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendor_response_history": { + "name": "vendor_response_history", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_response_id": { + "name": "vendor_response_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "previous_status": { + "name": "previous_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "action_by": { + "name": "action_by", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "action_at": { + "name": "action_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "vendor_response_history_vendor_response_id_vendor_attachment_responses_id_fk": { + "name": "vendor_response_history_vendor_response_id_vendor_attachment_responses_id_fk", + "tableFrom": "vendor_response_history", + "tableTo": "vendor_attachment_responses", + "columnsFrom": [ + "vendor_response_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "vendor_response_history_action_by_users_id_fk": { + "name": "vendor_response_history_action_by_users_id_fk", + "tableFrom": "vendor_response_history", + "tableTo": "users", + "columnsFrom": [ + "action_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.offshore_hull_work_type": { + "name": "offshore_hull_work_type", + "schema": "public", + "values": [ + "HA", + "HE", + "HH", + "HM", + "NC" + ] + }, + "public.offshore_top_work_type": { + "name": "offshore_top_work_type", + "schema": "public", + "values": [ + "TM", + "TS", + "TE", + "TP" + ] + }, + "public.work_type": { + "name": "work_type", + "schema": "public", + "values": [ + "기장", + "전장", + "선실", + "배관", + "철의" + ] + }, + "public.user_domain": { + "name": "user_domain", + "schema": "public", + "values": [ + "evcp", + "partners" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": { + "public.contracts_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "contracts_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "contract_name": { + "name": "contract_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVE'" + }, + "start_date": { + "name": "start_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "payment_terms": { + "name": "payment_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false, + "default": "'KRW'" + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "partial_shipping_allowed": { + "name": "partial_shipping_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "partial_payment_allowed": { + "name": "partial_payment_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remarks": { + "name": "remarks", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"contracts\".\"id\", \"contracts\".\"contract_no\", \"contracts\".\"contract_name\", \"contracts\".\"status\", \"contracts\".\"start_date\", \"contracts\".\"end_date\", \"contracts\".\"project_id\", \"projects\".\"code\", \"projects\".\"name\", \"contracts\".\"vendor_id\", \"vendors\".\"vendor_name\", \"contracts\".\"payment_terms\", \"contracts\".\"delivery_terms\", \"contracts\".\"delivery_date\", \"contracts\".\"delivery_location\", \"contracts\".\"currency\", \"contracts\".\"total_amount\", \"contracts\".\"discount\", \"contracts\".\"tax\", \"contracts\".\"shipping_fee\", \"contracts\".\"net_total\", \"contracts\".\"partial_shipping_allowed\", \"contracts\".\"partial_payment_allowed\", \"contracts\".\"remarks\", \"contracts\".\"version\", \"contracts\".\"created_at\", \"contracts\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"contracts\".\"id\"\n ) as \"has_signature\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "contracts_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.poa_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "poa_detail_view_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "contract_no": { + "name": "contract_no", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "change_reason": { + "name": "change_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approval_status": { + "name": "approval_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "'PENDING'" + }, + "delivery_terms": { + "name": "delivery_terms", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_location": { + "name": "delivery_location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "total_amount": { + "name": "total_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "tax": { + "name": "tax", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "shipping_fee": { + "name": "shipping_fee", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "net_total": { + "name": "net_total", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", + "name": "poa_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.project_approved_vendors": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "name_ko": { + "name": "name_ko", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "name_en": { + "name": "name_en", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "default": "'ship'" + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"status\", \"vendor_types\".\"name_ko\", \"vendor_types\".\"name_en\", \"projects\".\"code\", \"projects\".\"name\", \"projects\".\"type\", \"vendor_pq_submissions\".\"submitted_at\", \"vendor_pq_submissions\".\"approved_at\" from \"vendors\" inner join \"vendor_pq_submissions\" on \"vendor_pq_submissions\".\"vendor_id\" = \"vendors\".\"id\" inner join \"projects\" on \"vendor_pq_submissions\".\"project_id\" = \"projects\".\"id\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\" where \"vendor_pq_submissions\".\"status\" = 'APPROVED'", + "name": "project_approved_vendors", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_investigations_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pq_submission_id": { + "name": "pq_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "requester_id": { + "name": "requester_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "qm_manager_id": { + "name": "qm_manager_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "investigation_status": { + "name": "investigation_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "'PLANNED'" + }, + "evaluation_type": { + "name": "evaluation_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_address": { + "name": "investigation_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "investigation_method": { + "name": "investigation_method", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "scheduled_start_at": { + "name": "scheduled_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scheduled_end_at": { + "name": "scheduled_end_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forecasted_at": { + "name": "forecasted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_score": { + "name": "evaluation_score", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "evaluation_result": { + "name": "evaluation_result", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "investigation_notes": { + "name": "investigation_notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"vendor_id\", \"vendor_investigations\".\"pq_submission_id\", \"vendor_investigations\".\"requester_id\", \"vendor_investigations\".\"qm_manager_id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"evaluation_type\", \"vendor_investigations\".\"investigation_address\", \"vendor_investigations\".\"investigation_method\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"forecasted_at\", \"vendor_investigations\".\"requested_at\", \"vendor_investigations\".\"confirmed_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"evaluation_score\", \"vendor_investigations\".\"evaluation_result\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", requester.name as \"requesterName\", requester.email as \"requesterEmail\", qm_manager.name as \"qmManagerName\", qm_manager.email as \"qmManagerEmail\", (\n CASE \n WHEN EXISTS (\n SELECT 1 FROM vendor_investigation_attachments via \n WHERE via.investigation_id = \"vendor_investigations\".\"id\"\n ) \n THEN true \n ELSE false \n END\n ) as \"hasAttachments\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\" left join users AS requester on \"vendor_investigations\".\"requester_id\" = requester.id left join users AS qm_manager on \"vendor_investigations\".\"qm_manager_id\" = qm_manager.id", + "name": "vendor_investigations_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.cbe_view": { + "columns": {}, + "definition": "select \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"rfq_id\" as \"rfq_id\", \"cbe_evaluations\".\"vendor_id\" as \"vendor_id\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"result\" as \"result\", \"cbe_evaluations\".\"notes\" as \"notes\", \"cbe_evaluations\".\"evaluated_by\" as \"evaluated_by\", \"cbe_evaluations\".\"evaluated_at\" as \"evaluated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"name\" as \"evaluator_name\", \"users\".\"email\" as \"evaluator_email\" from \"cbe_evaluations\" inner join \"rfqs\" on \"cbe_evaluations\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"cbe_evaluations\".\"evaluated_by\" = \"users\".\"id\"", + "name": "cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.rfqs_view": { + "columns": {}, + "definition": "select \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"rfqs\".\"parent_rfq_id\" as \"parent_rfq_id\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"email\" as \"user_email\", \"users\".\"name\" as \"user_name\", (\n SELECT COUNT(*) \n FROM \"rfq_items\" \n WHERE \"rfq_items\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"item_count\", (\n SELECT COUNT(*) \n FROM \"rfq_attachments\" \n WHERE \"rfq_attachments\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"attachment_count\" from \"rfqs\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"rfqs\".\"created_by\" = \"users\".\"id\"", + "name": "rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_cbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", \"cbe_evaluations\".\"notes\" as \"cbe_note\", \"cbe_evaluations\".\"updated_at\" as \"cbe_updated\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"delivery_schedule\" as \"delivery_schedule\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_response_cbe_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"notes\" as \"response_notes\", \"vendor_responses\".\"responded_by\" as \"responded_by\", \"vendor_responses\".\"responded_at\" as \"responded_at\", \"vendor_responses\".\"updated_at\" as \"response_updated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"status\" as \"vendor_status\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"response_status\" as \"commercial_response_status\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"vendor_commercial_responses\".\"payment_terms\" as \"payment_terms\", \"vendor_commercial_responses\".\"incoterms\" as \"incoterms\", \"vendor_commercial_responses\".\"delivery_period\" as \"delivery_period\", \"vendor_commercial_responses\".\"warranty_period\" as \"warranty_period\", \"vendor_commercial_responses\".\"validity_period\" as \"validity_period\", \"vendor_commercial_responses\".\"price_breakdown\" as \"price_breakdown\", \"vendor_commercial_responses\".\"commercial_notes\" as \"commercial_notes\", \"vendor_commercial_responses\".\"created_at\" as \"commercial_created_at\", \"vendor_commercial_responses\".\"updated_at\" as \"commercial_updated_at\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"commercial_response_id\" = \"vendor_commercial_responses\".\"id\"\n ) as \"commercial_attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n AND \"vendor_response_attachments\".\"attachment_type\" = 'TECHNICAL_SPEC'\n ) as \"technical_attachment_count\", (\n SELECT MAX(\"uploaded_at\") \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"latest_attachment_date\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\"", + "name": "vendor_response_cbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_responses_view": { + "columns": {}, + "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"created_at\" as \"rfq_created_at\", \"rfqs\".\"updated_at\" as \"rfq_updated_at\", \"rfqs\".\"created_by\" as \"rfq_created_by\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"responded_at\" as \"responded_at\", CASE WHEN \"vendor_technical_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_technical_response\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", CASE WHEN \"vendor_commercial_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_commercial_response\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"rfq_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE') left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"cbe_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\")", + "name": "vendor_responses_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_rfq_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", + "name": "vendor_rfq_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_tbe_view": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", \"vendor_technical_responses\".\"response_status\" as \"technical_response_status\", \"vendor_technical_responses\".\"summary\" as \"technical_summary\", \"vendor_technical_responses\".\"notes\" as \"technical_notes\", \"vendor_technical_responses\".\"updated_at\" as \"technical_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"rfq_evaluations\".\"notes\" as \"tbe_note\", \"rfq_evaluations\".\"updated_at\" as \"tbe_updated\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")", + "name": "vendor_tbe_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.role_view": { + "columns": {}, + "definition": "select \"roles\".\"id\" as \"id\", \"roles\".\"name\" as \"name\", \"roles\".\"description\" as \"description\", \"roles\".\"domain\" as \"domain\", \"roles\".\"created_at\" as \"created_at\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", COUNT(\"users\".\"id\") as \"user_count\" from \"roles\" left join \"user_roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" left join \"users\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"vendors\" on \"roles\".\"company_id\" = \"vendors\".\"id\" group by \"roles\".\"id\", \"vendors\".\"id\"", + "name": "role_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.user_view": { + "columns": {}, + "definition": "select \"users\".\"id\" as \"user_id\", \"users\".\"name\" as \"user_name\", \"users\".\"email\" as \"user_email\", \"users\".\"domain\" as \"user_domain\", \"users\".\"image_url\" as \"user_image\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"vendors\" on \"users\".\"company_id\" = \"vendors\".\"id\" left join \"user_roles\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" group by \"users\".\"id\", \"vendors\".\"id\"", + "name": "user_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.form_lists_view": { + "columns": {}, + "definition": "select \"tag_type_class_form_mappings\".\"id\" as \"id\", \"tag_type_class_form_mappings\".\"project_id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"tag_type_class_form_mappings\".\"tag_type_label\" as \"tag_type_label\", \"tag_type_class_form_mappings\".\"class_label\" as \"class_label\", \"tag_type_class_form_mappings\".\"form_code\" as \"form_code\", \"tag_type_class_form_mappings\".\"form_name\" as \"form_name\", \"tag_type_class_form_mappings\".\"ep\" as \"ep\", \"tag_type_class_form_mappings\".\"remark\" as \"remark\", \"tag_type_class_form_mappings\".\"created_at\" as \"created_at\", \"tag_type_class_form_mappings\".\"updated_at\" as \"updated_at\" from \"tag_type_class_form_mappings\" inner join \"projects\" on \"tag_type_class_form_mappings\".\"project_id\" = \"projects\".\"id\"", + "name": "form_lists_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.view_tag_subfields": { + "columns": { + "tag_type_code": { + "name": "tag_type_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "attributes_id": { + "name": "attributes_id", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "attributes_description": { + "name": "attributes_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expression": { + "name": "expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "delimiter": { + "name": "delimiter", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "code": { + "name": "code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "definition": "select \"tag_subfields\".\"id\" as \"id\", \"tag_subfields\".\"tag_type_code\", \"tag_types\".\"description\", \"tag_subfields\".\"attributes_id\", \"tag_subfields\".\"attributes_description\", \"tag_subfields\".\"expression\", \"tag_subfields\".\"delimiter\", \"tag_subfields\".\"sort_order\", \"tag_subfields\".\"created_at\", \"tag_subfields\".\"updated_at\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\", \"projects\".\"name\" from \"tag_subfields\" inner join \"tag_types\" on (\"tag_subfields\".\"tag_type_code\" = \"tag_types\".\"code\" and \"tag_subfields\".\"project_id\" = \"tag_types\".\"project_id\") inner join \"projects\" on \"tag_subfields\".\"project_id\" = \"projects\".\"id\"", + "name": "view_tag_subfields", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.document_stages_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_count": { + "name": "stage_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "stage_list": { + "name": "stage_list", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT\n d.id AS document_id,\n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n d.contract_id,\n (SELECT COUNT(*) FROM issue_stages WHERE document_id = d.id) AS stage_count,\n COALESCE( \n (SELECT json_agg(i.stage_name) FROM issue_stages i WHERE i.document_id = d.id), \n '[]'\n ) AS stage_list,\n d.created_at,\n d.updated_at\n FROM documents d\n", + "name": "document_stages_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.enhanced_documents_view": { + "columns": { + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "drawing_kind": { + "name": "drawing_kind", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_doc_number": { + "name": "vendor_doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "c_gbn": { + "name": "c_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "d_gbn": { + "name": "d_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "degree_gbn": { + "name": "degree_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "dept_gbn": { + "name": "dept_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "j_gbn": { + "name": "j_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "s_gbn": { + "name": "s_gbn", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_id": { + "name": "current_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_name": { + "name": "current_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_status": { + "name": "current_stage_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "current_stage_order": { + "name": "current_stage_order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_stage_plan_date": { + "name": "current_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_actual_date": { + "name": "current_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "current_stage_assignee_name": { + "name": "current_stage_assignee_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "current_stage_priority": { + "name": "current_stage_priority", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "days_until_due": { + "name": "days_until_due", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_overdue": { + "name": "is_overdue", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "days_difference": { + "name": "days_difference", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "total_stages": { + "name": "total_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "completed_stages": { + "name": "completed_stages", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "progress_percentage": { + "name": "progress_percentage", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_status": { + "name": "latest_revision_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_submitted_date": { + "name": "latest_submitted_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "all_stages": { + "name": "all_stages", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n WITH document_stats AS (\n SELECT \n d.id as document_id,\n COUNT(ist.id) as total_stages,\n COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) as completed_stages,\n CASE \n WHEN COUNT(ist.id) > 0 \n THEN ROUND((COUNT(CASE WHEN ist.stage_status IN ('COMPLETED', 'APPROVED') THEN 1 END) * 100.0) / COUNT(ist.id))\n ELSE 0 \n END as progress_percentage\n FROM documents d\n LEFT JOIN issue_stages ist ON d.id = ist.document_id\n GROUP BY d.id\n ),\n current_stage_info AS (\n SELECT DISTINCT ON (document_id)\n document_id,\n id as current_stage_id,\n stage_name as current_stage_name,\n stage_status as current_stage_status,\n stage_order as current_stage_order,\n plan_date as current_stage_plan_date,\n actual_date as current_stage_actual_date,\n assignee_name as current_stage_assignee_name,\n priority as current_stage_priority,\n CASE \n WHEN actual_date IS NULL AND plan_date IS NOT NULL \n THEN plan_date - CURRENT_DATE\n ELSE NULL \n END as days_until_due,\n CASE \n WHEN actual_date IS NULL AND plan_date < CURRENT_DATE \n THEN true\n WHEN actual_date IS NOT NULL AND actual_date > plan_date \n THEN true\n ELSE false \n END as is_overdue,\n CASE \n WHEN actual_date IS NOT NULL AND plan_date IS NOT NULL \n THEN actual_date - plan_date\n ELSE NULL \n END as days_difference\n FROM issue_stages\n WHERE stage_status NOT IN ('COMPLETED', 'APPROVED')\n ORDER BY document_id, stage_order ASC, priority DESC\n ),\n latest_revision_info AS (\n SELECT DISTINCT ON (ist.document_id)\n ist.document_id,\n r.id as latest_revision_id,\n r.revision as latest_revision,\n r.revision_status as latest_revision_status,\n r.uploader_name as latest_revision_uploader_name,\n r.submitted_date as latest_submitted_date\n FROM revisions r\n JOIN issue_stages ist ON r.issue_stage_id = ist.id\n ORDER BY ist.document_id, r.created_at DESC\n ),\n -- 리비전별 첨부파일 집계\n revision_attachments AS (\n SELECT \n r.id as revision_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', da.id,\n 'revisionId', da.revision_id,\n 'fileName', da.file_name,\n 'filePath', da.file_path,\n 'fileSize', da.file_size,\n 'fileType', da.file_type,\n 'createdAt', da.created_at,\n 'updatedAt', da.updated_at\n ) ORDER BY da.created_at\n ) FILTER (WHERE da.id IS NOT NULL),\n '[]'::json\n ) as attachments\n FROM revisions r\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY r.id\n ),\n -- 스테이지별 리비전 집계 (첨부파일 포함)\n stage_revisions AS (\n SELECT \n ist.id as stage_id,\n COALESCE(\n json_agg(\n json_build_object(\n 'id', r.id,\n 'issueStageId', r.issue_stage_id,\n 'revision', r.revision,\n 'uploaderType', r.uploader_type,\n 'uploaderId', r.uploader_id,\n 'uploaderName', r.uploader_name,\n 'comment', r.comment,\n 'usage', r.usage,\n 'revisionStatus', r.revision_status,\n 'submittedDate', r.submitted_date,\n 'uploadedAt', r.uploaded_at,\n 'approvedDate', r.approved_date,\n 'reviewStartDate', r.review_start_date,\n 'rejectedDate', r.rejected_date,\n 'reviewerId', r.reviewer_id,\n 'reviewerName', r.reviewer_name,\n 'reviewComments', r.review_comments,\n 'createdAt', r.created_at,\n 'updatedAt', r.updated_at,\n 'attachments', ra.attachments\n ) ORDER BY r.created_at\n ) FILTER (WHERE r.id IS NOT NULL),\n '[]'::json\n ) as revisions\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN revision_attachments ra ON r.id = ra.revision_id\n GROUP BY ist.id\n ),\n -- 문서별 스테이지 집계 (리비전 포함)\n stage_aggregation AS (\n SELECT \n ist.document_id,\n json_agg(\n json_build_object(\n 'id', ist.id,\n 'stageName', ist.stage_name,\n 'stageStatus', ist.stage_status,\n 'stageOrder', ist.stage_order,\n 'planDate', ist.plan_date,\n 'actualDate', ist.actual_date,\n 'assigneeName', ist.assignee_name,\n 'priority', ist.priority,\n 'revisions', sr.revisions\n ) ORDER BY ist.stage_order\n ) as all_stages\n FROM issue_stages ist\n LEFT JOIN stage_revisions sr ON ist.id = sr.stage_id\n GROUP BY ist.document_id\n ),\n attachment_counts AS (\n SELECT \n ist.document_id,\n COUNT(da.id) as attachment_count\n FROM issue_stages ist\n LEFT JOIN revisions r ON ist.id = r.issue_stage_id\n LEFT JOIN document_attachments da ON r.id = da.revision_id\n GROUP BY ist.document_id\n )\n \n SELECT \n d.id as document_id,\n d.doc_number,\n d.drawing_kind,\n d.vendor_doc_number, -- ✅ 벤더 문서 번호 추가\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n\n d.c_gbn,\n d.d_gbn,\n d.degree_gbn,\n d.dept_gbn,\n d.s_gbn,\n\n\n \n -- ✅ 프로젝트 및 벤더 정보 추가\n p.code as project_code,\n v.vendor_name as vendor_name,\n v.vendor_code as vendor_code,\n \n -- 현재 스테이지 정보\n csi.current_stage_id,\n csi.current_stage_name,\n csi.current_stage_status,\n csi.current_stage_order,\n csi.current_stage_plan_date,\n csi.current_stage_actual_date,\n csi.current_stage_assignee_name,\n csi.current_stage_priority,\n \n -- 계산 필드\n csi.days_until_due,\n csi.is_overdue,\n csi.days_difference,\n \n -- 진행률 정보\n ds.total_stages,\n ds.completed_stages,\n ds.progress_percentage,\n \n -- 최신 리비전 정보\n lri.latest_revision_id,\n lri.latest_revision,\n lri.latest_revision_status,\n lri.latest_revision_uploader_name,\n lri.latest_submitted_date,\n \n -- 전체 스테이지 (리비전 및 첨부파일 포함)\n COALESCE(sa.all_stages, '[]'::json) as all_stages,\n \n -- 기타\n COALESCE(ac.attachment_count, 0) as attachment_count,\n d.created_at,\n d.updated_at\n \n FROM documents d\n -- ✅ contracts, projects, vendors 테이블 JOIN 추가\n LEFT JOIN contracts c ON d.contract_id = c.id\n LEFT JOIN projects p ON c.project_id = p.id\n LEFT JOIN vendors v ON c.vendor_id = v.id\n \n LEFT JOIN document_stats ds ON d.id = ds.document_id\n LEFT JOIN current_stage_info csi ON d.id = csi.document_id\n LEFT JOIN latest_revision_info lri ON d.id = lri.document_id\n LEFT JOIN stage_aggregation sa ON d.id = sa.document_id\n LEFT JOIN attachment_counts ac ON d.id = ac.document_id\n \n ORDER BY d.created_at DESC\n", + "name": "enhanced_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.sync_status_view": { + "columns": { + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "target_system": { + "name": "target_system", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "total_changes": { + "name": "total_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "pending_changes": { + "name": "pending_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "synced_changes": { + "name": "synced_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "failed_changes": { + "name": "failed_changes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "last_sync_at": { + "name": "last_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_sync_at": { + "name": "next_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "sync_enabled": { + "name": "sync_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n WITH change_stats AS (\n SELECT \n cl.contract_id,\n sc.target_system,\n COUNT(*) as total_changes,\n COUNT(CASE WHEN cl.is_synced = false AND cl.sync_attempts < sc.retry_max_attempts THEN 1 END) as pending_changes,\n COUNT(CASE WHEN cl.is_synced = true THEN 1 END) as synced_changes,\n COUNT(CASE WHEN cl.sync_attempts >= sc.retry_max_attempts AND cl.is_synced = false THEN 1 END) as failed_changes,\n MAX(cl.synced_at) as last_sync_at\n FROM change_logs cl\n CROSS JOIN sync_configs sc \n WHERE cl.contract_id = sc.contract_id\n AND (cl.target_systems IS NULL OR cl.target_systems @> to_jsonb(sc.target_system))\n GROUP BY cl.contract_id, sc.target_system\n )\n SELECT \n cs.contract_id,\n cs.target_system,\n COALESCE(cs.total_changes, 0) as total_changes,\n COALESCE(cs.pending_changes, 0) as pending_changes,\n COALESCE(cs.synced_changes, 0) as synced_changes,\n COALESCE(cs.failed_changes, 0) as failed_changes,\n cs.last_sync_at,\n CASE \n WHEN sc.sync_enabled = true AND sc.last_successful_sync IS NOT NULL \n THEN sc.last_successful_sync + (sc.sync_interval_minutes || ' minutes')::interval\n ELSE NULL\n END as next_sync_at,\n sc.sync_enabled\n FROM sync_configs sc\n LEFT JOIN change_stats cs ON sc.contract_id = cs.contract_id AND sc.target_system = cs.target_system\n", + "name": "sync_status_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_documents_view": { + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "doc_number": { + "name": "doc_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "pic": { + "name": "pic", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "issued_date": { + "name": "issued_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "contract_id": { + "name": "contract_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "latest_stage_id": { + "name": "latest_stage_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_stage_name": { + "name": "latest_stage_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "latest_stage_plan_date": { + "name": "latest_stage_plan_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_stage_actual_date": { + "name": "latest_stage_actual_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "latest_revision_id": { + "name": "latest_revision_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "latest_revision": { + "name": "latest_revision", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_type": { + "name": "latest_revision_uploader_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "latest_revision_uploader_name": { + "name": "latest_revision_uploader_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "attachment_count": { + "name": "attachment_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "definition": "\n SELECT \n d.id, \n d.doc_number,\n d.title,\n d.pic,\n d.status,\n d.issued_date,\n d.contract_id,\n \n (SELECT id FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_id,\n (SELECT stage_name FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_name,\n (SELECT plan_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_plan_date,\n (SELECT actual_date FROM issue_stages WHERE document_id = d.id ORDER BY created_at DESC LIMIT 1) AS latest_stage_actual_date,\n \n (SELECT r.id FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_id,\n (SELECT r.revision FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision,\n (SELECT r.uploader_type FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_type,\n (SELECT r.uploader_name FROM revisions r JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id ORDER BY r.created_at DESC LIMIT 1) AS latest_revision_uploader_name,\n \n (SELECT COUNT(*) FROM document_attachments a JOIN revisions r ON a.revision_id = r.id JOIN issue_stages i ON r.issue_stage_id = i.id WHERE i.document_id = d.id) AS attachment_count,\n \n d.created_at,\n d.updated_at\n FROM documents d\n JOIN contracts c ON d.contract_id = c.id\n ", + "name": "vendor_documents_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_candidates_with_vendor_info": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "contact_email": { + "name": "contact_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'COLLECTED'" + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"vendor_candidates\".\"id\", \"vendor_candidates\".\"company_name\", \"vendor_candidates\".\"contact_email\", \"vendor_candidates\".\"contact_phone\", \"vendor_candidates\".\"tax_id\", \"vendor_candidates\".\"address\", \"vendor_candidates\".\"country\", \"vendor_candidates\".\"source\", \"vendor_candidates\".\"status\", \"vendor_candidates\".\"items\", \"vendor_candidates\".\"remark\", \"vendor_candidates\".\"created_at\", \"vendor_candidates\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"created_at\" as \"vendor_created_at\", (\n SELECT l2.\"created_at\"\n FROM \"vendor_candidate_logs\" l2\n WHERE l2.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l2.\"action\" = 'status_change'\n ORDER BY l2.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_at\", (\n SELECT u.\"name\"\n FROM \"users\" u\n JOIN \"vendor_candidate_logs\" l3\n ON l3.\"user_id\" = u.\"id\"\n WHERE l3.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l3.\"action\" = 'status_change'\n ORDER BY l3.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_by\", (\n SELECT l4.\"created_at\"\n FROM \"vendor_candidate_logs\" l4\n WHERE l4.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l4.\"action\" = 'invite_sent'\n ORDER BY l4.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_at\", (\n SELECT u2.\"name\"\n FROM \"users\" u2\n JOIN \"vendor_candidate_logs\" l5\n ON l5.\"user_id\" = u2.\"id\"\n WHERE l5.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l5.\"action\" = 'invite_sent'\n ORDER BY l5.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_by\" from \"vendor_candidates\" left join \"vendors\" on \"vendor_candidates\".\"vendor_id\" = \"vendors\".\"id\"", + "name": "vendor_candidates_with_vendor_info", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_detail_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "tax_id": { + "name": "tax_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "business_size": { + "name": "business_size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "default": "'PENDING_REVIEW'" + }, + "representative_name": { + "name": "representative_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_birth": { + "name": "representative_birth", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "representative_email": { + "name": "representative_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "representative_phone": { + "name": "representative_phone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "corporate_registration_number": { + "name": "corporate_registration_number", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "credit_agency": { + "name": "credit_agency", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "credit_rating": { + "name": "credit_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "cash_flow_rating": { + "name": "cash_flow_rating", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"business_size\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"", + "name": "vendor_detail_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", + "name": "vendor_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_materials_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unit_of_measure": { + "name": "unit_of_measure", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false + }, + "steel_type": { + "name": "steel_type", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "grade_material": { + "name": "grade_material", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "definition": "select \"vendor_possible_materials\".\"id\", \"vendor_possible_materials\".\"vendor_id\", \"materials\".\"item_name\", \"materials\".\"item_code\", \"materials\".\"description\", \"materials\".\"unit_of_measure\", \"materials\".\"steel_type\", \"materials\".\"grade_material\", \"vendor_possible_materials\".\"created_at\", \"vendor_possible_materials\".\"updated_at\" from \"vendor_possible_materials\" left join \"materials\" on \"vendor_possible_materials\".\"item_code\" = \"materials\".\"item_code\"", + "name": "vendor_materials_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendors_with_types": { + "columns": {}, + "definition": "select \"vendors\".\"id\" as \"id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"tax_id\" as \"tax_id\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"phone\" as \"phone\", \"vendors\".\"email\" as \"email\", \"vendors\".\"business_size\" as \"business_size\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"status\", \"vendors\".\"vendor_type_id\" as \"vendor_type_id\", \"vendors\".\"representative_name\" as \"representative_name\", \"vendors\".\"representative_birth\" as \"representative_birth\", \"vendors\".\"representative_email\" as \"representative_email\", \"vendors\".\"representative_phone\" as \"representative_phone\", \"vendors\".\"corporate_registration_number\" as \"corporate_registration_number\", \"vendors\".\"items\" as \"items\", \"vendors\".\"credit_agency\" as \"credit_agency\", \"vendors\".\"credit_rating\" as \"credit_rating\", \"vendors\".\"cash_flow_rating\" as \"cash_flow_rating\", \"vendors\".\"created_at\" as \"created_at\", \"vendors\".\"updated_at\" as \"updated_at\", \"vendor_types\".\"name_ko\" as \"vendor_type_name\", \"vendor_types\".\"name_en\" as \"vendor_type_name_en\", \"vendor_types\".\"code\" as \"vendor_type_code\", \n CASE\n WHEN \"vendors\".\"status\" = 'ACTIVE' THEN '정규업체'\n WHEN \"vendors\".\"status\" IN ('INACTIVE', 'BLACKLISTED', 'REJECTED') THEN ''\n ELSE '잠재업체'\n END\n as \"vendor_category\" from \"vendors\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\"", + "name": "vendors_with_types", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.basic_contract_view": { + "columns": {}, + "definition": "select \"basic_contract\".\"id\" as \"id\", \"basic_contract\".\"template_id\" as \"template_id\", \"basic_contract\".\"vendor_id\" as \"vendor_id\", \"basic_contract\".\"requested_by\" as \"requested_by\", \"basic_contract\".\"status\" as \"basic_contract_status\", \"basic_contract\".\"created_at\" as \"created_at\", \"basic_contract\".\"updated_at\" as \"updated_at\", \"basic_contract\".\"updated_at\" as \"completed_at\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"email\" as \"vendor_email\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"users\".\"name\" as \"user_name\", \"basic_contract_templates\".\"template_name\" as \"template_name\", \"basic_contract_templates\".\"validity_period\" as \"validityPeriod\", \"basic_contract_templates\".\"file_path\" as \"file_path\", \"basic_contract_templates\".\"file_name\" as \"file_name\", \"basic_contract\".\"file_path\" as \"signed_file_path\" from \"basic_contract\" left join \"vendors\" on \"basic_contract\".\"vendor_id\" = \"vendors\".\"id\" left join \"users\" on \"basic_contract\".\"requested_by\" = \"users\".\"id\" left join \"basic_contract_templates\" on \"basic_contract\".\"template_id\" = \"basic_contract_templates\".\"id\"", + "name": "basic_contract_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.pr_items_view": { + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "procurement_rfqs_id": { + "name": "procurement_rfqs_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_item": { + "name": "rfq_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_item": { + "name": "pr_item", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pr_no": { + "name": "pr_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "material_code": { + "name": "material_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_category": { + "name": "material_category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "acc": { + "name": "acc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "material_description": { + "name": "material_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "uom": { + "name": "uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "gross_weight": { + "name": "gross_weight", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "gw_uom": { + "name": "gw_uom", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "spec_no": { + "name": "spec_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "spec_url": { + "name": "spec_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "tracking_no": { + "name": "tracking_no", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "major_yn": { + "name": "major_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "project_def": { + "name": "project_def", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_sc": { + "name": "project_sc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_kl": { + "name": "project_kl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_lc": { + "name": "project_lc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_dl": { + "name": "project_dl", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "item_code": { + "name": "item_code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "item_name": { + "name": "item_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select \"pr_items\".\"id\", \"pr_items\".\"procurement_rfqs_id\", \"pr_items\".\"rfq_item\", \"pr_items\".\"pr_item\", \"pr_items\".\"pr_no\", \"pr_items\".\"material_code\", \"pr_items\".\"material_category\", \"pr_items\".\"acc\", \"pr_items\".\"material_description\", \"pr_items\".\"size\", \"pr_items\".\"delivery_date\", \"pr_items\".\"quantity\", \"pr_items\".\"uom\", \"pr_items\".\"gross_weight\", \"pr_items\".\"gw_uom\", \"pr_items\".\"spec_no\", \"pr_items\".\"spec_url\", \"pr_items\".\"tracking_no\", \"pr_items\".\"major_yn\", \"pr_items\".\"project_def\", \"pr_items\".\"project_sc\", \"pr_items\".\"project_kl\", \"pr_items\".\"project_lc\", \"pr_items\".\"project_dl\", \"pr_items\".\"remark\", \"procurement_rfqs\".\"rfq_code\", \"procurement_rfqs\".\"item_code\", \"procurement_rfqs\".\"item_name\" from \"pr_items\" left join \"procurement_rfqs\" on \"pr_items\".\"procurement_rfqs_id\" = \"procurement_rfqs\".\"id\"", + "name": "pr_items_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfq_details_view": { + "columns": {}, + "definition": "select \"rfq_details\".\"id\" as \"detail_id\", \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfqs\".\"item_code\" as \"item_code\", \"rfqs\".\"item_name\" as \"item_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"country\" as \"vendor_country\", \"rfq_details\".\"currency\" as \"currency\", \"payment_terms\".\"code\" as \"payment_terms_code\", \"payment_terms\".\"description\" as \"payment_terms_description\", \"incoterms\".\"code\" as \"incoterms_code\", \"incoterms\".\"description\" as \"incoterms_description\", \"rfq_details\".\"incoterms_detail\" as \"incoterms_detail\", \"rfq_details\".\"delivery_date\" as \"delivery_date\", \"rfq_details\".\"tax_code\" as \"tax_code\", \"rfq_details\".\"place_of_shipping\" as \"place_of_shipping\", \"rfq_details\".\"place_of_destination\" as \"place_of_destination\", \"rfq_details\".\"material_price_related_yn\" as \"material_price_related_yn\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"rfq_details\".\"updated_at\" as \"updated_at\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\"\n ) as \"pr_items_count\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\" \n AND major_yn = true\n ) as \"major_items_count\", (\n SELECT COUNT(*) \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"comment_count\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_comment_date\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\" AND is_vendor_comment = true\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_vendor_comment_date\", (\n SELECT COUNT(*) \n FROM procurement_rfq_attachments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) > 0\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"has_quotation\", (\n SELECT status\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_status\", (\n SELECT total_price\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_total_price\", (\n SELECT quotation_version\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"quotation_version\", (\n SELECT COUNT(DISTINCT quotation_version)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"quotation_version_count\", (\n SELECT created_at\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"last_quotation_date\" from \"procurement_rfq_details\" \"rfq_details\" left join \"procurement_rfqs\" \"rfqs\" on \"rfq_details\".\"procurement_rfqs_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"rfq_details\".\"vendors_id\" = \"vendors\".\"id\" left join \"payment_terms\" on \"rfq_details\".\"payment_terms_code\" = \"payment_terms\".\"code\" left join \"incoterms\" on \"rfq_details\".\"incoterms_code\" = \"incoterms\".\"code\" left join \"users\" \"updated_by_user\" on \"rfq_details\".\"updated_by\" = \"updated_by_user\".\"id\"", + "name": "procurement_rfq_details_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.procurement_rfqs_view": { + "columns": {}, + "definition": "select \"procurement_rfqs\".\"id\" as \"id\", \"procurement_rfqs\".\"rfq_code\" as \"rfq_code\", \"procurement_rfqs\".\"series\" as \"series\", \"procurement_rfqs\".\"rfq_sealed_yn\" as \"rfq_sealed_yn\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"procurement_rfqs\".\"item_code\" as \"item_code\", \"procurement_rfqs\".\"item_name\" as \"item_name\", \"procurement_rfqs\".\"status\" as \"status\", \"procurement_rfqs\".\"pic_code\" as \"pic_code\", \"procurement_rfqs\".\"rfq_send_date\" as \"rfq_send_date\", \"procurement_rfqs\".\"due_date\" as \"due_date\", (\n SELECT MIN(submitted_at)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"procurement_rfqs\".\"id\"\n AND submitted_at IS NOT NULL\n ) as \"earliest_quotation_submitted_at\", \"created_by_user\".\"name\" as \"created_by_user_name\", \"sent_by_user\".\"name\" as \"sent_by_user_name\", \"procurement_rfqs\".\"updated_at\" as \"updated_at\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"procurement_rfqs\".\"remark\" as \"remark\", (\n SELECT material_code \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"major_item_material_code\", (\n SELECT pr_no \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"po_no\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n ) as \"pr_items_count\" from \"procurement_rfqs\" left join \"projects\" on \"procurement_rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" \"created_by_user\" on \"procurement_rfqs\".\"created_by\" = \"created_by_user\".\"id\" left join \"users\" \"updated_by_user\" on \"procurement_rfqs\".\"updated_by\" = \"updated_by_user\".\"id\" left join \"users\" \"sent_by_user\" on \"procurement_rfqs\".\"sent_by\" = \"sent_by_user\".\"id\"", + "name": "procurement_rfqs_view", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.b_rfqs_master": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pic_name": { + "name": "pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "eng_pic_name": { + "name": "eng_pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "package_no": { + "name": "package_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "package_name": { + "name": "package_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_name": { + "name": "project_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_type": { + "name": "project_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "project_company": { + "name": "project_company", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_flag": { + "name": "project_flag", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_site": { + "name": "project_site", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "total_attachments": { + "name": "total_attachments", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.description,\n br.status,\n br.due_date,\n br.pic_code,\n br.pic_name,\n br.eng_pic_name,\n br.package_no,\n br.package_name,\n br.project_id,\n p.code as project_code,\n p.name as project_name,\n p.type as project_type,\n br.project_company,\n br.project_flag,\n br.project_site,\n COALESCE(att_count.total_attachments, 0) as total_attachments,\n br.created_at,\n br.updated_at\n FROM b_rfqs br\n LEFT JOIN projects p ON br.project_id = p.id\n LEFT JOIN (\n SELECT rfq_id, COUNT(*) as total_attachments\n FROM b_rfq_attachments\n GROUP BY rfq_id\n ) att_count ON br.id = att_count.rfq_id\n", + "name": "b_rfqs_master", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.final_rfq_detail": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "rfq_status": { + "name": "rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "final_rfq_id": { + "name": "final_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "final_rfq_status": { + "name": "final_rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_country": { + "name": "vendor_country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "vendor_business_size": { + "name": "vendor_business_size", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "valid_date": { + "name": "valid_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "delivery_date": { + "name": "delivery_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_description": { + "name": "incoterms_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "payment_terms_code": { + "name": "payment_terms_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "payment_terms_description": { + "name": "payment_terms_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "tax_code": { + "name": "tax_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_shipping": { + "name": "place_of_shipping", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "place_of_destination": { + "name": "place_of_destination", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "short_list": { + "name": "short_list", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "return_yn": { + "name": "return_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "cp_request_yn": { + "name": "cp_request_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "prject_gtc_yn": { + "name": "prject_gtc_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "firsttime_yn": { + "name": "firsttime_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "material_price_related_yn": { + "name": "material_price_related_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "return_revision": { + "name": "return_revision", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "gtc": { + "name": "gtc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "gtc_valid_date": { + "name": "gtc_valid_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sparepart": { + "name": "sparepart", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vendor_remark": { + "name": "vendor_remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.status as rfq_status,\n fr.id as final_rfq_id,\n fr.final_rfq_status,\n fr.vendor_id,\n v.vendor_code,\n v.vendor_name,\n v.country as vendor_country,\n v.business_size as vendor_business_size,\n fr.due_date,\n fr.valid_date,\n fr.delivery_date,\n fr.incoterms_code,\n inc.description as incoterms_description,\n fr.payment_terms_code,\n pt.description as payment_terms_description,\n fr.currency,\n fr.tax_code,\n fr.place_of_shipping,\n fr.place_of_destination,\n fr.short_list,\n fr.return_yn,\n fr.cp_request_yn,\n fr.prject_gtc_yn,\n fr.firsttime_yn,\n fr.material_price_related_yn,\n fr.return_revision,\n fr.gtc,\n fr.gtc_valid_date,\n fr.classification,\n fr.sparepart,\n fr.remark,\n fr.vendor_remark,\n fr.created_at,\n fr.updated_at\n FROM b_rfqs br\n JOIN final_rfq fr ON br.id = fr.rfq_id\n LEFT JOIN vendors v ON fr.vendor_id = v.id\n LEFT JOIN incoterms inc ON fr.incoterms_code = inc.code\n LEFT JOIN payment_terms pt ON fr.payment_terms_code = pt.code\n", + "name": "final_rfq_detail", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.initial_rfq_detail": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "rfq_status": { + "name": "rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "initial_rfq_id": { + "name": "initial_rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "initial_rfq_status": { + "name": "initial_rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_country": { + "name": "vendor_country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "vendor_business_size": { + "name": "vendor_business_size", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "valid_date": { + "name": "valid_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "incoterms_code": { + "name": "incoterms_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "incoterms_description": { + "name": "incoterms_description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "short_list": { + "name": "short_list", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "return_yn": { + "name": "return_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "cp_request_yn": { + "name": "cp_request_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "prject_gtc_yn": { + "name": "prject_gtc_yn", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "return_revision": { + "name": "return_revision", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "gtc": { + "name": "gtc", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "gtc_valid_date": { + "name": "gtc_valid_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "classification": { + "name": "classification", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sparepart": { + "name": "sparepart", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.status as rfq_status,\n ir.id as initial_rfq_id,\n ir.initial_rfq_status,\n ir.vendor_id,\n v.vendor_code,\n v.vendor_name,\n v.country as vendor_country,\n v.business_size as vendor_business_size,\n ir.due_date,\n ir.valid_date,\n ir.incoterms_code,\n inc.description as incoterms_description,\n ir.short_list,\n ir.return_yn,\n ir.cp_request_yn,\n ir.prject_gtc_yn,\n ir.return_revision,\n ir.gtc,\n ir.gtc_valid_date,\n ir.classification,\n ir.sparepart,\n ir.created_at,\n ir.updated_at\n FROM b_rfqs br\n JOIN initial_rfq ir ON br.id = ir.rfq_id\n LEFT JOIN vendors v ON ir.vendor_id = v.id\n LEFT JOIN incoterms inc ON ir.incoterms_code = inc.code\n", + "name": "initial_rfq_detail", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.rfq_dashboard": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "project_code": { + "name": "project_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_name": { + "name": "project_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "package_no": { + "name": "package_no", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "package_name": { + "name": "package_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "pic_code": { + "name": "pic_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "pic_name": { + "name": "pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "eng_pic_name": { + "name": "eng_pic_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "project_company": { + "name": "project_company", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_flag": { + "name": "project_flag", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_site": { + "name": "project_site", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "total_attachments": { + "name": "total_attachments", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "initial_vendor_count": { + "name": "initial_vendor_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "final_vendor_count": { + "name": "final_vendor_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "initial_response_rate": { + "name": "initial_response_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "final_response_rate": { + "name": "final_response_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "overall_progress": { + "name": "overall_progress", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "days_to_deadline": { + "name": "days_to_deadline", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_by_name": { + "name": "updated_by_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "updated_by_email": { + "name": "updated_by_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n -- ② SELECT 절 확장 -------------------------------------------\n SELECT\n br.id AS rfq_id,\n br.rfq_code,\n br.description,\n br.status,\n br.due_date,\n p.code AS project_code,\n p.name AS project_name,\n br.package_no,\n br.package_name,\n br.pic_code,\n br.pic_name,\n br.eng_pic_name,\n br.project_company,\n br.project_flag,\n br.project_site,\n br.remark,\n \n -- 첨부/벤더 요약 -----------------------\n COALESCE(att_count.total_attachments, 0) AS total_attachments,\n COALESCE(init_summary.vendor_count, 0) AS initial_vendor_count,\n COALESCE(final_summary.vendor_count, 0) AS final_vendor_count,\n COALESCE(init_summary.avg_response_rate, 0) AS initial_response_rate,\n COALESCE(final_summary.avg_response_rate, 0) AS final_response_rate,\n \n -- 진행률·마감까지 일수 --------------\n CASE \n WHEN br.status = 'DRAFT' THEN 0\n WHEN br.status = 'Doc. Received' THEN 10\n WHEN br.status = 'PIC Assigned' THEN 20\n WHEN br.status = 'Doc. Confirmed' THEN 30\n WHEN br.status = 'Init. RFQ Sent' THEN 40\n WHEN br.status = 'Init. RFQ Answered' THEN 50\n WHEN br.status = 'TBE started' THEN 60\n WHEN br.status = 'TBE finished' THEN 70\n WHEN br.status = 'Final RFQ Sent' THEN 80\n WHEN br.status = 'Quotation Received' THEN 90\n WHEN br.status = 'Vendor Selected' THEN 100\n ELSE 0\n END AS overall_progress,\n (br.due_date - CURRENT_DATE) AS days_to_deadline,\n \n br.created_at,\n br.updated_at,\n \n -- 💡 추가되는 컬럼 -------------------\n upd.name AS updated_by_name,\n upd.email AS updated_by_email\n FROM b_rfqs br\n LEFT JOIN projects p ON br.project_id = p.id\n \n -- ③ 사용자 정보 조인 --------------------\n LEFT JOIN users upd ON br.updated_by = upd.id\n \n -- (나머지 이미 있던 JOIN 들은 그대로) -----\n LEFT JOIN (\n SELECT rfq_id, COUNT(*) AS total_attachments\n FROM b_rfq_attachments\n GROUP BY rfq_id\n ) att_count ON br.id = att_count.rfq_id\n \n LEFT JOIN (\n SELECT \n rfq_id, \n COUNT(DISTINCT vendor_id) AS vendor_count,\n AVG(response_rate) AS avg_response_rate\n FROM vendor_response_summary\n WHERE rfq_type = 'INITIAL'\n GROUP BY rfq_id\n ) init_summary ON br.id = init_summary.rfq_id\n \n LEFT JOIN (\n SELECT \n rfq_id, \n COUNT(DISTINCT vendor_id) AS vendor_count,\n AVG(response_rate) AS avg_response_rate\n FROM vendor_response_summary\n WHERE rfq_type = 'FINAL'\n GROUP BY rfq_id\n ) final_summary ON br.id = final_summary.rfq_id\n ", + "name": "rfq_dashboard", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.vendor_response_summary": { + "columns": { + "rfq_id": { + "name": "rfq_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rfq_code": { + "name": "rfq_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "rfq_status": { + "name": "rfq_status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false + }, + "vendor_id": { + "name": "vendor_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "vendor_code": { + "name": "vendor_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "vendor_name": { + "name": "vendor_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "vendor_country": { + "name": "vendor_country", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "vendor_business_size": { + "name": "vendor_business_size", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "rfq_type": { + "name": "rfq_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "total_attachments": { + "name": "total_attachments", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "responded_count": { + "name": "responded_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "pending_count": { + "name": "pending_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "waived_count": { + "name": "waived_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "revision_requested_count": { + "name": "revision_requested_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "response_rate": { + "name": "response_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "completion_rate": { + "name": "completion_rate", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT \n br.id as rfq_id,\n br.rfq_code,\n br.status as rfq_status,\n v.id as vendor_id,\n v.vendor_code,\n v.vendor_name,\n v.country as vendor_country,\n v.business_size as vendor_business_size,\n var.rfq_type,\n COUNT(var.id) as total_attachments,\n COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) as responded_count,\n COUNT(CASE WHEN var.response_status = 'NOT_RESPONDED' THEN 1 END) as pending_count,\n COUNT(CASE WHEN var.response_status = 'WAIVED' THEN 1 END) as waived_count,\n COUNT(CASE WHEN var.response_status = 'REVISION_REQUESTED' THEN 1 END) as revision_requested_count,\n ROUND(\n (COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) * 100.0 / \n NULLIF(COUNT(CASE WHEN var.response_status != 'WAIVED' THEN 1 END), 0)), \n 2\n ) as response_rate,\n ROUND(\n ((COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) + \n COUNT(CASE WHEN var.response_status = 'WAIVED' THEN 1 END)) * 100.0 / COUNT(var.id)), \n 2\n ) as completion_rate\n FROM b_rfqs br\n JOIN b_rfq_attachments bra ON br.id = bra.rfq_id\n JOIN vendor_attachment_responses var ON bra.id = var.attachment_id\n JOIN vendors v ON var.vendor_id = v.id\n GROUP BY br.id, br.rfq_code, br.status, v.id, v.vendor_code, v.vendor_name, v.country, v.business_size, var.rfq_type\n", + "name": "vendor_response_summary", + "schema": "public", + "isExisting": false, + "materialized": false + } + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db/migrations/meta/_journal.json b/db/migrations/meta/_journal.json index 275bb862..5fdfde1f 100644 --- a/db/migrations/meta/_journal.json +++ b/db/migrations/meta/_journal.json @@ -792,6 +792,111 @@ "when": 1749085448550, "tag": "0112_amusing_carlie_cooper", "breakpoints": true + }, + { + "idx": 113, + "version": "7", + "when": 1749099620798, + "tag": "0113_gifted_adam_destine", + "breakpoints": true + }, + { + "idx": 114, + "version": "7", + "when": 1749108736385, + "tag": "0114_even_callisto", + "breakpoints": true + }, + { + "idx": 115, + "version": "7", + "when": 1749109184099, + "tag": "0115_clear_magik", + "breakpoints": true + }, + { + "idx": 116, + "version": "7", + "when": 1749429350366, + "tag": "0116_medical_frightful_four", + "breakpoints": true + }, + { + "idx": 117, + "version": "7", + "when": 1749430842084, + "tag": "0117_sloppy_famine", + "breakpoints": true + }, + { + "idx": 118, + "version": "7", + "when": 1749430932066, + "tag": "0118_condemned_junta", + "breakpoints": true + }, + { + "idx": 119, + "version": "7", + "when": 1749458751140, + "tag": "0119_flowery_kabuki", + "breakpoints": true + }, + { + "idx": 120, + "version": "7", + "when": 1749599517650, + "tag": "0120_broad_lenny_balinger", + "breakpoints": true + }, + { + "idx": 121, + "version": "7", + "when": 1749603229920, + "tag": "0121_gigantic_shinko_yamashiro", + "breakpoints": true + }, + { + "idx": 122, + "version": "7", + "when": 1749603391159, + "tag": "0122_eager_celestials", + "breakpoints": true + }, + { + "idx": 123, + "version": "7", + "when": 1749637268522, + "tag": "0123_magenta_nightcrawler", + "breakpoints": true + }, + { + "idx": 124, + "version": "7", + "when": 1749637405191, + "tag": "0124_sparkling_shinko_yamashiro", + "breakpoints": true + }, + { + "idx": 125, + "version": "7", + "when": 1749640535122, + "tag": "0125_handy_shaman", + "breakpoints": true + }, + { + "idx": 126, + "version": "7", + "when": 1749641696472, + "tag": "0126_vengeful_kid_colt", + "breakpoints": true + }, + { + "idx": 127, + "version": "7", + "when": 1749641778751, + "tag": "0127_sweet_spiral", + "breakpoints": true } ] } \ No newline at end of file diff --git a/db/schema/bRfq.ts b/db/schema/bRfq.ts new file mode 100644 index 00000000..5e211448 --- /dev/null +++ b/db/schema/bRfq.ts @@ -0,0 +1,680 @@ +import { pgTable, pgView, serial, varchar, text, timestamp, boolean, integer, numeric, date, uniqueIndex, foreignKey } from "drizzle-orm/pg-core"; +import { eq, sql, and } from "drizzle-orm"; +import { projects } from "./projects"; +import { users } from "./users"; +import { vendors } from "./vendors"; +import { incoterms, paymentTerms } from "./procurementRFQ"; + +export const bRfqs = pgTable( + "b_rfqs", + { + id: serial("id").primaryKey(), + + // RFQ 고유 코드 + rfqCode: varchar("rfq_code", { length: 50 }).unique(), // ex) "RFQ-2025-001" + + // 프로젝트 참조 + projectId: integer("project_id") + .references(() => projects.id, { onDelete: "set null" }), + + description: varchar("description", { length: 255 }), + + remark: text("remark"), + + dueDate: date("due_date", { mode: "date" }) + .$type() + .notNull(), + + status: varchar("status", { length: 30 }) + .$type<"DRAFT" | "Doc. Received" | "PIC Assigned" | "Doc. Confirmed" | "Init. RFQ Sent" | "Init. RFQ Answered" | "TBE started" | "TBE finished" | "Final RFQ Sent" | "Quotation Received" | "Vendor Selected">() + .default("DRAFT") + .notNull(), + + picCode: varchar("pic_code", { length: 50 }), + picName: varchar("pic_name", { length: 50 }), + EngPicName: varchar("eng_pic_name", { length: 50 }), + + projectCompany: varchar("project_company", { length: 255 }), + projectFlag: varchar("project_flag", { length: 255 }), + projectSite: varchar("project_site", { length: 255 }), + + packageNo: varchar("package_no", { length: 50 }), + packageName: varchar("package_name", { length: 255 }), + + // 생성자 + createdBy: integer("created_by") + .notNull() + .references(() => users.id, { onDelete: "set null" }), + + updatedBy: integer("updated_by") + .notNull() + .references(() => users.id, { onDelete: "set null" }), + + createdAt: timestamp("created_at").defaultNow().notNull(), + updatedAt: timestamp("updated_at").defaultNow().notNull(), + } +); + +export const initialRfq = pgTable("initial_rfq", { + id: serial("id").primaryKey(), + rfqId: integer("rfq_id") + .notNull() + .references(() => bRfqs.id), + + initialRfqStatus: varchar("initial_rfq_status", { length: 30 }) + .$type<"DRAFT" | "Init. RFQ Sent" | "S/L Decline" | "Init. RFQ Answered">() + .default("DRAFT") + .notNull(), + + vendorId: integer("vendor_id") + .notNull() + .references(() => vendors.id), + + dueDate: date("due_date", { mode: "date" }) + .$type() + .notNull(), + + validDate: date("valid_date", { mode: "date" }) + .$type(), + + incotermsCode: varchar("incoterms_code", { length: 20 }) + .references(() => incoterms.code, { onDelete: "set null" }), + + gtc: varchar("gtc", { length: 255 }), + gtcValidDate: varchar("gtc_valid_date", { length: 255 }), + + classification: varchar("classification", { length: 255 }), + sparepart: varchar("sparepart", { length: 255 }), + + shortList: boolean('short_list').notNull().default(false), + returnYn: boolean('return_yn').notNull().default(false), + + cpRequestYn: boolean('cp_request_yn').notNull().default(false), + + prjectGtcYn: boolean('prject_gtc_yn').notNull().default(false), + + returnRevision: integer("return_revision") + .notNull().default(0), + + createdAt: timestamp("created_at").defaultNow().notNull(), + updatedAt: timestamp("updated_at").defaultNow().notNull(), +}); + +export const finalRfq = pgTable("final_rfq", { + id: serial("id").primaryKey(), + rfqId: integer("rfq_id") + .notNull() + .references(() => bRfqs.id), + + finalRfqStatus: varchar("final_rfq_status", { length: 30 }) + .$type<"DRAFT" | "Final RFQ Sent" | "Final RFQ Answered">() + .default("DRAFT") + .notNull(), + + vendorId: integer("vendor_id") + .notNull() + .references(() => vendors.id), + + dueDate: date("due_date", { mode: "date" }) + .$type() + .notNull(), + + validDate: date("valid_date", { mode: "date" }) + .$type(), + + incotermsCode: varchar("incoterms_code", { length: 20 }) + .references(() => incoterms.code, { onDelete: "set null" }), + + gtc: varchar("gtc", { length: 255 }), + gtcValidDate: varchar("gtc_valid_date", { length: 255 }), + + classification: varchar("classification", { length: 255 }), + sparepart: varchar("sparepart", { length: 255 }), + + shortList: boolean('short_list').notNull().default(false), + returnYn: boolean('return_yn').notNull().default(false), + + cpRequestYn: boolean('cp_request_yn').notNull().default(false), + + prjectGtcYn: boolean('prject_gtc_yn').notNull().default(true), + + returnRevision: integer("return_revision") + .notNull().default(0), + + currency: varchar("currency", { length: 10 }).default("KRW"), + + paymentTermsCode: varchar("payment_terms_code", { length: 50 }) + .references(() => paymentTerms.code, { onDelete: "set null" }), + + taxCode: varchar("tax_code", { length: 255 }).default("VV"), + deliveryDate: date("delivery_date", { mode: "date" }) + .$type() + .notNull(), + + placeOfShipping: varchar("place_of_shipping", { length: 255 }), + placeOfDestination: varchar("place_of_destination", { length: 255 }), + + firsttimeYn: boolean('firsttime_yn').notNull().default(true), + materialPriceRelatedYn: boolean("material_price_related_yn").default(false), + remark: text("remark"), + + vendorRemark: text("vendor_remark"), + + createdAt: timestamp("created_at").defaultNow().notNull(), + updatedAt: timestamp("updated_at").defaultNow().notNull(), +}); + +export const bRfqsAttachments = pgTable( + "b_rfq_attachments", + { + id: serial("id").primaryKey(), + attachmentType: varchar("attachment_type", { length: 50 }).notNull(), // '구매', '설계' + serialNo: varchar("serial_no", { length: 50 }).notNull(), + rfqId: integer("rfq_id") + .notNull() + .references(() => bRfqs.id), + fileName: varchar("file_name", { length: 255 }).notNull(), + originalFileName: varchar("original_file_name", { length: 255 }).notNull(), + filePath: varchar("file_path", { length: 512 }).notNull(), + fileSize: integer("file_size"), + fileType: varchar("file_type", { length: 100 }), + description: varchar("description", { length: 500 }), + createdBy: integer("created_by") + .references(() => users.id, { onDelete: "set null" }) + .notNull(), + createdAt: timestamp("created_at").defaultNow().notNull(), + }, + ); +// 1. 첨부파일 리비전 관리 테이블 +export const bRfqAttachmentRevisions = pgTable( + "b_rfq_attachment_revisions", + { + id: serial("id").primaryKey(), + attachmentId: integer("attachment_id") + .notNull() + .references(() => bRfqsAttachments.id, { onDelete: "cascade" }), + + revisionNo: varchar("revision_no", { length: 10 }).notNull(), // "Rev.0", "Rev.1", "Rev.2" + fileName: varchar("file_name", { length: 255 }).notNull(), + originalFileName: varchar("original_file_name", { length: 255 }).notNull(), + filePath: varchar("file_path", { length: 512 }).notNull(), + fileSize: integer("file_size"), + fileType: varchar("file_type", { length: 100 }), + + isLatest: boolean("is_latest").notNull().default(true), + revisionComment: text("revision_comment"), + + createdBy: integer("created_by") + .references(() => users.id, { onDelete: "set null" }) + .notNull(), + createdAt: timestamp("created_at").defaultNow().notNull(), + }, (t) => ({ + latestRevisionIdx: uniqueIndex('latest_revision_idx').on( + t.attachmentId.asc(), + t.isLatest.asc(), + ), + })); + +// 2. 벤더별 첨부파일 응답 현황 관리 +export const vendorAttachmentResponses = pgTable( + "vendor_attachment_responses", + { + id: serial("id").primaryKey(), + attachmentId: integer("attachment_id") + .notNull() + .references(() => bRfqsAttachments.id, { onDelete: "cascade" }), + + vendorId: integer("vendor_id") + .notNull() + .references(() => vendors.id, { onDelete: "cascade" }), + + rfqType: varchar("rfq_type", { length: 20 }) + .$type<"INITIAL" | "FINAL">() + .notNull(), // initial_rfq 또는 final_rfq 구분 + + rfqRecordId: integer("rfq_record_id").notNull(), // initialRfq.id 또는 finalRfq.id + + responseStatus: varchar("response_status", { length: 30 }) + .$type<"NOT_RESPONDED" | "RESPONDED" | "REVISION_REQUESTED" | "WAIVED">() + .default("NOT_RESPONDED") + .notNull(), + + currentRevision: varchar("current_revision", { length: 10 }).default("Rev.0"), + respondedRevision: varchar("responded_revision", { length: 10 }), + + responseComment: text("response_comment"), + vendorComment: text("vendor_comment"), + + // 응답 관련 날짜 + requestedAt: timestamp("requested_at").notNull(), + respondedAt: timestamp("responded_at"), + + createdAt: timestamp("created_at").defaultNow().notNull(), + updatedAt: timestamp("updated_at").defaultNow().notNull(), + },(t) => ({ + // attachmentId + vendorId + rfqType 유니크 + vendorResponseIdx: uniqueIndex('vendor_response_idx').on( + t.attachmentId.asc(), + t.vendorId.asc(), + t.rfqType.asc(), + ), + })); + +// 3. 벤더 응답 첨부파일 +export const vendorResponseAttachmentsB = pgTable( + "vendor_response_attachments_b", + { + id: serial("id").primaryKey(), + vendorResponseId: integer("vendor_response_id") + .notNull() + .references(() => vendorAttachmentResponses.id, { onDelete: "cascade" }), + + fileName: varchar("file_name", { length: 255 }).notNull(), + originalFileName: varchar("original_file_name", { length: 255 }).notNull(), + filePath: varchar("file_path", { length: 512 }).notNull(), + fileSize: integer("file_size"), + fileType: varchar("file_type", { length: 100 }), + + description: varchar("description", { length: 500 }), + + uploadedBy: integer("uploaded_by") + .references(() => users.id, { onDelete: "set null" }), + uploadedAt: timestamp("uploaded_at").defaultNow().notNull(), + }, +); + +// 4. 응답 히스토리 추적 (선택사항) +export const vendorResponseHistory = pgTable( + "vendor_response_history", + { + id: serial("id").primaryKey(), + vendorResponseId: integer("vendor_response_id") + .notNull() + .references(() => vendorAttachmentResponses.id, { onDelete: "cascade" }), + + action: varchar("action", { length: 50 }) + .$type<"REQUESTED" | "RESPONDED" | "REVISION_REQUESTED" | "REVISED" | "WAIVED">() + .notNull(), + + previousStatus: varchar("previous_status", { length: 30 }), + newStatus: varchar("new_status", { length: 30 }), + + comment: text("comment"), + + actionBy: integer("action_by") + .references(() => users.id, { onDelete: "set null" }), + actionAt: timestamp("action_at").defaultNow().notNull(), + }, +); + +// === 유용한 뷰들 === + +// 1. bRfqs 기본 마스터 뷰 (프로젝트 정보 포함) +export const bRfqsMasterView = pgView("b_rfqs_master", { + rfqId: integer("rfq_id"), + rfqCode: varchar("rfq_code", { length: 50 }), + description: varchar("description", { length: 255 }), + status: varchar("status", { length: 30 }), + dueDate: date("due_date"), + picCode: varchar("pic_code", { length: 50 }), + picName: varchar("pic_name", { length: 50 }), + EngPicName: varchar("eng_pic_name", { length: 50 }), + packageNo: varchar("package_no", { length: 50 }), + packageName: varchar("package_name", { length: 255 }), + projectId: integer("project_id"), + projectCode: varchar("project_code", { length: 50 }), + projectName: text("project_name"), + projectType: varchar("project_type", { length: 20 }), + projectCompany: varchar("project_company", { length: 255 }), + projectFlag: varchar("project_flag", { length: 255 }), + projectSite: varchar("project_site", { length: 255 }), + totalAttachments: integer("total_attachments"), + createdAt: timestamp("created_at"), + updatedAt: timestamp("updated_at"), +}).as(sql` + SELECT + br.id as rfq_id, + br.rfq_code, + br.description, + br.status, + br.due_date, + br.pic_code, + br.pic_name, + br.eng_pic_name, + br.package_no, + br.package_name, + br.project_id, + p.code as project_code, + p.name as project_name, + p.type as project_type, + br.project_company, + br.project_flag, + br.project_site, + COALESCE(att_count.total_attachments, 0) as total_attachments, + br.created_at, + br.updated_at + FROM b_rfqs br + LEFT JOIN projects p ON br.project_id = p.id + LEFT JOIN ( + SELECT rfq_id, COUNT(*) as total_attachments + FROM b_rfq_attachments + GROUP BY rfq_id + ) att_count ON br.id = att_count.rfq_id +`); + +// 2. Initial RFQ 상세 뷰 (벤더, 인코텀즈 정보 포함) +export const initialRfqDetailView = pgView("initial_rfq_detail", { + rfqId: integer("rfq_id"), + rfqCode: varchar("rfq_code", { length: 50 }), + rfqStatus: varchar("rfq_status", { length: 30 }), + initialRfqId: integer("initial_rfq_id"), + initialRfqStatus: varchar("initial_rfq_status", { length: 30 }), + vendorId: integer("vendor_id"), + vendorCode: varchar("vendor_code", { length: 50 }), + vendorName: varchar("vendor_name", { length: 255 }), + vendorCountry: varchar("vendor_country", { length: 100 }), + vendorBusinessSize: varchar("vendor_business_size", { length: 50 }), + dueDate: date("due_date"), + validDate: date("valid_date"), + incotermsCode: varchar("incoterms_code", { length: 20 }), + incotermsDescription: varchar("incoterms_description", { length: 255 }), + shortList: boolean("short_list"), + returnYn: boolean("return_yn"), + cpRequestYn: boolean("cp_request_yn"), + prjectGtcYn: boolean("prject_gtc_yn"), + returnRevision: integer("return_revision"), + gtc: varchar("gtc", { length: 255 }), + gtcValidDate: varchar("gtc_valid_date", { length: 255 }), + classification: varchar("classification", { length: 255 }), + sparepart: varchar("sparepart", { length: 255 }), + createdAt: timestamp("created_at"), + updatedAt: timestamp("updated_at"), +}).as(sql` + SELECT + br.id as rfq_id, + br.rfq_code, + br.status as rfq_status, + ir.id as initial_rfq_id, + ir.initial_rfq_status, + ir.vendor_id, + v.vendor_code, + v.vendor_name, + v.country as vendor_country, + v.business_size as vendor_business_size, + ir.due_date, + ir.valid_date, + ir.incoterms_code, + inc.description as incoterms_description, + ir.short_list, + ir.return_yn, + ir.cp_request_yn, + ir.prject_gtc_yn, + ir.return_revision, + ir.gtc, + ir.gtc_valid_date, + ir.classification, + ir.sparepart, + ir.created_at, + ir.updated_at + FROM b_rfqs br + JOIN initial_rfq ir ON br.id = ir.rfq_id + LEFT JOIN vendors v ON ir.vendor_id = v.id + LEFT JOIN incoterms inc ON ir.incoterms_code = inc.code +`); + +// 3. Final RFQ 상세 뷰 (벤더, 인코텀즈, 결제조건 정보 포함) +export const finalRfqDetailView = pgView("final_rfq_detail", { + rfqId: integer("rfq_id"), + rfqCode: varchar("rfq_code", { length: 50 }), + rfqStatus: varchar("rfq_status", { length: 30 }), + finalRfqId: integer("final_rfq_id"), + finalRfqStatus: varchar("final_rfq_status", { length: 30 }), + vendorId: integer("vendor_id"), + vendorCode: varchar("vendor_code", { length: 50 }), + vendorName: varchar("vendor_name", { length: 255 }), + vendorCountry: varchar("vendor_country", { length: 100 }), + vendorBusinessSize: varchar("vendor_business_size", { length: 50 }), + dueDate: date("due_date"), + validDate: date("valid_date"), + deliveryDate: date("delivery_date"), + incotermsCode: varchar("incoterms_code", { length: 20 }), + incotermsDescription: varchar("incoterms_description", { length: 255 }), + paymentTermsCode: varchar("payment_terms_code", { length: 50 }), + paymentTermsDescription: varchar("payment_terms_description", { length: 255 }), + currency: varchar("currency", { length: 10 }), + taxCode: varchar("tax_code", { length: 255 }), + placeOfShipping: varchar("place_of_shipping", { length: 255 }), + placeOfDestination: varchar("place_of_destination", { length: 255 }), + shortList: boolean("short_list"), + returnYn: boolean("return_yn"), + cpRequestYn: boolean("cp_request_yn"), + prjectGtcYn: boolean("prject_gtc_yn"), + firsttimeYn: boolean("firsttime_yn"), + materialPriceRelatedYn: boolean("material_price_related_yn"), + returnRevision: integer("return_revision"), + gtc: varchar("gtc", { length: 255 }), + gtcValidDate: varchar("gtc_valid_date", { length: 255 }), + classification: varchar("classification", { length: 255 }), + sparepart: varchar("sparepart", { length: 255 }), + remark: text("remark"), + vendorRemark: text("vendor_remark"), + createdAt: timestamp("created_at"), + updatedAt: timestamp("updated_at"), +}).as(sql` + SELECT + br.id as rfq_id, + br.rfq_code, + br.status as rfq_status, + fr.id as final_rfq_id, + fr.final_rfq_status, + fr.vendor_id, + v.vendor_code, + v.vendor_name, + v.country as vendor_country, + v.business_size as vendor_business_size, + fr.due_date, + fr.valid_date, + fr.delivery_date, + fr.incoterms_code, + inc.description as incoterms_description, + fr.payment_terms_code, + pt.description as payment_terms_description, + fr.currency, + fr.tax_code, + fr.place_of_shipping, + fr.place_of_destination, + fr.short_list, + fr.return_yn, + fr.cp_request_yn, + fr.prject_gtc_yn, + fr.firsttime_yn, + fr.material_price_related_yn, + fr.return_revision, + fr.gtc, + fr.gtc_valid_date, + fr.classification, + fr.sparepart, + fr.remark, + fr.vendor_remark, + fr.created_at, + fr.updated_at + FROM b_rfqs br + JOIN final_rfq fr ON br.id = fr.rfq_id + LEFT JOIN vendors v ON fr.vendor_id = v.id + LEFT JOIN incoterms inc ON fr.incoterms_code = inc.code + LEFT JOIN payment_terms pt ON fr.payment_terms_code = pt.code +`); + +// 4. 벤더 응답 현황 요약 뷰 +export const vendorResponseSummaryView = pgView("vendor_response_summary", { + rfqId: integer("rfq_id"), + rfqCode: varchar("rfq_code", { length: 50 }), + rfqStatus: varchar("rfq_status", { length: 30 }), + vendorId: integer("vendor_id"), + vendorCode: varchar("vendor_code", { length: 50 }), + vendorName: varchar("vendor_name", { length: 255 }), + vendorCountry: varchar("vendor_country", { length: 100 }), + vendorBusinessSize: varchar("vendor_business_size", { length: 50 }), + rfqType: varchar("rfq_type", { length: 20 }), + totalAttachments: integer("total_attachments"), + respondedCount: integer("responded_count"), + pendingCount: integer("pending_count"), + waivedCount: integer("waived_count"), + revisionRequestedCount: integer("revision_requested_count"), + responseRate: numeric("response_rate", { precision: 5, scale: 2 }), + completionRate: numeric("completion_rate", { precision: 5, scale: 2 }), +}).as(sql` + SELECT + br.id as rfq_id, + br.rfq_code, + br.status as rfq_status, + v.id as vendor_id, + v.vendor_code, + v.vendor_name, + v.country as vendor_country, + v.business_size as vendor_business_size, + var.rfq_type, + COUNT(var.id) as total_attachments, + COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) as responded_count, + COUNT(CASE WHEN var.response_status = 'NOT_RESPONDED' THEN 1 END) as pending_count, + COUNT(CASE WHEN var.response_status = 'WAIVED' THEN 1 END) as waived_count, + COUNT(CASE WHEN var.response_status = 'REVISION_REQUESTED' THEN 1 END) as revision_requested_count, + ROUND( + (COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) * 100.0 / + NULLIF(COUNT(CASE WHEN var.response_status != 'WAIVED' THEN 1 END), 0)), + 2 + ) as response_rate, + ROUND( + ((COUNT(CASE WHEN var.response_status = 'RESPONDED' THEN 1 END) + + COUNT(CASE WHEN var.response_status = 'WAIVED' THEN 1 END)) * 100.0 / COUNT(var.id)), + 2 + ) as completion_rate + FROM b_rfqs br + JOIN b_rfq_attachments bra ON br.id = bra.rfq_id + JOIN vendor_attachment_responses var ON bra.id = var.attachment_id + JOIN vendors v ON var.vendor_id = v.id + GROUP BY br.id, br.rfq_code, br.status, v.id, v.vendor_code, v.vendor_name, v.country, v.business_size, var.rfq_type +`); + +// 5. RFQ 전체 진행 현황 대시보드 뷰 +export const rfqDashboardView = pgView("rfq_dashboard", { + rfqId: integer("rfq_id"), + rfqCode: varchar("rfq_code", { length: 50 }), + description: varchar("description", { length: 255 }), + status: varchar("status", { length: 30 }), + dueDate: date("due_date"), + projectCode: varchar("project_code", { length: 50 }), + projectName: text("project_name"), + packageNo: varchar("package_no", { length: 50 }), + packageName: varchar("package_name", { length: 255 }), + picCode: varchar("pic_code", { length: 50 }), + picName: varchar("pic_name", { length: 50 }), + engPicName: varchar("eng_pic_name", { length: 50 }), + projectCompany: varchar("project_company", { length: 255 }), + projectFlag: varchar("project_flag", { length: 255 }), + projectSite: varchar("project_site", { length: 255 }), + totalAttachments: integer("total_attachments"), + initialVendorCount: integer("initial_vendor_count"), + finalVendorCount: integer("final_vendor_count"), + initialResponseRate: numeric("initial_response_rate", { precision: 5, scale: 2 }), + finalResponseRate: numeric("final_response_rate", { precision: 5, scale: 2 }), + overallProgress: numeric("overall_progress", { precision: 5, scale: 2 }), + daysToDeadline: integer("days_to_deadline"), + createdAt: timestamp("created_at"), + updatedAt: timestamp("updated_at"), + remark: text("remark"), + updatedByName: varchar("updated_by_name", { length: 255 }), + updatedByEmail: varchar("updated_by_email", { length: 255 }), +}).as(sql` + -- ② SELECT 절 확장 ------------------------------------------- + SELECT + br.id AS rfq_id, + br.rfq_code, + br.description, + br.status, + br.due_date, + p.code AS project_code, + p.name AS project_name, + br.package_no, + br.package_name, + br.pic_code, + br.pic_name, + br.eng_pic_name, + br.project_company, + br.project_flag, + br.project_site, + br.remark, + + -- 첨부/벤더 요약 ----------------------- + COALESCE(att_count.total_attachments, 0) AS total_attachments, + COALESCE(init_summary.vendor_count, 0) AS initial_vendor_count, + COALESCE(final_summary.vendor_count, 0) AS final_vendor_count, + COALESCE(init_summary.avg_response_rate, 0) AS initial_response_rate, + COALESCE(final_summary.avg_response_rate, 0) AS final_response_rate, + + -- 진행률·마감까지 일수 -------------- + CASE + WHEN br.status = 'DRAFT' THEN 0 + WHEN br.status = 'Doc. Received' THEN 10 + WHEN br.status = 'PIC Assigned' THEN 20 + WHEN br.status = 'Doc. Confirmed' THEN 30 + WHEN br.status = 'Init. RFQ Sent' THEN 40 + WHEN br.status = 'Init. RFQ Answered' THEN 50 + WHEN br.status = 'TBE started' THEN 60 + WHEN br.status = 'TBE finished' THEN 70 + WHEN br.status = 'Final RFQ Sent' THEN 80 + WHEN br.status = 'Quotation Received' THEN 90 + WHEN br.status = 'Vendor Selected' THEN 100 + ELSE 0 + END AS overall_progress, + (br.due_date - CURRENT_DATE) AS days_to_deadline, + + br.created_at, + br.updated_at, + + -- 💡 추가되는 컬럼 ------------------- + upd.name AS updated_by_name, + upd.email AS updated_by_email + FROM b_rfqs br + LEFT JOIN projects p ON br.project_id = p.id + + -- ③ 사용자 정보 조인 -------------------- + LEFT JOIN users upd ON br.updated_by = upd.id + + -- (나머지 이미 있던 JOIN 들은 그대로) ----- + LEFT JOIN ( + SELECT rfq_id, COUNT(*) AS total_attachments + FROM b_rfq_attachments + GROUP BY rfq_id + ) att_count ON br.id = att_count.rfq_id + + LEFT JOIN ( + SELECT + rfq_id, + COUNT(DISTINCT vendor_id) AS vendor_count, + AVG(response_rate) AS avg_response_rate + FROM vendor_response_summary + WHERE rfq_type = 'INITIAL' + GROUP BY rfq_id + ) init_summary ON br.id = init_summary.rfq_id + + LEFT JOIN ( + SELECT + rfq_id, + COUNT(DISTINCT vendor_id) AS vendor_count, + AVG(response_rate) AS avg_response_rate + FROM vendor_response_summary + WHERE rfq_type = 'FINAL' + GROUP BY rfq_id + ) final_summary ON br.id = final_summary.rfq_id + `); + +// 사용 예시 타입 정의 +export type VendorAttachmentResponse = typeof vendorAttachmentResponses.$inferSelect; +export type NewVendorAttachmentResponse = typeof vendorAttachmentResponses.$inferInsert; +export type AttachmentRevision = typeof bRfqAttachmentRevisions.$inferSelect; +export type ResponseAttachment = typeof vendorResponseAttachmentsB.$inferSelect; + +export type InitialRfqDetailView = typeof initialRfqDetailView.$inferSelect; +export type FinalRfqDetailView = typeof finalRfqDetailView.$inferSelect; +export type RfqDashboardView = typeof rfqDashboardView.$inferSelect; diff --git a/db/schema/index.ts b/db/schema/index.ts index 38a27393..9ed0c59e 100644 --- a/db/schema/index.ts +++ b/db/schema/index.ts @@ -16,6 +16,7 @@ export * from './procurementRFQ'; export * from './setting'; export * from './techSales'; export * from './ocr'; +export * from './bRfq'; // MDG SOAP 수신용 -export * from './MDG/modelMaster' +// export * from './MDG/modelMaster' diff --git a/db/schema/ocr.ts b/db/schema/ocr.ts index 289eb297..12382aa4 100644 --- a/db/schema/ocr.ts +++ b/db/schema/ocr.ts @@ -9,9 +9,10 @@ import { boolean, jsonb, text, - serial + serial , uniqueIndex } from 'drizzle-orm/pg-core'; import { relations } from 'drizzle-orm'; +import { users } from './users'; // OCR 세션 테이블 (전체 처리 정보) export const ocrSessions = pgTable('ocr_sessions', { @@ -57,8 +58,13 @@ export const ocrRows = pgTable('ocr_rows', { confidence: decimal('confidence', { precision: 5, scale: 4 }), // 0.0000 ~ 1.0000 sourceTable: integer('source_table'), sourceRow: integer('source_row'), + userId: integer("user_id") + .references(() => users.id, { onDelete: "set null" }), createdAt: timestamp('created_at').notNull().defaultNow(), -}); +}, (t) => ({ + // tableId + reportNo + no 조합이 유일 + uniqReportAndNo: uniqueIndex('idx_ocr_report_no_unique').on(t.reportNo, t.no, t.tagNo, t.jointNo, t.jointType), +})); // 회전 시도 결과 export const ocrRotationAttempts = pgTable('ocr_rotation_attempts', { diff --git a/db/schema/vendorDocu.ts b/db/schema/vendorDocu.ts index ebae7630..a3138fd5 100644 --- a/db/schema/vendorDocu.ts +++ b/db/schema/vendorDocu.ts @@ -141,6 +141,8 @@ export const revisions = pgTable( uploaderType: varchar("uploader_type", { length: 20 }).notNull().default("vendor"), uploaderId: integer("uploader_id"), uploaderName: varchar("uploader_name", { length: 100 }), + + usage:varchar("usage", { length: 100 }), // 확장된 상태 관리 revisionStatus: varchar("revision_status", { length: 50 }) @@ -175,6 +177,7 @@ export const revisions = pgTable( ) // 기존 documentAttachments (변경 없음) + export const documentAttachments = pgTable( "document_attachments", { @@ -186,6 +189,14 @@ export const documentAttachments = pgTable( filePath: varchar("file_path", { length: 1024 }).notNull(), fileType: varchar("file_type", { length: 50 }), fileSize: integer("file_size"), + + // DOLCE 연동 관련 필드 추가 + uploadId: varchar("upload_id", { length: 36 }), // UUID 형태 + fileId: varchar("file_id", { length: 36 }), // UUID 형태 + uploadedBy: varchar("uploaded_by", { length: 255 }), // userId 저장 + dolceFilePath: varchar("dolce_file_path", { length: 1024 }), // DOLCE에서 반환하는 파일 경로 + uploadedAt: timestamp("uploaded_at"), // DOLCE 업로드 성공 시간 + createdAt: timestamp("created_at").defaultNow().notNull(), updatedAt: timestamp("updated_at").defaultNow().notNull(), } @@ -196,6 +207,7 @@ export const enhancedDocumentsView = pgView("enhanced_documents_view", { // 기본 문서 정보 documentId: integer("document_id").notNull(), docNumber: varchar("doc_number", { length: 100 }).notNull(), + drawingKind: varchar("drawing_kind", { length: 50 }), vendorDocNumber: varchar("vendor_doc_number", { length: 100 }), // ✅ 벤더 문서 번호 추가 title: varchar("title", { length: 255 }).notNull(), pic: varchar("pic", { length: 50 }), @@ -207,6 +219,14 @@ export const enhancedDocumentsView = pgView("enhanced_documents_view", { projectCode: varchar("project_code", { length: 50 }), vendorName: varchar("vendor_name", { length: 255 }), vendorCode: varchar("vendor_code", { length: 50 }), + + // ✅ B4 전용 필드들 (drawingKind가 B4일 때만 사용) + cGbn: varchar("c_gbn", { length: 50 }), // CGbn + dGbn: varchar("d_gbn", { length: 50 }), // DGbn + degreeGbn: varchar("degree_gbn", { length: 50 }), // DegreeGbn + deptGbn: varchar("dept_gbn", { length: 50 }), // DeptGbn + jGbn: varchar("j_gbn", { length: 50 }), // JGbn + sGbn: varchar("s_gbn", { length: 50 }), // SGbn // 현재 스테이지 정보 (가장 우선순위가 높은 미완료 스테이지) currentStageId: integer("current_stage_id"), @@ -253,6 +273,7 @@ export const enhancedDocumentsView = pgView("enhanced_documents_view", { uploaderId: number | null; uploaderName: string | null; comment: string | null; + usage: string | null; revisionStatus: string; submittedDate: string | null; approvedDate: string | null; @@ -377,6 +398,7 @@ export const enhancedDocumentsView = pgView("enhanced_documents_view", { 'uploaderId', r.uploader_id, 'uploaderName', r.uploader_name, 'comment', r.comment, + 'usage', r.usage, 'revisionStatus', r.revision_status, 'submittedDate', r.submitted_date, 'uploadedAt', r.uploaded_at, @@ -432,12 +454,21 @@ export const enhancedDocumentsView = pgView("enhanced_documents_view", { SELECT d.id as document_id, d.doc_number, + d.drawing_kind, d.vendor_doc_number, -- ✅ 벤더 문서 번호 추가 d.title, d.pic, d.status, d.issued_date, d.contract_id, + + d.c_gbn, + d.d_gbn, + d.degree_gbn, + d.dept_gbn, + d.s_gbn, + + -- ✅ 프로젝트 및 벤더 정보 추가 p.code as project_code, diff --git a/lib/admin-users/table/add-ausers-dialog.tsx b/lib/admin-users/table/add-ausers-dialog.tsx index dd29c190..64941965 100644 --- a/lib/admin-users/table/add-ausers-dialog.tsx +++ b/lib/admin-users/table/add-ausers-dialog.tsx @@ -82,7 +82,7 @@ export function AddUserDialog() { companyId: null, language:'en', // roles는 array, 여기서는 단일 선택 시 [role]로 담음 - roles: [], + roles: ["Vendor Admin"], domain:'partners' // domain, etc. 필요하다면 추가 }, diff --git a/lib/b-rfq/repository.ts b/lib/b-rfq/repository.ts new file mode 100644 index 00000000..e69de29b diff --git a/lib/b-rfq/service.ts b/lib/b-rfq/service.ts new file mode 100644 index 00000000..f64eb46c --- /dev/null +++ b/lib/b-rfq/service.ts @@ -0,0 +1,291 @@ +'use server' + +import { revalidateTag, unstable_cache } from "next/cache" +import { count, desc, asc, and, or, gte, lte, ilike, eq } from "drizzle-orm" +import { filterColumns } from "@/lib/filter-columns" +import db from "@/db/db" +import { RfqDashboardView, bRfqs, projects, users } from "@/db/schema" // 실제 스키마 import 경로에 맞게 수정 +import { rfqDashboardView } from "@/db/schema" // 뷰 import +import type { SQL } from "drizzle-orm" +import { CreateRfqInput, GetRFQDashboardSchema, createRfqServerSchema } from "./validations" + +export async function getRFQDashboard(input: GetRFQDashboardSchema) { + return unstable_cache( + async () => { + try { + const offset = (input.page - 1) * input.perPage; + + const rfqFilterMapping = createRFQFilterMapping(); + const joinedTables = getRFQJoinedTables(); + + // 1) 고급 필터 조건 + let advancedWhere: SQL | undefined = undefined; + if (input.filters && input.filters.length > 0) { + advancedWhere = filterColumns({ + table: rfqDashboardView, + filters: input.filters, + joinOperator: input.joinOperator || 'and', + joinedTables, + customColumnMapping: rfqFilterMapping, + }); + } + + // 2) 기본 필터 조건 + let basicWhere: SQL | undefined = undefined; + if (input.basicFilters && input.basicFilters.length > 0) { + basicWhere = filterColumns({ + table: rfqDashboardView, + filters: input.basicFilters, + joinOperator: input.basicJoinOperator || 'and', + joinedTables, + customColumnMapping: rfqFilterMapping, + }); + } + + // 3) 글로벌 검색 조건 + let globalWhere: SQL | undefined = undefined; + if (input.search) { + const s = `%${input.search}%`; + + const validSearchConditions: SQL[] = []; + + const rfqCodeCondition = ilike(rfqDashboardView.rfqCode, s); + if (rfqCodeCondition) validSearchConditions.push(rfqCodeCondition); + + const descriptionCondition = ilike(rfqDashboardView.description, s); + if (descriptionCondition) validSearchConditions.push(descriptionCondition); + + const projectNameCondition = ilike(rfqDashboardView.projectName, s); + if (projectNameCondition) validSearchConditions.push(projectNameCondition); + + const projectCodeCondition = ilike(rfqDashboardView.projectCode, s); + if (projectCodeCondition) validSearchConditions.push(projectCodeCondition); + + const picNameCondition = ilike(rfqDashboardView.picName, s); + if (picNameCondition) validSearchConditions.push(picNameCondition); + + const packageNoCondition = ilike(rfqDashboardView.packageNo, s); + if (packageNoCondition) validSearchConditions.push(packageNoCondition); + + const packageNameCondition = ilike(rfqDashboardView.packageName, s); + if (packageNameCondition) validSearchConditions.push(packageNameCondition); + + if (validSearchConditions.length > 0) { + globalWhere = or(...validSearchConditions); + } + } + + + + // 6) 최종 WHERE 조건 생성 + const whereConditions: SQL[] = []; + + if (advancedWhere) whereConditions.push(advancedWhere); + if (basicWhere) whereConditions.push(basicWhere); + if (globalWhere) whereConditions.push(globalWhere); + + const finalWhere = whereConditions.length > 0 ? and(...whereConditions) : undefined; + + // 7) 전체 데이터 수 조회 + const totalResult = await db + .select({ count: count() }) + .from(rfqDashboardView) + .where(finalWhere); + + const total = totalResult[0]?.count || 0; + + if (total === 0) { + return { data: [], pageCount: 0, total: 0 }; + } + + console.log(total) + + // 8) 정렬 및 페이징 처리된 데이터 조회 + const orderByColumns = input.sort.map((sort) => { + const column = sort.id as keyof typeof rfqDashboardView.$inferSelect; + return sort.desc ? desc(rfqDashboardView[column]) : asc(rfqDashboardView[column]); + }); + + if (orderByColumns.length === 0) { + orderByColumns.push(desc(rfqDashboardView.createdAt)); + } + + const rfqData = await db + .select() + .from(rfqDashboardView) + .where(finalWhere) + .orderBy(...orderByColumns) + .limit(input.perPage) + .offset(offset); + + const pageCount = Math.ceil(total / input.perPage); + + return { data: rfqData, pageCount, total }; + } catch (err) { + console.error("Error in getRFQDashboard:", err); + return { data: [], pageCount: 0, total: 0 }; + } + }, + [JSON.stringify(input)], + { + revalidate: 3600, + tags: ["rfq-dashboard"], + } + )(); +} + +// 헬퍼 함수들 +function createRFQFilterMapping() { + return { + // 뷰의 컬럼명과 실제 필터링할 컬럼 매핑 + rfqCode: rfqDashboardView.rfqCode, + description: rfqDashboardView.description, + status: rfqDashboardView.status, + projectName: rfqDashboardView.projectName, + projectCode: rfqDashboardView.projectCode, + picName: rfqDashboardView.picName, + packageNo: rfqDashboardView.packageNo, + packageName: rfqDashboardView.packageName, + dueDate: rfqDashboardView.dueDate, + overallProgress: rfqDashboardView.overallProgress, + createdAt: rfqDashboardView.createdAt, + }; +} + +function getRFQJoinedTables() { + return { + // 조인된 테이블 정보 (뷰이므로 실제로는 사용되지 않을 수 있음) + projects, + users, + }; +} + +// ================================================================ +// 3. RFQ Dashboard 타입 정의 +// ================================================================ + +async function generateNextSerial(picCode: string): Promise { + try { + // 해당 picCode로 시작하는 RFQ 개수 조회 + const existingCount = await db + .select({ count: count() }) + .from(bRfqs) + .where(eq(bRfqs.picCode, picCode)) + + const nextSerial = (existingCount[0]?.count || 0) + 1 + return nextSerial.toString().padStart(5, '0') // 5자리로 패딩 + } catch (error) { + console.error("시리얼 번호 생성 오류:", error) + return "00001" // 기본값 + } + } + export async function createRfqAction(input: CreateRfqInput) { + try { + // 입력 데이터 검증 + const validatedData = createRfqServerSchema.parse(input) + + // RFQ 코드 자동 생성: N + picCode + 시리얼5자리 + const serialNumber = await generateNextSerial(validatedData.picCode) + const rfqCode = `N${validatedData.picCode}${serialNumber}` + + // 데이터베이스에 삽입 + const result = await db.insert(bRfqs).values({ + rfqCode, + projectId: validatedData.projectId, + dueDate: validatedData.dueDate, + status: "DRAFT", + picCode: validatedData.picCode, + picName: validatedData.picName || null, + EngPicName: validatedData.engPicName || null, + packageNo: validatedData.packageNo || null, + packageName: validatedData.packageName || null, + remark: validatedData.remark || null, + projectCompany: validatedData.projectCompany || null, + projectFlag: validatedData.projectFlag || null, + projectSite: validatedData.projectSite || null, + createdBy: validatedData.createdBy, + updatedBy: validatedData.updatedBy, + }).returning({ + id: bRfqs.id, + rfqCode: bRfqs.rfqCode, + }) + + // 관련 페이지 캐시 무효화 + revalidateTag("rfq-dashboard") + + + return { + success: true, + data: result[0], + message: "RFQ가 성공적으로 생성되었습니다", + } + + } catch (error) { + console.error("RFQ 생성 오류:", error) + + + return { + success: false, + error: "RFQ 생성에 실패했습니다", + } + } + } + + // RFQ 코드 중복 확인 액션 + export async function checkRfqCodeExists(rfqCode: string) { + try { + const existing = await db.select({ id: bRfqs.id }) + .from(bRfqs) + .where(eq(bRfqs.rfqCode, rfqCode)) + .limit(1) + + return existing.length > 0 + } catch (error) { + console.error("RFQ 코드 확인 오류:", error) + return false + } + } + + // picCode별 다음 예상 RFQ 코드 미리보기 + export async function previewNextRfqCode(picCode: string) { + try { + const serialNumber = await generateNextSerial(picCode) + return `N${picCode}${serialNumber}` + } catch (error) { + console.error("RFQ 코드 미리보기 오류:", error) + return `N${picCode}00001` + } + } + +const getBRfqById = async (id: number): Promise => { + // 1) RFQ 단건 조회 + const rfqsRes = await db + .select() + .from(rfqDashboardView) + .where(eq(rfqDashboardView.rfqId, id)) + .limit(1); + + if (rfqsRes.length === 0) return null; + const rfqRow = rfqsRes[0]; + + // 3) RfqWithItems 형태로 반환 + const result: RfqDashboardView = { + ...rfqRow, + + }; + + return result; + }; + + + export const findBRfqById = async (id: number): Promise => { + try { + + const rfq = await getBRfqById(id); + + return rfq; + } catch (error) { + throw new Error('Failed to fetch user'); + } + }; + \ No newline at end of file diff --git a/lib/b-rfq/summary-table/add-new-rfq-dialog.tsx b/lib/b-rfq/summary-table/add-new-rfq-dialog.tsx new file mode 100644 index 00000000..2333d9cf --- /dev/null +++ b/lib/b-rfq/summary-table/add-new-rfq-dialog.tsx @@ -0,0 +1,523 @@ +"use client" + +import * as React from "react" +import { useForm } from "react-hook-form" +import { zodResolver } from "@hookform/resolvers/zod" +import { z } from "zod" +import { format } from "date-fns" +import { CalendarIcon, Plus, Loader2, Eye } from "lucide-react" +import { useRouter } from "next/navigation" +import { useSession } from "next-auth/react" + +import { Button } from "@/components/ui/button" +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog" +import { + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, + FormDescription, +} from "@/components/ui/form" +import { Input } from "@/components/ui/input" +import { Textarea } from "@/components/ui/textarea" +import { + Popover, + PopoverContent, + PopoverTrigger, +} from "@/components/ui/popover" +import { Calendar } from "@/components/ui/calendar" +import { Badge } from "@/components/ui/badge" +import { cn } from "@/lib/utils" +import { toast } from "sonner" +import { ProjectSelector } from "@/components/ProjectSelector" +import { createRfqAction, previewNextRfqCode } from "../service" + +export type Project = { + id: number; + projectCode: string; + projectName: string; +} + +// 클라이언트 폼 스키마 (projectId 필수로 변경) +const createRfqSchema = z.object({ + projectId: z.number().min(1, "프로젝트를 선택해주세요"), // 필수로 변경 + dueDate: z.date({ + required_error: "마감일을 선택해주세요", + }), + picCode: z.string().min(1, "구매 담당자 코드를 입력해주세요"), + picName: z.string().optional(), + engPicName: z.string().optional(), + packageNo: z.string().min(1, "패키지 번호를 입력해주세요"), + packageName: z.string().min(1, "패키지명을 입력해주세요"), + remark: z.string().optional(), + projectCompany: z.string().optional(), + projectFlag: z.string().optional(), + projectSite: z.string().optional(), +}) + +type CreateRfqFormValues = z.infer + +interface CreateRfqDialogProps { + onSuccess?: () => void; +} + +export function CreateRfqDialog({ onSuccess }: CreateRfqDialogProps) { + const [open, setOpen] = React.useState(false) + const [isLoading, setIsLoading] = React.useState(false) + const [previewCode, setPreviewCode] = React.useState("") + const [isLoadingPreview, setIsLoadingPreview] = React.useState(false) + const router = useRouter() + const { data: session } = useSession() + + const userId = React.useMemo(() => { + return session?.user?.id ? Number(session.user.id) : null; + }, [session]); + + const form = useForm({ + resolver: zodResolver(createRfqSchema), + defaultValues: { + projectId: undefined, + dueDate: undefined, + picCode: "", + picName: "", + engPicName: "", + packageNo: "", + packageName: "", + remark: "", + projectCompany: "", + projectFlag: "", + projectSite: "", + }, + }) + + // picCode 변경 시 미리보기 업데이트 + const watchedPicCode = form.watch("picCode") + + React.useEffect(() => { + if (watchedPicCode && watchedPicCode.length > 0) { + setIsLoadingPreview(true) + const timer = setTimeout(async () => { + try { + const preview = await previewNextRfqCode(watchedPicCode) + setPreviewCode(preview) + } catch (error) { + console.error("미리보기 오류:", error) + setPreviewCode("") + } finally { + setIsLoadingPreview(false) + } + }, 500) // 500ms 디바운스 + + return () => clearTimeout(timer) + } else { + setPreviewCode("") + } + }, [watchedPicCode]) + + // 다이얼로그 열림/닫힘 처리 및 폼 리셋 + const handleOpenChange = (newOpen: boolean) => { + setOpen(newOpen) + + // 다이얼로그가 닫힐 때 폼과 상태 초기화 + if (!newOpen) { + form.reset() + setPreviewCode("") + setIsLoadingPreview(false) + } + } + + const handleCancel = () => { + form.reset() + setOpen(false) + } + + + const onSubmit = async (data: CreateRfqFormValues) => { + if (!userId) { + toast.error("로그인이 필요합니다") + return + } + + setIsLoading(true) + + try { + // 서버 액션 호출 - Date 객체를 직접 전달 + const result = await createRfqAction({ + projectId: data.projectId, // 이제 항상 값이 있음 + dueDate: data.dueDate, // Date 객체 직접 전달 + picCode: data.picCode, + picName: data.picName || "", + engPicName: data.engPicName || "", + packageNo: data.packageNo, + packageName: data.packageName, + remark: data.remark || "", + projectCompany: data.projectCompany || "", + projectFlag: data.projectFlag || "", + projectSite: data.projectSite || "", + createdBy: userId, + updatedBy: userId, + }) + + if (result.success) { + toast.success(result.message, { + description: `RFQ 코드: ${result.data?.rfqCode}`, + }) + + // 다이얼로그 닫기 (handleOpenChange에서 리셋 처리됨) + setOpen(false) + + // 성공 콜백 실행 + if (onSuccess) { + onSuccess() + } + + } else { + toast.error(result.error || "RFQ 생성에 실패했습니다") + } + + } catch (error) { + console.error('RFQ 생성 오류:', error) + toast.error("RFQ 생성에 실패했습니다", { + description: "알 수 없는 오류가 발생했습니다", + }) + } finally { + setIsLoading(false) + } + } + + const handleProjectSelect = (project: Project | null) => { + if (project === null) { + form.setValue("projectId", undefined as any); // 타입 에러 방지 + return; + } + form.setValue("projectId", project.id); + }; + + return ( + + + + + + {/* 고정된 헤더 */} + + 새 RFQ 생성 + + 새로운 RFQ를 생성합니다. 필수 정보를 입력해주세요. + + + + {/* 스크롤 가능한 컨텐츠 영역 */} +
    +
    + + + {/* 프로젝트 선택 (필수) */} + ( + + + 프로젝트 * + + + + + + + )} + /> + + {/* 마감일 (필수) */} + ( + + + 마감일 * + + + + + + + + + + date < new Date() || date < new Date("1900-01-01") + } + initialFocus + /> + + + + + )} + /> + + {/* 구매 담당자 코드 (필수) + 미리보기 */} + ( + + + 구매 담당자 코드 * + + +
    + + {/* RFQ 코드 미리보기 */} + {previewCode && ( +
    + + + 생성될 RFQ 코드: + + + {isLoadingPreview ? "생성 중..." : previewCode} + +
    + )} +
    +
    + + RFQ 코드는 N + 담당자코드 + 시리얼번호(5자리) 형식으로 자동 생성됩니다 + + +
    + )} + /> + + {/* 담당자 정보 (두 개 나란히) */} +
    +

    담당자 정보

    +
    + {/* 구매 담당자 */} + ( + + 구매 담당자명 + + + + + + )} + /> + + {/* 설계 담당자 */} + ( + + 설계 담당자명 + + + + + + )} + /> +
    +
    + + {/* 패키지 정보 (두 개 나란히) - 필수 */} +
    +

    패키지 정보

    +
    + {/* 패키지 번호 (필수) */} + ( + + + 패키지 번호 * + + + + + + + )} + /> + + {/* 패키지명 (필수) */} + ( + + + 패키지명 * + + + + + + + )} + /> +
    +
    + + {/* 프로젝트 상세 정보 */} +
    +

    프로젝트 상세 정보

    +
    + ( + + 프로젝트 회사 + + + + + + )} + /> + +
    + ( + + 프로젝트 플래그 + + + + + + )} + /> + + ( + + 프로젝트 사이트 + + + + + + )} + /> +
    +
    +
    + + {/* 비고 */} + ( + + 비고 + +