Files
spring-messaging-demo/debezium-cdc/sql/init.sql
T

31 lines
1.0 KiB
SQL

-- Two tables: a plain business table, and an outbox table used in the last section.
CREATE TABLE orders (
id bigint PRIMARY KEY,
customer text NOT NULL,
status text NOT NULL,
amount_cents integer NOT NULL
);
CREATE TABLE outbox (
id uuid PRIMARY KEY,
aggregatetype text NOT NULL,
aggregateid text NOT NULL,
type text NOT NULL,
payload jsonb NOT NULL
);
-- Seed rows that exist BEFORE any connector starts, so the initial snapshot has something to read.
INSERT INTO orders VALUES (1, 'asha', 'NEW', 1500), (2, 'ravi', 'NEW', 2500);
-- A table nobody captures. Writing to it still produces WAL, which matters in the "slot retains WAL" section.
CREATE TABLE noise (
id bigserial PRIMARY KEY,
payload text NOT NULL
);
-- Written by the connector's heartbeat.action.query so a quiet slot can still move forward (section on WAL retention).
CREATE TABLE heartbeat (
id integer PRIMARY KEY,
ts timestamptz
);