Spaces:
Running
Running
File size: 726 Bytes
7a2fa70 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | -- Migration: Make PO optional in GRN tables
-- This allows creating GRNs without requiring a Purchase Order
-- Step 1: Make po_id nullable in scm_grn table
ALTER TABLE scm_grn
ALTER COLUMN po_id DROP NOT NULL;
-- Step 2: Make po_item_id nullable in scm_grn_item table
ALTER TABLE scm_grn_item
ALTER COLUMN po_item_id DROP NOT NULL;
-- Step 3: Make batch_no nullable in scm_grn_item table
ALTER TABLE scm_grn_item
ALTER COLUMN batch_no DROP NOT NULL;
-- Verify the changes
SELECT
table_name,
column_name,
is_nullable,
data_type
FROM information_schema.columns
WHERE table_name IN ('scm_grn', 'scm_grn_item')
AND column_name IN ('po_id', 'po_item_id', 'batch_no')
ORDER BY table_name, column_name; |