-- Add audit fields for fiscal year state transitions
-- Tracks who and when reopened/locked fiscal years

ALTER TABLE fiscal_year_read_models
ADD COLUMN IF NOT EXISTS reopened_date TIMESTAMPTZ,
ADD COLUMN IF NOT EXISTS reopened_by VARCHAR(255),
ADD COLUMN IF NOT EXISTS locked_date TIMESTAMPTZ,
ADD COLUMN IF NOT EXISTS locked_by VARCHAR(255);

-- Add comment for documentation
COMMENT ON COLUMN fiscal_year_read_models.reopened_date IS 'Timestamp when the fiscal year was last reopened';
COMMENT ON COLUMN fiscal_year_read_models.reopened_by IS 'User who reopened the fiscal year';
COMMENT ON COLUMN fiscal_year_read_models.locked_date IS 'Timestamp when the fiscal year was locked';
COMMENT ON COLUMN fiscal_year_read_models.locked_by IS 'User who locked the fiscal year';
