DEV Community

Andy Allison
Andy Allison

Posted on

2 1

Postgres variables & clean up

Overview

We needed a little script that would clean up data for a user based on their id.

do
$$
    declare
        userId varchar(255) := '98584bc7-f06b-45cf-bfc3-d5224cf7b743';
    begin
        delete from "LoginAttempt" where "userId" = userId;
        delete from "LoginSuccess" where "userId" = userId;
        delete from "LoginFailed" where "userId" = userId;
        delete from "Provider" where "userId" = userId;
        delete from "User" where id = userId;
    end
$$
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more