File tree Expand file tree Collapse file tree 4 files changed +35
-0
lines changed
crates_io_database_dump/src
migrations/2025-09-03-201218_create_cloudfront_invalidation_queue Expand file tree Collapse file tree 4 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -176,6 +176,18 @@ diesel::table! {
176176 }
177177}
178178
179+ diesel:: table! {
180+ /// Queue for batching CloudFront CDN invalidation requests
181+ cloudfront_invalidation_queue ( id) {
182+ /// Unique identifier for each queued invalidation path
183+ id -> Int8 ,
184+ /// CloudFront path to invalidate (e.g. /crates/serde/serde-1.0.0.crate)
185+ path -> Text ,
186+ /// Timestamp when the path was queued for invalidation
187+ created_at -> Timestamptz ,
188+ }
189+ }
190+
179191diesel:: table! {
180192 /// Number of downloads per crate. This was extracted from the `crates` table for performance reasons.
181193 crate_downloads ( crate_id) {
@@ -1141,6 +1153,7 @@ diesel::allow_tables_to_appear_in_same_query!(
11411153 api_tokens,
11421154 background_jobs,
11431155 categories,
1156+ cloudfront_invalidation_queue,
11441157 crate_downloads,
11451158 crate_owner_invitations,
11461159 crate_owners,
Original file line number Diff line number Diff line change @@ -49,6 +49,11 @@ crates_cnt = "public"
4949created_at = " public"
5050path = " public"
5151
52+ [cloudfront_invalidation_queue .columns ]
53+ id = " private"
54+ path = " private"
55+ created_at = " private"
56+
5257[crate_downloads .columns ]
5358crate_id = " public"
5459downloads = " public"
Original file line number Diff line number Diff line change 1+ -- Drop the CloudFront invalidation queue table
2+ DROP TABLE IF EXISTS cloudfront_invalidation_queue;
Original file line number Diff line number Diff line change 1+ -- Create table for queuing CloudFront invalidation paths
2+ CREATE TABLE cloudfront_invalidation_queue (
3+ id BIGSERIAL PRIMARY KEY ,
4+ path TEXT NOT NULL ,
5+ created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
6+ );
7+
8+ COMMENT ON TABLE cloudfront_invalidation_queue IS ' Queue for batching CloudFront CDN invalidation requests' ;
9+ COMMENT ON COLUMN cloudfront_invalidation_queue.id IS ' Unique identifier for each queued invalidation path' ;
10+ COMMENT ON COLUMN cloudfront_invalidation_queue.path IS ' CloudFront path to invalidate (e.g. /crates/serde/serde-1.0.0.crate)' ;
11+ COMMENT ON COLUMN cloudfront_invalidation_queue.created_at IS ' Timestamp when the path was queued for invalidation' ;
12+
13+ -- Index for efficient batch processing (oldest first)
14+ CREATE INDEX idx_cloudfront_invalidation_queue_created_at
15+ ON cloudfront_invalidation_queue (created_at);
You can’t perform that action at this time.
0 commit comments