Skip to content

Commit

Permalink
Add ability to merge
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaanus committed Oct 27, 2022
1 parent 2effc20 commit 504e7e7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/lib/db/suggest-change-store.ts
Expand Up @@ -230,6 +230,8 @@ export class SuggestChangeStore implements ISuggestChangeStore {
suggest_change_set_id: changeSetID,
created_by: userId,
})
.onConflict(['action', 'suggest_change_set_id', 'feature'])
.merge()
.returning('id');
};

Expand Down
3 changes: 2 additions & 1 deletion src/migrations/20221810114644-add-suggest-changes-table.js
Expand Up @@ -19,7 +19,8 @@ CREATE TABLE IF NOT EXISTS suggest_change (
payload jsonb not null default '[]'::jsonb,
created_by integer not null references users (id) ON DELETE CASCADE,
created_at timestamp default now(),
suggest_change_set_id integer NOT NULL REFERENCES suggest_change_set(id) ON DELETE CASCADE
suggest_change_set_id integer NOT NULL REFERENCES suggest_change_set(id) ON DELETE CASCADE,
UNIQUE (feature, action, suggest_change_set_id)
);
`,
callback,
Expand Down

0 comments on commit 504e7e7

Please sign in to comment.