-1
In SQL Server I can use a 'if'
to check if a table has a column and depending on the return of that logical function, execute or not an instruction, as an example below:
IF COL_LENGTH('MINHA_TABELA', 'MINHA_COLUNA') IS NULL
BEGIN
PRINT N'ALTER MINHA_TABELA RENAME COLUMN MINHA_COLUNA'
ALTER TABLE [dbo].[MINHA_TABELA] ADD [MINHA_COLUNA] [INT] NULL;
END
GO
I tried to find something similar for Postgres and I couldn’t, someone knows how to do something similar in this kind of bank?