To remove all entries from the offer
table in PostgreSQL, you can use either of the following SQL commands depending on whether you want to:
TRUNCATE TABLE offer RESTART IDENTITY CASCADE;
TRUNCATE
is fast and efficient for large tables.RESTART IDENTITY
resets SERIAL
or IDENTITY
columns (e.g. id = 1
again).CASCADE
also removes rows from related tables with foreign key constraints.
DELETE FROM offer;
TRUNCATE
(especially for large datasets).Use TRUNCATE TABLE offer RESTART IDENTITY CASCADE;
for development or when you're sure you want a clean slate.
Let me know if you want to restrict this by condition or run it inside a Flyway migration.