Skip to content

Commit

Permalink
fix: allow reinstalls
Browse files Browse the repository at this point in the history
  • Loading branch information
slowbackspace committed Dec 20, 2023
1 parent aa82857 commit c69ef07
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/services/db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ class DBStore {
}

storeInstallation = async (installationId: string, installation: Installation<'v1' | 'v2'>) => {
// TODO: Upsert if installation_id already exist
await this.client.none(
`INSERT INTO slack_installations(installation_id, installation_data) VALUES($1, $2:json)`,
`INSERT INTO slack_installations(installation_id, installation_data)
VALUES($1, $2:json)
ON CONFLICT (installation_id)
DO UPDATE SET installation_data = EXCLUDED.installation_data`,
[installationId, installation],
);
};
Expand Down

0 comments on commit c69ef07

Please sign in to comment.