/* CVH Seems logoUploaded needs to be VARCHAR, no script */
IF EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name      = N'logoUploaded'
      AND Object_ID = Object_ID(N'pal_Setup'))
BEGIN
    ALTER TABLE pal_Setup
	ALTER COLUMN logoUploaded VARCHAR(500) NULL
END


IF EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name      = N'bankName'
      AND Object_ID = Object_ID(N'pal_Setup'))
BEGIN
    ALTER TABLE pal_Setup
	DROP COLUMN bankName 
END


IF EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name      = N'bankAccountNumber'
      AND Object_ID = Object_ID(N'pal_Setup'))
BEGIN
    ALTER TABLE pal_Setup
	DROP COLUMN bankAccountNumber 
END


IF EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name      = N'bankBranch'
      AND Object_ID = Object_ID(N'pal_Setup'))
BEGIN
    ALTER TABLE pal_Setup
	DROP COLUMN bankBranch 
END


IF EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name      = N'bankBranchCode'
      AND Object_ID = Object_ID(N'pal_Setup'))
BEGIN
    ALTER TABLE pal_Setup
	DROP COLUMN bankBranchCode 
END


IF EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name      = N'bankSwift'
      AND Object_ID = Object_ID(N'pal_Setup'))
BEGIN
    ALTER TABLE pal_Setup
	DROP COLUMN bankSwift 
END


IF NOT EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name      = N'notesQuotes'
      AND Object_ID = Object_ID(N'pal_Setup'))
BEGIN
    ALTER TABLE pal_Setup
	ADD notesQuotes VARCHAR(MAX)
END


IF NOT EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name      = N'notesInvoices'
      AND Object_ID = Object_ID(N'pal_Setup'))
BEGIN
    ALTER TABLE pal_Setup
	ADD notesInvoices VARCHAR(MAX)
END


IF NOT EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name      = N'notesReceipts'
      AND Object_ID = Object_ID(N'pal_Setup'))
BEGIN
    ALTER TABLE pal_Setup
	ADD notesReceipts VARCHAR(MAX)
END


IF NOT EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name      = N'notesCreditNotes'
      AND Object_ID = Object_ID(N'pal_Setup'))
BEGIN
    ALTER TABLE pal_Setup
	ADD notesCreditNotes VARCHAR(MAX)
END
