-- Database Migration Script for Refund System
-- Run this on existing Petstoredb to add refund functionality

USE Petstoredb;

-- Add refund columns to sale table
ALTER TABLE sale
  ADD COLUMN isRefund BOOLEAN DEFAULT FALSE NOT NULL,
  ADD COLUMN originalSaleId INT NULL,
  ADD CONSTRAINT fk_original_sale
    FOREIGN KEY (originalSaleId) REFERENCES sale(saleId);

-- Verify the changes
DESCRIBE sale;
