Skip to main content

max / makenotwork

server: regenerate the sqlx query cache The offline build had been broken at HEAD: 19 queries in db/transactions/purchases.rs and revenue_stats.rs had no cached data, so cargo check --all-targets failed and the test suite could not be built. Cause was the prep database rather than the queries. mnw_sqlx_prep sat at migration 154 while the tree is at 169, so whoever last ran prepare could not have captured these. Migrated it to head and re-prepared: 20 stale entries drop, 18 land, all of them transactions queries. Offline check clean, 1887 lib tests and 1190 integration tests green.
Co-Authored-By
Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author: Max Johnson <me@maxj.phd> · 2026-07-22 00:59 UTC
Signed with PGP, not checked
Commit: de46409f6c59324d50765748ef1347468b207f50
Parent: 6d28b84
25 files changed, +211 insertions, -295 deletions
@@ -1,6 +1,6 @@
1 1 {
2 2 "db_name": "PostgreSQL",
3 - "query": "\n SELECT\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: super::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n FROM transactions\n WHERE item_id = $1 AND seller_id = $2\n AND status IN ('completed', 'refunded')\n ORDER BY created_at DESC\n LIMIT 200\n ",
3 + "query": "\n UPDATE transactions\n SET buyer_id = $2, claimed_by = $2, claim_token = NULL\n WHERE claim_token = $1\n AND buyer_id IS NULL\n AND status = 'completed'\n RETURNING\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: crate::db::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n ",
4 4 "describe": {
5 5 "columns": [
6 6 {
@@ -40,7 +40,7 @@
40 40 },
41 41 {
42 42 "ordinal": 7,
43 - "name": "status: super::TransactionStatus",
43 + "name": "status: crate::db::TransactionStatus",
44 44 "type_info": "Varchar"
45 45 },
46 46 {
@@ -145,5 +145,5 @@
145 145 true
146 146 ]
147 147 },
148 - "hash": "7fa83142c8cd2fdfcbde1402dbf8b33fabaa9e3150c6c9de3d635e94ab7da126"
148 + "hash": "6ab99bc96ab877001dfbe1bd4bf870e2208c2066301dd57d3fb705bfb995cc4c"
149 149 }
@@ -1,6 +1,6 @@
1 1 {
2 2 "db_name": "PostgreSQL",
3 - "query": "\n SELECT\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: super::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n FROM transactions WHERE buyer_id = $1\n ORDER BY created_at DESC, id DESC\n LIMIT $2 OFFSET $3\n ",
3 + "query": "\n SELECT\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: crate::db::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n FROM transactions WHERE buyer_id = $1\n ORDER BY created_at DESC, id DESC\n LIMIT $2 OFFSET $3\n ",
4 4 "describe": {
5 5 "columns": [
6 6 {
@@ -40,7 +40,7 @@
40 40 },
41 41 {
42 42 "ordinal": 7,
43 - "name": "status: super::TransactionStatus",
43 + "name": "status: crate::db::TransactionStatus",
44 44 "type_info": "Varchar"
45 45 },
46 46 {
@@ -146,5 +146,5 @@
146 146 true
147 147 ]
148 148 },
149 - "hash": "17188cab9291709226c6f4586bccfbbd878a4c98b27bb844e8b48c56edd7981a"
149 + "hash": "ca4f76b9e8178f6fd851a2d81001cf3462c0f5f31071dabb9b409fa351c22f1e"
150 150 }
@@ -1,6 +1,6 @@
1 1 {
2 2 "db_name": "PostgreSQL",
3 - "query": "\n SELECT\n t.created_at AS \"created_at: chrono::DateTime<chrono::Utc>\",\n t.item_id AS \"item_id: ItemId\",\n t.item_title,\n t.amount_cents AS \"amount_cents: Cents\",\n t.status AS \"status: super::TransactionStatus\",\n CASE WHEN t.share_contact AND NOT EXISTS (\n SELECT 1 FROM contact_revocations cr\n WHERE cr.buyer_id = t.buyer_id AND cr.seller_id = t.seller_id\n ) THEN u.email ELSE NULL END as buyer_email\n FROM transactions t\n LEFT JOIN users u ON u.id = t.buyer_id\n WHERE t.seller_id = $1\n ORDER BY t.created_at DESC, t.id DESC\n LIMIT $2 OFFSET $3\n ",
3 + "query": "\n SELECT\n t.created_at AS \"created_at: chrono::DateTime<chrono::Utc>\",\n t.item_id AS \"item_id: ItemId\",\n t.item_title,\n t.amount_cents AS \"amount_cents: Cents\",\n t.status AS \"status: crate::db::TransactionStatus\",\n CASE WHEN t.share_contact AND NOT EXISTS (\n SELECT 1 FROM contact_revocations cr\n WHERE cr.buyer_id = t.buyer_id AND cr.seller_id = t.seller_id\n ) THEN u.email ELSE NULL END as buyer_email\n FROM transactions t\n LEFT JOIN users u ON u.id = t.buyer_id\n WHERE t.seller_id = $1\n ORDER BY t.created_at DESC, t.id DESC\n LIMIT $2 OFFSET $3\n ",
4 4 "describe": {
5 5 "columns": [
6 6 {
@@ -25,7 +25,7 @@
25 25 },
26 26 {
27 27 "ordinal": 4,
28 - "name": "status: super::TransactionStatus",
28 + "name": "status: crate::db::TransactionStatus",
29 29 "type_info": "Varchar"
30 30 },
31 31 {
@@ -50,5 +50,5 @@
50 50 null
51 51 ]
52 52 },
53 - "hash": "c9b1c6374241b92f67625311ba06f033367de4cf3822ffae9ba04b3dbe3cb9e0"
53 + "hash": "a56b8916afb3ec4a6377348a87a00c082a68663bfef1cd85f3686acee68e7a75"
54 54 }
@@ -1,6 +1,6 @@
1 1 {
2 2 "db_name": "PostgreSQL",
3 - "query": "\n UPDATE transactions\n SET status = 'completed',\n stripe_payment_intent_id = $2,\n completed_at = NOW()\n WHERE stripe_checkout_session_id = $1\n AND status = 'pending'\n RETURNING\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: super::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n ",
3 + "query": "\n UPDATE transactions\n SET status = 'completed',\n stripe_payment_intent_id = $2,\n completed_at = NOW()\n WHERE stripe_checkout_session_id = $1\n AND status = 'pending'\n RETURNING\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: crate::db::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n ",
4 4 "describe": {
5 5 "columns": [
6 6 {
@@ -40,7 +40,7 @@
40 40 },
41 41 {
42 42 "ordinal": 7,
43 - "name": "status: super::TransactionStatus",
43 + "name": "status: crate::db::TransactionStatus",
44 44 "type_info": "Varchar"
45 45 },
46 46 {
@@ -145,5 +145,5 @@
145 145 true
146 146 ]
147 147 },
148 - "hash": "f200a476bbe6aa6290d8b9b00e057ff666bb9d4786487a68bf910cff1b283f74"
148 + "hash": "db8323af7727423a9a91f39a5ca3327a9552472e8930974767b6b15f2a910fa1"
149 149 }
@@ -1,6 +1,6 @@
1 1 {
2 2 "db_name": "PostgreSQL",
3 - "query": "\n UPDATE transactions\n SET buyer_id = $2, claimed_by = $2, claim_token = NULL\n WHERE claim_token = $1\n AND buyer_id IS NULL\n AND status = 'completed'\n RETURNING\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: super::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n ",
3 + "query": "\n SELECT\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: crate::db::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n FROM transactions\n WHERE item_id = $1 AND seller_id = $2\n AND status IN ('completed', 'refunded')\n ORDER BY created_at DESC\n LIMIT 200\n ",
4 4 "describe": {
5 5 "columns": [
6 6 {
@@ -40,7 +40,7 @@
40 40 },
41 41 {
42 42 "ordinal": 7,
43 - "name": "status: super::TransactionStatus",
43 + "name": "status: crate::db::TransactionStatus",
44 44 "type_info": "Varchar"
45 45 },
46 46 {
@@ -145,5 +145,5 @@
145 145 true
146 146 ]
147 147 },
148 - "hash": "5050ee2fc897968ac68657496e49ccbc48a5948a3b8b62646a1cdaf9023982fd"
148 + "hash": "51c059fc3b8df19b71b7b1938fd9111155df310e960bf37b95575614c4f0d8f2"
149 149 }
@@ -1,6 +1,6 @@
1 1 {
2 2 "db_name": "PostgreSQL",
3 - "query": "\n SELECT\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: super::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n FROM transactions WHERE id = $1\n ",
3 + "query": "\n SELECT\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: crate::db::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n FROM transactions WHERE id = $1\n ",
4 4 "describe": {
5 5 "columns": [
6 6 {
@@ -40,7 +40,7 @@
40 40 },
41 41 {
42 42 "ordinal": 7,
43 - "name": "status: super::TransactionStatus",
43 + "name": "status: crate::db::TransactionStatus",
44 44 "type_info": "Varchar"
45 45 },
46 46 {
@@ -144,5 +144,5 @@
144 144 true
145 145 ]
146 146 },
147 - "hash": "2df9f7ba4fffec670698ab8b4b4c08d6aaf49e8688495e43117436cdb5413602"
147 + "hash": "5d1b0b86891356935ceb3f9857dad2d57e08597e916babf1667a0fc4e1ac05ad"
148 148 }
@@ -1,6 +1,6 @@
1 1 {
2 2 "db_name": "PostgreSQL",
3 - "query": "\n INSERT INTO transactions (buyer_id, seller_id, item_id, amount_cents, platform_fee_cents, stripe_checkout_session_id, item_title, seller_username, share_contact, project_id, promo_code_id, guest_email, platform_credit_cents)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)\n RETURNING\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: super::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n ",
3 + "query": "\n INSERT INTO transactions (buyer_id, seller_id, item_id, amount_cents, platform_fee_cents, stripe_checkout_session_id, item_title, seller_username, share_contact, project_id, promo_code_id, guest_email, platform_credit_cents)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)\n RETURNING\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: crate::db::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n ",
4 4 "describe": {
5 5 "columns": [
6 6 {
@@ -40,7 +40,7 @@
40 40 },
41 41 {
42 42 "ordinal": 7,
43 - "name": "status: super::TransactionStatus",
43 + "name": "status: crate::db::TransactionStatus",
44 44 "type_info": "Varchar"
45 45 },
46 46 {
@@ -156,5 +156,5 @@
156 156 true
157 157 ]
158 158 },
159 - "hash": "f8c96f1a4805725e1035dceb0143bd6f608eaebce32e39f0139eb7a63ce7b6d2"
159 + "hash": "5c4e0da5632e7e126f826b01991424d4c6ea346781c958504b7a35805d96c9fe"
160 160 }
@@ -1,6 +1,6 @@
1 1 {
2 2 "db_name": "PostgreSQL",
3 - "query": "\n SELECT\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: super::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n FROM transactions WHERE seller_id = $1 ORDER BY created_at DESC LIMIT $2\n ",
3 + "query": "\n SELECT\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: crate::db::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n FROM transactions WHERE seller_id = $1 ORDER BY created_at DESC LIMIT $2\n ",
4 4 "describe": {
5 5 "columns": [
6 6 {
@@ -40,7 +40,7 @@
40 40 },
41 41 {
42 42 "ordinal": 7,
43 - "name": "status: super::TransactionStatus",
43 + "name": "status: crate::db::TransactionStatus",
44 44 "type_info": "Varchar"
45 45 },
46 46 {
@@ -145,5 +145,5 @@
145 145 true
146 146 ]
147 147 },
148 - "hash": "0edcbc78d86e90f5845d72797f65ed8d1071327610ef8a51dd775b3f709bec66"
148 + "hash": "0fd5031e6a0bd125edb16ca526b22688bf5774db87add91a1656ec871d50a764"
149 149 }
@@ -1,6 +1,6 @@
1 1 {
2 2 "db_name": "PostgreSQL",
3 - "query": "\n SELECT\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: super::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n FROM transactions WHERE download_token = $1 AND status = 'completed'\n ",
3 + "query": "\n SELECT\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: crate::db::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n FROM transactions WHERE download_token = $1 AND status = 'completed'\n ",
4 4 "describe": {
5 5 "columns": [
6 6 {
@@ -40,7 +40,7 @@
40 40 },
41 41 {
42 42 "ordinal": 7,
43 - "name": "status: super::TransactionStatus",
43 + "name": "status: crate::db::TransactionStatus",
44 44 "type_info": "Varchar"
45 45 },
46 46 {
@@ -144,5 +144,5 @@
144 144 true
145 145 ]
146 146 },
147 - "hash": "90b061b46f562d1af9dd8faa7f1467be44abc08fb27706aaddb460f02ddb7f44"
147 + "hash": "db62a036fe720c323bef90fb4ebe164d06868977d5da0c1f42281a53e7544317"
148 148 }
@@ -1,6 +1,6 @@
1 1 {
2 2 "db_name": "PostgreSQL",
3 - "query": "\n SELECT\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: super::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n FROM transactions\n WHERE stripe_checkout_session_id = $1 AND status = 'completed'\n ",
3 + "query": "\n SELECT\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: crate::db::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n FROM transactions\n WHERE stripe_checkout_session_id = $1 AND status = 'completed'\n ",
4 4 "describe": {
5 5 "columns": [
6 6 {
@@ -40,7 +40,7 @@
40 40 },
41 41 {
42 42 "ordinal": 7,
43 - "name": "status: super::TransactionStatus",
43 + "name": "status: crate::db::TransactionStatus",
44 44 "type_info": "Varchar"
45 45 },
46 46 {
@@ -144,5 +144,5 @@
144 144 true
145 145 ]
146 146 },
147 - "hash": "c442eef4152cb7aa4fcf4298f5ce170211c902f831a787eef055242d85dcbfe6"
147 + "hash": "4dcd947c2a6b61e2f1a62419834210bc696eb0d339a86fead534183afccf1abe"
148 148 }
@@ -1,6 +1,6 @@
1 1 {
2 2 "db_name": "PostgreSQL",
3 - "query": "\n INSERT INTO transactions (buyer_id, seller_id, project_id, amount_cents, platform_fee_cents, stripe_checkout_session_id, item_title, seller_username, share_contact)\n VALUES ($1, $2, $3, $4, 0, $5, $6, $7, $8)\n RETURNING\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: super::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n ",
3 + "query": "\n INSERT INTO transactions (buyer_id, seller_id, project_id, amount_cents, platform_fee_cents, stripe_checkout_session_id, item_title, seller_username, share_contact)\n VALUES ($1, $2, $3, $4, 0, $5, $6, $7, $8)\n RETURNING\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: crate::db::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n ",
4 4 "describe": {
5 5 "columns": [
6 6 {
@@ -40,7 +40,7 @@
40 40 },
41 41 {
42 42 "ordinal": 7,
43 - "name": "status: super::TransactionStatus",
43 + "name": "status: crate::db::TransactionStatus",
44 44 "type_info": "Varchar"
45 45 },
46 46 {
@@ -151,5 +151,5 @@
151 151 true
152 152 ]
153 153 },
154 - "hash": "2f9493dff81cb0306fa06500539f3346294d3b0552ff46cc40d92ca1b2ab9525"
154 + "hash": "85188c0ab6f3ecfbece76bfce53a6b28a4525d732b2cd272d79e12a06d364001"
155 155 }
@@ -1,6 +1,6 @@
1 1 {
2 2 "db_name": "PostgreSQL",
3 - "query": "\n UPDATE transactions\n SET status = 'completed',\n stripe_payment_intent_id = $2,\n completed_at = NOW(),\n guest_email = $3,\n claim_token = $4,\n buyer_id = NULL\n WHERE stripe_checkout_session_id = $1\n AND status = 'pending'\n RETURNING\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: super::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n ",
3 + "query": "\n UPDATE transactions\n SET status = 'completed',\n stripe_payment_intent_id = $2,\n completed_at = NOW(),\n guest_email = $3,\n claim_token = $4,\n buyer_id = NULL\n WHERE stripe_checkout_session_id = $1\n AND status = 'pending'\n RETURNING\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: crate::db::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n ",
4 4 "describe": {
5 5 "columns": [
6 6 {
@@ -40,7 +40,7 @@
40 40 },
41 41 {
42 42 "ordinal": 7,
43 - "name": "status: super::TransactionStatus",
43 + "name": "status: crate::db::TransactionStatus",
44 44 "type_info": "Varchar"
45 45 },
46 46 {
@@ -147,5 +147,5 @@
147 147 true
148 148 ]
149 149 },
150 - "hash": "1e4b48db02316269e0452632c3f8e14247545c8b539fe03b8eed786f16655e61"
150 + "hash": "cc928551715745e7ef7b8521ba8d24972c2c9ab12404bed2000a896e7c5f1e4f"
151 151 }
@@ -1,6 +1,6 @@
1 1 {
2 2 "db_name": "PostgreSQL",
3 - "query": "\n SELECT\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: super::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n FROM transactions WHERE buyer_id = $1 ORDER BY created_at DESC LIMIT $2\n ",
3 + "query": "\n SELECT\n id AS \"id: TransactionId\", buyer_id AS \"buyer_id: UserId\", seller_id AS \"seller_id: UserId\",\n item_id AS \"item_id: ItemId\", amount_cents AS \"amount_cents: Cents\", platform_fee_cents AS \"platform_fee_cents: Cents\",\n currency, status AS \"status: crate::db::TransactionStatus\", stripe_payment_intent_id, stripe_checkout_session_id,\n created_at AS \"created_at: chrono::DateTime<chrono::Utc>\", completed_at AS \"completed_at: chrono::DateTime<chrono::Utc>\",\n item_title, seller_username, share_contact, project_id AS \"project_id: ProjectId\",\n parent_transaction_id AS \"parent_transaction_id: TransactionId\", promo_code_id AS \"promo_code_id: PromoCodeId\",\n guest_email, claim_token AS \"claim_token: ClaimToken\", claimed_by AS \"claimed_by: UserId\",\n download_token AS \"download_token: DownloadToken\"\n FROM transactions WHERE buyer_id = $1 ORDER BY created_at DESC LIMIT $2\n ",
4 4 "describe": {
5 5 "columns": [
6 6 {
@@ -40,7 +40,7 @@
40 40 },
41 41 {
42 42 "ordinal": 7,
43 - "name": "status: super::TransactionStatus",
43 + "name": "status: crate::db::TransactionStatus",
44 44 "type_info": "Varchar"
45 45 },
46 46 {
@@ -145,5 +145,5 @@
145 145 true
146 146 ]
147 147 },
148 - "hash": "a7479c10dc16cb42c81447859ee00944739282fc8c22c214e096abda5413e63a"
148 + "hash": "ed66bad40aae00383972d0a47e4edcb9e1cf28123e2e9c3bb03aea4e085f0f1e"
149 149 }
@@ -1,28 +1,0 @@
1 - {
2 - "db_name": "PostgreSQL",
3 - "query": "\n UPDATE transactions\n SET status = 'refunded'\n WHERE stripe_payment_intent_id = $1 AND status IN ('completed', 'refunding')\n RETURNING id AS \"id: super::TransactionId\", item_id AS \"item_id: ItemId\"\n ",
4 - "describe": {
5 - "columns": [
6 - {
7 - "ordinal": 0,
8 - "name": "id: super::TransactionId",
9 - "type_info": "Uuid"
10 - },
11 - {
12 - "ordinal": 1,
13 - "name": "item_id: ItemId",
14 - "type_info": "Uuid"
15 - }
16 - ],
17 - "parameters": {
18 - "Left": [
19 - "Text"
20 - ]
21 - },
22 - "nullable": [
23 - false,
24 - true
25 - ]
26 - },
27 - "hash": "0ed4c7b8dadd1fe7ae897775b6fa64b030834c4257ed59ee1fe58dea9e8192c1"
28 - }
@@ -1,0 +1,70 @@
1 + {
2 + "db_name": "PostgreSQL",
3 + "query": "\n SELECT\n transaction_id AS \"transaction_id!: TransactionId\",\n item_id AS \"item_id!: ItemId\",\n title AS \"title!\",\n creator AS \"creator!\",\n item_type AS \"item_type!: crate::db::ItemType\",\n purchased_at AS \"purchased_at!: chrono::DateTime<chrono::Utc>\",\n is_free AS \"is_free!\",\n license_key_code AS \"license_key_code?: KeyCode\",\n has_new_version AS \"has_new_version!\"\n FROM (\n SELECT DISTINCT ON (p.item_id)\n p.transaction_id,\n p.item_id,\n i.title,\n u.username as creator,\n i.item_type,\n p.purchased_at,\n -- Badge from what the buyer actually paid, not the item's current\n -- price: a later re-price to $0 must not retroactively badge a paid\n -- purchase \"Free\" (nor vice-versa). The purchases view carries the\n -- transaction's own amount_cents.\n (p.amount_cents = 0) as is_free,\n lk.key_code as license_key_code,\n (vc.total_versions > 0 AND vc.total_versions > COALESCE(dc.downloaded_count, 0)) as has_new_version\n FROM purchases p\n JOIN items i ON p.item_id = i.id\n JOIN projects proj ON i.project_id = proj.id\n JOIN users u ON proj.user_id = u.id\n LEFT JOIN license_keys lk ON lk.item_id = p.item_id AND lk.owner_id = p.buyer_id AND lk.revoked_at IS NULL\n LEFT JOIN LATERAL (\n SELECT COUNT(*) AS total_versions\n FROM versions v\n WHERE v.item_id = i.id AND v.s3_key IS NOT NULL\n ) vc ON true\n LEFT JOIN LATERAL (\n SELECT COUNT(*) AS downloaded_count\n FROM user_downloads ud\n WHERE ud.user_id = p.buyer_id AND ud.item_id = i.id\n ) dc ON true\n WHERE p.buyer_id = $1\n ORDER BY p.item_id, p.purchased_at DESC\n ) deduped\n ORDER BY purchased_at DESC\n LIMIT 20\n ",
4 + "describe": {
5 + "columns": [
6 + {
7 + "ordinal": 0,
8 + "name": "transaction_id!: TransactionId",
9 + "type_info": "Uuid"
10 + },
11 + {
12 + "ordinal": 1,
13 + "name": "item_id!: ItemId",
14 + "type_info": "Uuid"
15 + },
16 + {
17 + "ordinal": 2,
18 + "name": "title!",
19 + "type_info": "Varchar"
20 + },
21 + {
22 + "ordinal": 3,
23 + "name": "creator!",
24 + "type_info": "Varchar"
25 + },
26 + {
27 + "ordinal": 4,
28 + "name": "item_type!: crate::db::ItemType",
29 + "type_info": "Varchar"
30 + },
31 + {
32 + "ordinal": 5,
33 + "name": "purchased_at!: chrono::DateTime<chrono::Utc>",
34 + "type_info": "Timestamptz"
35 + },
36 + {
37 + "ordinal": 6,
38 + "name": "is_free!",
39 + "type_info": "Bool"
40 + },
41 + {
42 + "ordinal": 7,
43 + "name": "license_key_code?: KeyCode",
44 + "type_info": "Varchar"
45 + },
46 + {
47 + "ordinal": 8,
48 + "name": "has_new_version!",
49 + "type_info": "Bool"
50 + }
51 + ],
52 + "parameters": {
53 + "Left": [
54 + "Uuid"
55 + ]
56 + },
57 + "nullable": [
58 + true,
59 + true,
60 + false,
61 + false,
62 + false,
63 + true,
64 + null,
65 + false,
66 + null
67 + ]
68 + },
69 + "hash": "41c422f4a67885622c873a4340e02428504351b0af6f3ec8a504c6875837769a"
70 + }
@@ -1,23 +1,0 @@
1 - {
2 - "db_name": "PostgreSQL",
3 - "query": "\n DELETE FROM transactions\n WHERE buyer_id = $1 AND item_id = $2 AND status = 'pending'\n RETURNING promo_code_id AS \"promo_code_id: super::PromoCodeId\"\n ",
4 - "describe": {
5 - "columns": [
6 - {
7 - "ordinal": 0,
8 - "name": "promo_code_id: super::PromoCodeId",
9 - "type_info": "Uuid"
10 - }
11 - ],
12 - "parameters": {
13 - "Left": [
14 - "Uuid",
15 - "Uuid"
16 - ]
17 - },
18 - "nullable": [
19 - true
20 - ]
21 - },
22 - "hash": "45104ff126ee3594229229440c2eaa5ecdee90cb623a29d8f1dd1a9721ac9f5f"
23 - }
@@ -1,0 +1,23 @@
1 + {
2 + "db_name": "PostgreSQL",
3 + "query": "\n DELETE FROM transactions\n WHERE buyer_id = $1 AND item_id = $2 AND amount_cents = 0 AND status = 'completed'\n RETURNING promo_code_id AS \"promo_code_id: crate::db::PromoCodeId\"\n ",
4 + "describe": {
5 + "columns": [
6 + {
7 + "ordinal": 0,
8 + "name": "promo_code_id: crate::db::PromoCodeId",
9 + "type_info": "Uuid"
10 + }
11 + ],
12 + "parameters": {
13 + "Left": [
14 + "Uuid",
15 + "Uuid"
16 + ]
17 + },
18 + "nullable": [
19 + true
20 + ]
21 + },
22 + "hash": "5fcb253fc99349b8e9d4b9ce7f7516611f073af529e2433c69f490da71704cd3"
23 + }
@@ -1,0 +1,28 @@
1 + {
2 + "db_name": "PostgreSQL",
3 + "query": "\n UPDATE transactions\n SET status = 'refunded'\n WHERE id = $1 AND status IN ('completed', 'refunding')\n RETURNING id AS \"id: crate::db::TransactionId\", item_id AS \"item_id: ItemId\"\n ",
4 + "describe": {
5 + "columns": [
6 + {
7 + "ordinal": 0,
8 + "name": "id: crate::db::TransactionId",
9 + "type_info": "Uuid"
10 + },
11 + {
12 + "ordinal": 1,
13 + "name": "item_id: ItemId",
14 + "type_info": "Uuid"
15 + }
16 + ],
17 + "parameters": {
18 + "Left": [
19 + "Uuid"
20 + ]
21 + },
22 + "nullable": [
23 + false,
24 + true
25 + ]
26 + },
27 + "hash": "83c5ecce4995b45cd71e8f9d7eca7c6fae0b6ab61958be39ac9ff766452a86ee"
28 + }