first commit
This commit is contained in:
commit
c9fb67e751
423 files changed
+53287
No files matched your search
@@ -0,0 +1,30 @@
|
||||
-- Adicionar novas colunas sem remover as antigas
|
||||
ALTER TABLE "processos"
|
||||
ADD COLUMN IF NOT EXISTS "tribunalUF" VARCHAR(20),
|
||||
ADD COLUMN IF NOT EXISTS "tribunal" VARCHAR(50),
|
||||
ADD COLUMN IF NOT EXISTS "numeroOriginal" VARCHAR(50);
|
||||
|
||||
-- Migrar dados existentes mantendo os dados antigos
|
||||
UPDATE "processos"
|
||||
SET
|
||||
"tribunalUF" =
|
||||
CASE
|
||||
WHEN "orgaoJulgador" LIKE '%TJTO%' THEN 'TO'
|
||||
WHEN "orgaoJulgador" LIKE '%TRF1%' THEN 'DF'
|
||||
ELSE 'TO'
|
||||
END
|
||||
WHERE "tribunalUF" IS NULL;
|
||||
|
||||
UPDATE "processos"
|
||||
SET
|
||||
"tribunal" =
|
||||
CASE
|
||||
WHEN "orgaoJulgador" LIKE '%TJTO%' THEN 'TJTO'
|
||||
WHEN "orgaoJulgador" LIKE '%TRF1%' THEN 'TRF1'
|
||||
ELSE 'TJTO'
|
||||
END
|
||||
WHERE "tribunal" IS NULL;
|
||||
|
||||
-- Criar índices sem interferir nos existentes
|
||||
CREATE INDEX IF NOT EXISTS "idx_processos_tribunal" ON "processos"("tribunal");
|
||||
CREATE INDEX IF NOT EXISTS "idx_processos_tribunalUF" ON "processos"("tribunalUF");
|
||||
Reference in new issue
Block a user