diff --git a/server/datastore/datastore_repository.go b/server/datastore/datastore_repository.go index d5f0df2d28..a9ed1c8b0e 100644 --- a/server/datastore/datastore_repository.go +++ b/server/datastore/datastore_repository.go @@ -91,7 +91,8 @@ func (r *Repository) Update(ctx context.Context, dataStore DataStore) (DataStore } defer tx.Rollback() - _, err = tx.ExecContext(ctx, deleteQuery, DataStoreSingleID) + query, params := sqlutil.Tenant(ctx, deleteQuery, DataStoreSingleID) + _, err = tx.ExecContext(ctx, query, params...) if err != nil { return DataStore{}, fmt.Errorf("datastore repository sql exec delete: %w", err) } diff --git a/server/migrations/33_add_composite_pkey.down.sql b/server/migrations/33_add_composite_pkey.down.sql new file mode 100644 index 0000000000..a9d31a009e --- /dev/null +++ b/server/migrations/33_add_composite_pkey.down.sql @@ -0,0 +1,3 @@ +ALTER TABLE data_stores +DROP CONSTRAINT data_stores_pkey, +ADD PRIMARY KEY (id); \ No newline at end of file diff --git a/server/migrations/33_add_composite_pkey.up.sql b/server/migrations/33_add_composite_pkey.up.sql new file mode 100644 index 0000000000..50be1e0988 --- /dev/null +++ b/server/migrations/33_add_composite_pkey.up.sql @@ -0,0 +1,3 @@ +ALTER TABLE data_stores +DROP CONSTRAINT data_stores_pkey, +ADD PRIMARY KEY (id, tenant_id); \ No newline at end of file