You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 27ce304
Browse filesBrowse the repository at this point in the historyBrowse files
app/: review fixes for #54 and #62 (sc-8900): indexes on the foreign keys whose deletes would scan (baselines.review_id and approved_by, builds.created_by_user_id, comments.user_id, comment_threads.resolved_by); credit_transactions.build_id and a gallery day key; snapshot registration as one conditional upsert (a race between two files is a 409 for one of them), resetting a carried row; limits on commits, parent commits, branch, name, nonce, content type and meta; every snapshot validated before any is written; today's 401 messages; the personal organization takes the next slug on a race; credits::usage, plans, allowance and spend
@@ -747,6 +751,8 @@ CREATE INDEX credit_transactions_org_created ON credit_transactions USING btree
747
751
CREATE INDEX credit_transactions_project ON credit_transactions USING btree (project_id, created_at);
748
752
749
753
CREATE UNIQUE INDEX credit_transactions_purchase_once ON credit_transactions USING btree (organization_id, reference) WHERE (kind = 'purchase'::text);
754
+
CREATE UNIQUE INDEX credit_transactions_gallery_day ON credit_transactions USING btree (organization_id, project_id, day) WHERE (kind = 'gallery'::text);
755
+
CREATE INDEX credit_transactions_build_idx ON credit_transactions USING btree (build_id) WHERE build_id IS NOT NULL;
750
756
751
757
CREATE INDEX feedback_account_created ON feedback USING btree (account, created_at);
752
758
@@ -915,6 +921,11 @@ CREATE INDEX build_groups_source_idx ON build_groups USING btree (source_build_i
915
921
CREATE INDEX snapshots_build_group_idx ON snapshots USING btree (build_id, group_key);
916
922
917
923
-- Hot paths and foreign keys (every delete of a parent row checks these columns).
924
+
CREATE INDEX baselines_review_idx ON baselines USING btree (review_id) WHERE review_id IS NOT NULL;
925
+
CREATE INDEX baselines_approved_by_idx ON baselines USING btree (approved_by) WHERE approved_by IS NOT NULL;
926
+
CREATE INDEX builds_created_by_idx ON builds USING btree (created_by_user_id) WHERE created_by_user_id IS NOT NULL;
927
+
CREATE INDEX comments_user_idx ON comments USING btree (user_id) WHERE user_id IS NOT NULL;
928
+
CREATE INDEX comment_threads_resolved_by_idx ON comment_threads USING btree (resolved_by) WHERE resolved_by IS NOT NULL;
918
929
CREATE INDEX snapshots_render_idx ON snapshots USING btree (render_id) WHERE render_id IS NOT NULL;
919
930
920
931
CREATE INDEX snapshots_source_blob_idx ON snapshots USING btree (source_blob) WHERE source_blob IS NOT NULL;
@@ -1055,6 +1066,9 @@ CREATE TABLE downloads (
1055
1066
CREATE INDEX downloads_build_filter ON downloads USING btree (build_id, filter_key, created_at DESC);
1056
1067
CREATE INDEX downloads_created_brin ON downloads USING brin (created_at);
1057
1068
1069
+
ALTER TABLE ONLY credit_transactions
1070
+
ADD CONSTRAINT credit_transactions_build_id_fkey FOREIGN KEY (build_id) REFERENCES builds(id) ON DELETE SET NULL;
1071
+
1058
1072
-- Project tokens (the auth migration) belong to a project.
0 commit comments