diff --git a/.sqlx/query-41cf2f8d64aa36fb930cc1bf8a46d37e0987b743438b44e1c55859fc6b6ee6a0.json b/.sqlx/query-41cf2f8d64aa36fb930cc1bf8a46d37e0987b743438b44e1c55859fc6b6ee6a0.json new file mode 100644 index 0000000000..a581187e94 --- /dev/null +++ b/.sqlx/query-41cf2f8d64aa36fb930cc1bf8a46d37e0987b743438b44e1c55859fc6b6ee6a0.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "\nINSERT INTO user_spend_summaries\nSET\n payments_namespace = ?,\n user_token = ?,\n lifetime_gross_spend_usd_cents = ?,\n lifetime_subscription_spend_usd_cents = ?,\n lifetime_credits_spend_usd_cents = ?,\n lifetime_refund_usd_cents = ?,\n lifetime_net_spend_usd_cents = ?,\n lifetime_payment_count = ?,\n lifetime_refund_count = ?,\n first_payment_at = ?,\n first_spend_usd_cents = ?,\n last_payment_at = ?,\n last_spend_usd_cents = ?,\n days_since_first_payment = ?,\n days_since_last_payment = ?,\n net_spend_7d_usd_cents = ?,\n net_spend_prev_7d_usd_cents = ?,\n net_spend_14d_usd_cents = ?,\n net_spend_prev_14d_usd_cents = ?,\n net_spend_30d_usd_cents = ?,\n net_spend_prev_30d_usd_cents = ?,\n net_spend_60d_usd_cents = ?,\n net_spend_90d_usd_cents = ?,\n net_spend_this_year_usd_cents = ?,\n avg_weekly_net_spend_4w_usd_cents = ?,\n avg_weekly_net_spend_12w_usd_cents = ?,\n active_weeks_in_last_4 = ?,\n active_weeks_in_last_8 = ?,\n active_weeks_in_last_12 = ?,\n active_weeks_in_last_24 = ?,\n active_weeks_in_last_52 = ?,\n consecutive_active_weeks = ?,\n consecutive_inactive_weeks = ?,\n weeks_since_last_spend = ?,\n is_active_subscriber = ?,\n maybe_subscription_interval = ?,\n maybe_reengagement_score = ?\nON DUPLICATE KEY UPDATE\n lifetime_gross_spend_usd_cents = VALUES(lifetime_gross_spend_usd_cents),\n lifetime_subscription_spend_usd_cents = VALUES(lifetime_subscription_spend_usd_cents),\n lifetime_credits_spend_usd_cents = VALUES(lifetime_credits_spend_usd_cents),\n lifetime_refund_usd_cents = VALUES(lifetime_refund_usd_cents),\n lifetime_net_spend_usd_cents = VALUES(lifetime_net_spend_usd_cents),\n lifetime_payment_count = VALUES(lifetime_payment_count),\n lifetime_refund_count = VALUES(lifetime_refund_count),\n first_payment_at = VALUES(first_payment_at),\n first_spend_usd_cents = VALUES(first_spend_usd_cents),\n last_payment_at = VALUES(last_payment_at),\n last_spend_usd_cents = VALUES(last_spend_usd_cents),\n days_since_first_payment = VALUES(days_since_first_payment),\n days_since_last_payment = VALUES(days_since_last_payment),\n net_spend_7d_usd_cents = VALUES(net_spend_7d_usd_cents),\n net_spend_prev_7d_usd_cents = VALUES(net_spend_prev_7d_usd_cents),\n net_spend_14d_usd_cents = VALUES(net_spend_14d_usd_cents),\n net_spend_prev_14d_usd_cents = VALUES(net_spend_prev_14d_usd_cents),\n net_spend_30d_usd_cents = VALUES(net_spend_30d_usd_cents),\n net_spend_prev_30d_usd_cents = VALUES(net_spend_prev_30d_usd_cents),\n net_spend_60d_usd_cents = VALUES(net_spend_60d_usd_cents),\n net_spend_90d_usd_cents = VALUES(net_spend_90d_usd_cents),\n net_spend_this_year_usd_cents = VALUES(net_spend_this_year_usd_cents),\n avg_weekly_net_spend_4w_usd_cents = VALUES(avg_weekly_net_spend_4w_usd_cents),\n avg_weekly_net_spend_12w_usd_cents = VALUES(avg_weekly_net_spend_12w_usd_cents),\n active_weeks_in_last_4 = VALUES(active_weeks_in_last_4),\n active_weeks_in_last_8 = VALUES(active_weeks_in_last_8),\n active_weeks_in_last_12 = VALUES(active_weeks_in_last_12),\n active_weeks_in_last_24 = VALUES(active_weeks_in_last_24),\n active_weeks_in_last_52 = VALUES(active_weeks_in_last_52),\n consecutive_active_weeks = VALUES(consecutive_active_weeks),\n consecutive_inactive_weeks = VALUES(consecutive_inactive_weeks),\n weeks_since_last_spend = VALUES(weeks_since_last_spend),\n is_active_subscriber = VALUES(is_active_subscriber),\n maybe_subscription_interval = VALUES(maybe_subscription_interval),\n maybe_reengagement_score = VALUES(maybe_reengagement_score)\n ", + "describe": { + "columns": [], + "parameters": { + "Right": 37 + }, + "nullable": [] + }, + "hash": "41cf2f8d64aa36fb930cc1bf8a46d37e0987b743438b44e1c55859fc6b6ee6a0" +} diff --git a/.sqlx/query-5b1954301fc16703a04e2f63fd85c28bf2283bc1ecb5624107686dad0dfe364f.json b/.sqlx/query-5b1954301fc16703a04e2f63fd85c28bf2283bc1ecb5624107686dad0dfe364f.json new file mode 100644 index 0000000000..a20a13f094 --- /dev/null +++ b/.sqlx/query-5b1954301fc16703a04e2f63fd85c28bf2283bc1ecb5624107686dad0dfe364f.json @@ -0,0 +1,124 @@ +{ + "db_name": "MySQL", + "query": "\nSELECT\n s.user_token AS `user_token!: UserToken`,\n u.username AS `username!`,\n u.display_name AS `display_name!`,\n u.email_gravatar_hash AS `email_gravatar_hash!`,\n s.maybe_reengagement_score AS `reengagement_score!: u32`,\n s.lifetime_net_spend_usd_cents,\n s.last_payment_at AS `maybe_last_payment_at: DateTime`,\n s.days_since_last_payment AS `maybe_days_since_last_payment: u32`,\n s.weeks_since_last_spend AS `maybe_weeks_since_last_spend: u32`,\n s.is_active_subscriber AS `is_active_subscriber: bool`\nFROM user_spend_summaries s\nJOIN users u ON u.token = s.user_token\nWHERE s.payments_namespace = ?\n AND s.maybe_reengagement_score > 0\nORDER BY s.maybe_reengagement_score DESC, s.id ASC\nLIMIT ? OFFSET ?\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "user_token!: UserToken", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 128 + } + }, + { + "ordinal": 1, + "name": "username!", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 80 + } + }, + { + "ordinal": 2, + "name": "display_name!", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 80 + } + }, + { + "ordinal": 3, + "name": "email_gravatar_hash!", + "type_info": { + "type": "String", + "flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 128 + } + }, + { + "ordinal": 4, + "name": "reengagement_score!: u32", + "type_info": { + "type": "Long", + "flags": "UNSIGNED", + "char_set": 63, + "max_size": 10 + } + }, + { + "ordinal": 5, + "name": "lifetime_net_spend_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 6, + "name": "maybe_last_payment_at: DateTime", + "type_info": { + "type": "Timestamp", + "flags": "BINARY", + "char_set": 63, + "max_size": 19 + } + }, + { + "ordinal": 7, + "name": "maybe_days_since_last_payment: u32", + "type_info": { + "type": "Long", + "flags": "UNSIGNED", + "char_set": 63, + "max_size": 10 + } + }, + { + "ordinal": 8, + "name": "maybe_weeks_since_last_spend: u32", + "type_info": { + "type": "Long", + "flags": "UNSIGNED", + "char_set": 63, + "max_size": 10 + } + }, + { + "ordinal": 9, + "name": "is_active_subscriber: bool", + "type_info": { + "type": "Tiny", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 1 + } + } + ], + "parameters": { + "Right": 3 + }, + "nullable": [ + false, + false, + false, + false, + true, + false, + true, + true, + true, + false + ] + }, + "hash": "5b1954301fc16703a04e2f63fd85c28bf2283bc1ecb5624107686dad0dfe364f" +} diff --git a/.sqlx/query-77dca63cffdd18957cbc4be6b7d982a2599a2c06df07f8e34501a032cd688ead.json b/.sqlx/query-77dca63cffdd18957cbc4be6b7d982a2599a2c06df07f8e34501a032cd688ead.json new file mode 100644 index 0000000000..dabfc6e171 --- /dev/null +++ b/.sqlx/query-77dca63cffdd18957cbc4be6b7d982a2599a2c06df07f8e34501a032cd688ead.json @@ -0,0 +1,146 @@ +{ + "db_name": "MySQL", + "query": "\nSELECT\n payments_namespace AS `payments_namespace!: PaymentsNamespace`,\n user_token AS `user_token!: UserToken`,\n spend_date AS `spend_date!: NaiveDate`,\n subscription_spend_usd_cents,\n credits_spend_usd_cents,\n gross_spend_usd_cents,\n refund_usd_cents,\n net_spend_usd_cents,\n payment_count,\n credits_granted,\n created_at AS `created_at: DateTime`,\n updated_at AS `updated_at: DateTime`\nFROM user_daily_spends\nWHERE user_token = ?\n AND payments_namespace = ?\nORDER BY spend_date DESC\nLIMIT ? OFFSET ?\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "payments_namespace!: PaymentsNamespace", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 128 + } + }, + { + "ordinal": 1, + "name": "user_token!: UserToken", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 128 + } + }, + { + "ordinal": 2, + "name": "spend_date!: NaiveDate", + "type_info": { + "type": "Date", + "flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE", + "char_set": 63, + "max_size": 10 + } + }, + { + "ordinal": 3, + "name": "subscription_spend_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 4, + "name": "credits_spend_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 5, + "name": "gross_spend_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 6, + "name": "refund_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 7, + "name": "net_spend_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 8, + "name": "payment_count", + "type_info": { + "type": "Long", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 10 + } + }, + { + "ordinal": 9, + "name": "credits_granted", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 10, + "name": "created_at: DateTime", + "type_info": { + "type": "Timestamp", + "flags": "NOT_NULL | BINARY | TIMESTAMP", + "char_set": 63, + "max_size": 19 + } + }, + { + "ordinal": 11, + "name": "updated_at: DateTime", + "type_info": { + "type": "Timestamp", + "flags": "NOT_NULL | BINARY | TIMESTAMP | ON_UPDATE_NOW", + "char_set": 63, + "max_size": 19 + } + } + ], + "parameters": { + "Right": 4 + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "77dca63cffdd18957cbc4be6b7d982a2599a2c06df07f8e34501a032cd688ead" +} diff --git a/.sqlx/query-9715e4dc2ec6e596fdb91ecc50a2b80f63494bbc0c9df6c0a57ede2360716869.json b/.sqlx/query-9715e4dc2ec6e596fdb91ecc50a2b80f63494bbc0c9df6c0a57ede2360716869.json new file mode 100644 index 0000000000..eca9198b24 --- /dev/null +++ b/.sqlx/query-9715e4dc2ec6e596fdb91ecc50a2b80f63494bbc0c9df6c0a57ede2360716869.json @@ -0,0 +1,443 @@ +{ + "db_name": "MySQL", + "query": "\nSELECT\n payments_namespace AS `payments_namespace!: PaymentsNamespace`,\n user_token AS `user_token!: UserToken`,\n lifetime_gross_spend_usd_cents,\n lifetime_subscription_spend_usd_cents,\n lifetime_credits_spend_usd_cents,\n lifetime_refund_usd_cents,\n lifetime_net_spend_usd_cents,\n lifetime_payment_count,\n lifetime_refund_count,\n first_payment_at AS `maybe_first_payment_at: DateTime`,\n first_spend_usd_cents,\n last_payment_at AS `maybe_last_payment_at: DateTime`,\n last_spend_usd_cents,\n days_since_first_payment AS `maybe_days_since_first_payment: u32`,\n days_since_last_payment AS `maybe_days_since_last_payment: u32`,\n net_spend_7d_usd_cents,\n net_spend_prev_7d_usd_cents,\n net_spend_14d_usd_cents,\n net_spend_prev_14d_usd_cents,\n net_spend_30d_usd_cents,\n net_spend_prev_30d_usd_cents,\n net_spend_60d_usd_cents,\n net_spend_90d_usd_cents,\n net_spend_this_year_usd_cents,\n avg_weekly_net_spend_4w_usd_cents,\n avg_weekly_net_spend_12w_usd_cents,\n active_weeks_in_last_4,\n active_weeks_in_last_8,\n active_weeks_in_last_12,\n active_weeks_in_last_24,\n active_weeks_in_last_52,\n consecutive_active_weeks,\n consecutive_inactive_weeks,\n weeks_since_last_spend AS `maybe_weeks_since_last_spend: u32`,\n is_active_subscriber AS `is_active_subscriber: bool`,\n maybe_subscription_interval,\n maybe_reengagement_score AS `maybe_reengagement_score: u32`,\n created_at AS `created_at: DateTime`,\n updated_at AS `updated_at: DateTime`\nFROM user_spend_summaries\nWHERE payments_namespace = ?\n AND user_token = ?\nLIMIT 1\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "payments_namespace!: PaymentsNamespace", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 128 + } + }, + { + "ordinal": 1, + "name": "user_token!: UserToken", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 128 + } + }, + { + "ordinal": 2, + "name": "lifetime_gross_spend_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 3, + "name": "lifetime_subscription_spend_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 4, + "name": "lifetime_credits_spend_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 5, + "name": "lifetime_refund_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 6, + "name": "lifetime_net_spend_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 7, + "name": "lifetime_payment_count", + "type_info": { + "type": "Long", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 10 + } + }, + { + "ordinal": 8, + "name": "lifetime_refund_count", + "type_info": { + "type": "Long", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 10 + } + }, + { + "ordinal": 9, + "name": "maybe_first_payment_at: DateTime", + "type_info": { + "type": "Timestamp", + "flags": "BINARY", + "char_set": 63, + "max_size": 19 + } + }, + { + "ordinal": 10, + "name": "first_spend_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 11, + "name": "maybe_last_payment_at: DateTime", + "type_info": { + "type": "Timestamp", + "flags": "BINARY", + "char_set": 63, + "max_size": 19 + } + }, + { + "ordinal": 12, + "name": "last_spend_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 13, + "name": "maybe_days_since_first_payment: u32", + "type_info": { + "type": "Long", + "flags": "UNSIGNED", + "char_set": 63, + "max_size": 10 + } + }, + { + "ordinal": 14, + "name": "maybe_days_since_last_payment: u32", + "type_info": { + "type": "Long", + "flags": "UNSIGNED", + "char_set": 63, + "max_size": 10 + } + }, + { + "ordinal": 15, + "name": "net_spend_7d_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 16, + "name": "net_spend_prev_7d_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 17, + "name": "net_spend_14d_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 18, + "name": "net_spend_prev_14d_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 19, + "name": "net_spend_30d_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 20, + "name": "net_spend_prev_30d_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 21, + "name": "net_spend_60d_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 22, + "name": "net_spend_90d_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 23, + "name": "net_spend_this_year_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 24, + "name": "avg_weekly_net_spend_4w_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 25, + "name": "avg_weekly_net_spend_12w_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 26, + "name": "active_weeks_in_last_4", + "type_info": { + "type": "Tiny", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 3 + } + }, + { + "ordinal": 27, + "name": "active_weeks_in_last_8", + "type_info": { + "type": "Tiny", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 3 + } + }, + { + "ordinal": 28, + "name": "active_weeks_in_last_12", + "type_info": { + "type": "Tiny", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 3 + } + }, + { + "ordinal": 29, + "name": "active_weeks_in_last_24", + "type_info": { + "type": "Tiny", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 3 + } + }, + { + "ordinal": 30, + "name": "active_weeks_in_last_52", + "type_info": { + "type": "Tiny", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 3 + } + }, + { + "ordinal": 31, + "name": "consecutive_active_weeks", + "type_info": { + "type": "Long", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 10 + } + }, + { + "ordinal": 32, + "name": "consecutive_inactive_weeks", + "type_info": { + "type": "Long", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 10 + } + }, + { + "ordinal": 33, + "name": "maybe_weeks_since_last_spend: u32", + "type_info": { + "type": "Long", + "flags": "UNSIGNED", + "char_set": 63, + "max_size": 10 + } + }, + { + "ordinal": 34, + "name": "is_active_subscriber: bool", + "type_info": { + "type": "Tiny", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 1 + } + }, + { + "ordinal": 35, + "name": "maybe_subscription_interval", + "type_info": { + "type": "VarString", + "flags": "BINARY", + "char_set": 224, + "max_size": 64 + } + }, + { + "ordinal": 36, + "name": "maybe_reengagement_score: u32", + "type_info": { + "type": "Long", + "flags": "UNSIGNED", + "char_set": 63, + "max_size": 10 + } + }, + { + "ordinal": 37, + "name": "created_at: DateTime", + "type_info": { + "type": "Timestamp", + "flags": "NOT_NULL | BINARY | TIMESTAMP", + "char_set": 63, + "max_size": 19 + } + }, + { + "ordinal": 38, + "name": "updated_at: DateTime", + "type_info": { + "type": "Timestamp", + "flags": "NOT_NULL | BINARY | TIMESTAMP | ON_UPDATE_NOW", + "char_set": 63, + "max_size": 19 + } + } + ], + "parameters": { + "Right": 2 + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + true, + false, + true, + false, + true, + true, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + true, + false, + true, + true, + false, + false + ] + }, + "hash": "9715e4dc2ec6e596fdb91ecc50a2b80f63494bbc0c9df6c0a57ede2360716869" +} diff --git a/.sqlx/query-d5d3a59ea4885868b26168cd305f6168a1e62fe9f8fa663063591335c645b927.json b/.sqlx/query-d5d3a59ea4885868b26168cd305f6168a1e62fe9f8fa663063591335c645b927.json new file mode 100644 index 0000000000..d507b4bc36 --- /dev/null +++ b/.sqlx/query-d5d3a59ea4885868b26168cd305f6168a1e62fe9f8fa663063591335c645b927.json @@ -0,0 +1,212 @@ +{ + "db_name": "MySQL", + "query": "\nSELECT\n e.token AS `token!: UserSpendEventToken`,\n e.payments_namespace AS `payments_namespace!`,\n e.maybe_user_token AS `maybe_user_token: UserToken`,\n u.username AS `maybe_username?`,\n u.display_name AS `maybe_display_name?`,\n u.email_gravatar_hash AS `maybe_email_gravatar_hash?`,\n e.event_type AS `event_type!`,\n e.amount_usd_cents,\n e.maybe_credits_granted AS `maybe_credits_granted: u32`,\n e.payment_source AS `payment_source!`,\n e.source_object_id AS `maybe_source_object_id`,\n e.maybe_stripe_invoice_id,\n e.maybe_stripe_payment_intent_id,\n e.maybe_stripe_charge_id,\n e.maybe_stripe_customer_id,\n e.is_production AS `is_production: bool`,\n e.payment_occurred_at AS `payment_occurred_at!: DateTime`,\n e.created_at AS `created_at!: DateTime`\nFROM user_spend_events e\nLEFT JOIN users u ON u.token = e.maybe_user_token\nWHERE (? IS NULL OR e.payments_namespace = ?)\nORDER BY e.payment_occurred_at DESC, e.id DESC\nLIMIT ? OFFSET ?\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "token!: UserSpendEventToken", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 128 + } + }, + { + "ordinal": 1, + "name": "payments_namespace!", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 128 + } + }, + { + "ordinal": 2, + "name": "maybe_user_token: UserToken", + "type_info": { + "type": "VarString", + "flags": "MULTIPLE_KEY | BINARY", + "char_set": 224, + "max_size": 128 + } + }, + { + "ordinal": 3, + "name": "maybe_username?", + "type_info": { + "type": "VarString", + "flags": "UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 80 + } + }, + { + "ordinal": 4, + "name": "maybe_display_name?", + "type_info": { + "type": "VarString", + "flags": "BINARY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 80 + } + }, + { + "ordinal": 5, + "name": "maybe_email_gravatar_hash?", + "type_info": { + "type": "String", + "flags": "BINARY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 128 + } + }, + { + "ordinal": 6, + "name": "event_type!", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 128 + } + }, + { + "ordinal": 7, + "name": "amount_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL | NO_DEFAULT_VALUE", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 8, + "name": "maybe_credits_granted: u32", + "type_info": { + "type": "Long", + "flags": "UNSIGNED", + "char_set": 63, + "max_size": 10 + } + }, + { + "ordinal": 9, + "name": "payment_source!", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 64 + } + }, + { + "ordinal": 10, + "name": "maybe_source_object_id", + "type_info": { + "type": "VarString", + "flags": "BINARY", + "char_set": 224, + "max_size": 1020 + } + }, + { + "ordinal": 11, + "name": "maybe_stripe_invoice_id", + "type_info": { + "type": "VarString", + "flags": "MULTIPLE_KEY | BINARY", + "char_set": 224, + "max_size": 1020 + } + }, + { + "ordinal": 12, + "name": "maybe_stripe_payment_intent_id", + "type_info": { + "type": "VarString", + "flags": "BINARY", + "char_set": 224, + "max_size": 1020 + } + }, + { + "ordinal": 13, + "name": "maybe_stripe_charge_id", + "type_info": { + "type": "VarString", + "flags": "BINARY", + "char_set": 224, + "max_size": 1020 + } + }, + { + "ordinal": 14, + "name": "maybe_stripe_customer_id", + "type_info": { + "type": "VarString", + "flags": "MULTIPLE_KEY | BINARY", + "char_set": 224, + "max_size": 1020 + } + }, + { + "ordinal": 15, + "name": "is_production: bool", + "type_info": { + "type": "Tiny", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 1 + } + }, + { + "ordinal": 16, + "name": "payment_occurred_at!: DateTime", + "type_info": { + "type": "Timestamp", + "flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE", + "char_set": 63, + "max_size": 19 + } + }, + { + "ordinal": 17, + "name": "created_at!: DateTime", + "type_info": { + "type": "Timestamp", + "flags": "NOT_NULL | BINARY | TIMESTAMP", + "char_set": 63, + "max_size": 19 + } + } + ], + "parameters": { + "Right": 4 + }, + "nullable": [ + false, + false, + true, + true, + true, + true, + false, + false, + true, + false, + true, + true, + true, + true, + true, + false, + false, + false + ] + }, + "hash": "d5d3a59ea4885868b26168cd305f6168a1e62fe9f8fa663063591335c645b927" +} diff --git a/.sqlx/query-f4df0d23d95aded2f55d464344b32a6db63e406cff009325ce92dbdd0932809c.json b/.sqlx/query-f4df0d23d95aded2f55d464344b32a6db63e406cff009325ce92dbdd0932809c.json deleted file mode 100644 index e954d44dd6..0000000000 --- a/.sqlx/query-f4df0d23d95aded2f55d464344b32a6db63e406cff009325ce92dbdd0932809c.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "db_name": "MySQL", - "query": "\nINSERT INTO user_spend_summaries\nSET\n payments_namespace = ?,\n user_token = ?,\n lifetime_gross_spend_usd_cents = ?,\n lifetime_subscription_spend_usd_cents = ?,\n lifetime_credits_spend_usd_cents = ?,\n lifetime_refund_usd_cents = ?,\n lifetime_net_spend_usd_cents = ?,\n lifetime_payment_count = ?,\n lifetime_refund_count = ?,\n first_payment_at = ?,\n first_spend_usd_cents = ?,\n last_payment_at = ?,\n last_spend_usd_cents = ?,\n days_since_first_payment = ?,\n days_since_last_payment = ?,\n net_spend_this_year_usd_cents = ?,\n consecutive_active_weeks = ?,\n consecutive_inactive_weeks = ?,\n weeks_since_last_spend = ?,\n is_active_subscriber = ?,\n maybe_subscription_interval = ?,\n maybe_reengagement_score = ?\nON DUPLICATE KEY UPDATE\n lifetime_gross_spend_usd_cents = VALUES(lifetime_gross_spend_usd_cents),\n lifetime_subscription_spend_usd_cents = VALUES(lifetime_subscription_spend_usd_cents),\n lifetime_credits_spend_usd_cents = VALUES(lifetime_credits_spend_usd_cents),\n lifetime_refund_usd_cents = VALUES(lifetime_refund_usd_cents),\n lifetime_net_spend_usd_cents = VALUES(lifetime_net_spend_usd_cents),\n lifetime_payment_count = VALUES(lifetime_payment_count),\n lifetime_refund_count = VALUES(lifetime_refund_count),\n first_payment_at = VALUES(first_payment_at),\n first_spend_usd_cents = VALUES(first_spend_usd_cents),\n last_payment_at = VALUES(last_payment_at),\n last_spend_usd_cents = VALUES(last_spend_usd_cents),\n days_since_first_payment = VALUES(days_since_first_payment),\n days_since_last_payment = VALUES(days_since_last_payment),\n net_spend_this_year_usd_cents = VALUES(net_spend_this_year_usd_cents),\n consecutive_active_weeks = VALUES(consecutive_active_weeks),\n consecutive_inactive_weeks = VALUES(consecutive_inactive_weeks),\n weeks_since_last_spend = VALUES(weeks_since_last_spend),\n is_active_subscriber = VALUES(is_active_subscriber),\n maybe_subscription_interval = VALUES(maybe_subscription_interval),\n maybe_reengagement_score = VALUES(maybe_reengagement_score)\n ", - "describe": { - "columns": [], - "parameters": { - "Right": 22 - }, - "nullable": [] - }, - "hash": "f4df0d23d95aded2f55d464344b32a6db63e406cff009325ce92dbdd0932809c" -} diff --git a/.sqlx/query-f6db2f3bf8695fa8431db209576328154b8ac20aa6e899739095b6206bb38944.json b/.sqlx/query-f6db2f3bf8695fa8431db209576328154b8ac20aa6e899739095b6206bb38944.json new file mode 100644 index 0000000000..378b429dd5 --- /dev/null +++ b/.sqlx/query-f6db2f3bf8695fa8431db209576328154b8ac20aa6e899739095b6206bb38944.json @@ -0,0 +1,157 @@ +{ + "db_name": "MySQL", + "query": "\nSELECT\n s.user_token AS `user_token!: UserToken`,\n u.username AS `username!`,\n u.display_name AS `display_name!`,\n u.email_gravatar_hash AS `email_gravatar_hash!`,\n s.lifetime_net_spend_usd_cents,\n s.net_spend_7d_usd_cents,\n s.net_spend_14d_usd_cents,\n s.net_spend_30d_usd_cents,\n s.net_spend_60d_usd_cents,\n s.net_spend_90d_usd_cents,\n s.net_spend_this_year_usd_cents,\n s.is_active_subscriber AS `is_active_subscriber: bool`,\n s.maybe_reengagement_score AS `maybe_reengagement_score: u32`\nFROM user_spend_summaries s\nJOIN users u ON u.token = s.user_token\nWHERE s.payments_namespace = ?\nORDER BY\n (CASE ?\n WHEN '7d' THEN s.net_spend_7d_usd_cents\n WHEN '14d' THEN s.net_spend_14d_usd_cents\n WHEN '30d' THEN s.net_spend_30d_usd_cents\n WHEN '60d' THEN s.net_spend_60d_usd_cents\n WHEN '90d' THEN s.net_spend_90d_usd_cents\n WHEN '1y' THEN s.net_spend_this_year_usd_cents\n ELSE CAST(s.lifetime_net_spend_usd_cents AS SIGNED)\n END) DESC,\n s.id ASC\nLIMIT ? OFFSET ?\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "user_token!: UserToken", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 128 + } + }, + { + "ordinal": 1, + "name": "username!", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 80 + } + }, + { + "ordinal": 2, + "name": "display_name!", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 80 + } + }, + { + "ordinal": 3, + "name": "email_gravatar_hash!", + "type_info": { + "type": "String", + "flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 128 + } + }, + { + "ordinal": 4, + "name": "lifetime_net_spend_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL | UNSIGNED", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 5, + "name": "net_spend_7d_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 6, + "name": "net_spend_14d_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 7, + "name": "net_spend_30d_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 8, + "name": "net_spend_60d_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 9, + "name": "net_spend_90d_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 10, + "name": "net_spend_this_year_usd_cents", + "type_info": { + "type": "LongLong", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 20 + } + }, + { + "ordinal": 11, + "name": "is_active_subscriber: bool", + "type_info": { + "type": "Tiny", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 1 + } + }, + { + "ordinal": 12, + "name": "maybe_reengagement_score: u32", + "type_info": { + "type": "Long", + "flags": "UNSIGNED", + "char_set": 63, + "max_size": 10 + } + } + ], + "parameters": { + "Right": 4 + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + true + ] + }, + "hash": "f6db2f3bf8695fa8431db209576328154b8ac20aa6e899739095b6206bb38944" +}