How to Configure Neon Drop Table Protection

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up neon drop table protection by separating table ownership from daily user roles. You also turn on branch rules in the project control panel. Engineering teams often share a single default database role for both apps and manual work. When everyone uses the table owner role, any mistyped query can delete production data. Limiting who owns a table is the first step to safe database management. How native neon drop table protection works Neon runs on Postgres, so table removal rules fo

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up neon drop table protection by separating table ownership from daily user roles. You also turn on branch rules in the project control panel.

Engineering teams often share a single default database role for both apps and manual work. When everyone uses the table owner role, any mistyped query can delete production data. Limiting who owns a table is the first step to safe database management.

How native neon drop table protection works

Neon runs on Postgres, so table removal rules follow standard Postgres ownership models. In Postgres, only the table owner or a superuser can drop a table. When you create a new project, the platform gives you a default owner role. If your app or team logs in with this role, they can drop any table.

To prevent this, you must create separate roles for daily work. First, you log in with the main owner role to build your schema and tables. Next, you create a new role for your developers and your app. You grant this new role rights to read, insert, update, and delete rows. You do not grant ownership or schema change rights to this daily role.

You can also use event triggers inside the database engine. An event trigger watches for schema change commands like drop table. When a user runs a drop command, the trigger fires and stops the transaction. This adds a second check inside the database itself.

Using protected branches for backup safety

Beyond database roles, the platform offers protected branches at the project level. You can mark your main production branch as protected in the project settings. A protected branch stops team members from deleting the entire branch by mistake. It also prevents users from resetting the branch to an older state.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Still, a protected branch only guards the branch container in the cloud control plane. It does not block SQL commands run inside the database session itself. A user with the table owner role can still run a drop table command. You must combine protected branches with strict Postgres role separation for real safety.

Where native database roles fall short

Native role separation works well for static apps, but it slows down human workflows. Engineers often need temporary schema rights to run migrations, fix bugs, or clean up data. When they log in with the owner role for a fix, the safety net vanishes. During that session, one wrong command in a SQL client can wipe out a table.

Also, shared owner roles make it hard to track who ran a bad command. Database logs only show the shared role name, not the person behind the keyboard. Native database roles decide who can log in, not what individual statements do in flight. Also, standard roles do not mask sensitive data like emails, phone numbers, or card numbers. Every query with read rights returns the raw text in the results.

Check every Postgres query on the wire

Database roles and network rules decide who can open a session. They do not read what each SQL statement does after login. With hoop.dev, you run an open-source proxy, a sidecar for your Postgres, inline in the Postgres wire protocol. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review. Your apps and agents keep their login details and change only the host and port in the connection string their tool uses.

Before a query runs, hoop.dev guardrails refuse bad deletes or drops with a real Postgres error, or hold risky queries for approval. On the way back, hoop.dev data masking rewrites sensitive values in returned rows in memory, and every verdict goes to the audit trail. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and generates evidence for HIPAA, GDPR, and PCI DSS. See the code on GitHub.

Frequently asked questions

Does a protected branch stop someone from dropping a table?

No, a protected branch only stops users from deleting or resetting the branch itself. Any user who logs in with the table owner role can still drop tables.

How can I recover a dropped table in my project?

You can use the point-in-time restore feature to create a new branch from history. You pick a timestamp right before the drop command happened and restore the data.

Can I revoke drop table rights from the table owner?

Postgres does not let you revoke drop rights from the owner of a table. Instead, you must assign ownership to an admin role and use a restricted role daily.

The query runs. The emails stay hidden.