# Publishing logical replication from Neon

## The trap
The toggle looks harmless in the Console. It is not: enabling logical replication changes `wal_level` from `replica` to `logical` for all databases in the project, it cannot be reverted, and it restarts all computes, dropping every active connection.

## The rule
1. Plan a maintenance window. Warn stakeholders: connections will drop and reconnect.
2. Enable logical replication on the project (Console project settings, CLI, or API).
3. Create the publication and replication slot on the publisher:
```sql
CREATE PUBLICATION [pub-name] FOR TABLES [table1], [table2];
SELECT pg_create_logical_replication_slot('[slot-name]', 'pgoutput');
```
4. On the subscriber, create the subscription with `create_slot = false` and the slot name, because you created the slot manually.
5. Critical: the subscriber must connect with the direct connection string. Logical replication needs a persistent connection; the `-pooler` hostname will not work.

## Checklist
- Irreversible wal_level change: be sure before enabling.
- Subscriber connection string: direct, no `-pooler`.
- If you use IP Allow, add the subscriber's IPs to the list.
- Tables need a replica identity (primary key) for updates/deletes to replicate.