-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.sql
More file actions
18 lines (13 loc) · 689 Bytes
/
Copy pathinit.sql
File metadata and controls
18 lines (13 loc) · 689 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
CREATE TABLE contratos (
id SERIAL PRIMARY KEY,
numero VARCHAR(50) NOT NULL,
valor DECIMAL(15, 2) NOT NULL,
status VARCHAR(20) NOT NULL,
criado_em TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO contratos (numero, valor, status) VALUES ('CTR-2026/001', 150000.00, 'ATIVO');
CREATE ROLE cdc_user WITH REPLICATION LOGIN PASSWORD 'cdc_password';
GRANT USAGE ON SCHEMA public TO cdc_user;
GRANT SELECT ON contratos TO cdc_user;
CREATE PUBLICATION cdc_publication FOR TABLE contratos;
SELECT pg_create_logical_replication_slot('cdc_slot', 'pgoutput');