first commit
This commit is contained in:
commit
c9fb67e751
423 files changed
+53287
No files matched your search
@@ -0,0 +1,23 @@
|
||||
-- Criar tipo temporário com todos os valores
|
||||
CREATE TYPE "StatusPagamento_new" AS ENUM ('PENDENTE', 'PARCIALMENTE_PAGO', 'PAGO', 'VENCIDO', 'CANCELADO');
|
||||
|
||||
-- Converter a coluna antiga para a nova
|
||||
ALTER TABLE "parcelas_honorario"
|
||||
ALTER COLUMN status TYPE "StatusPagamento_new"
|
||||
USING status::text::"StatusPagamento_new";
|
||||
|
||||
-- Remover o tipo antigo
|
||||
DROP TYPE "StatusPagamento";
|
||||
|
||||
-- Renomear o novo tipo para o nome original
|
||||
ALTER TYPE "StatusPagamento_new" RENAME TO "StatusPagamento";
|
||||
|
||||
-- Adicionar a coluna valorPago se ela não existir
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM information_schema.columns
|
||||
WHERE table_name = 'parcelas_honorario'
|
||||
AND column_name = 'valorpago') THEN
|
||||
ALTER TABLE "parcelas_honorario" ADD COLUMN "valorPago" DECIMAL(10,2);
|
||||
END IF;
|
||||
END $$;
|
||||
Reference in new issue
Block a user