Skip to content

Instantly share code, notes, and snippets.

View ijunaid8989's full-sized avatar
πŸ‡΅πŸ‡°
It may have escaped your notice but life isn't fair.

Junaid Farooq ijunaid8989

πŸ‡΅πŸ‡°
It may have escaped your notice but life isn't fair.
  • Islamabad Pakistan
View GitHub Profile
channel_product_id core_product_type_id price currency is_recommended inserted_at name
d0e5de76-ed50-4613-8a0f-b81119e1324f 0829f981-3a0c-493a-af26-bee582985565 USD false 2025-05-08 18:39:49.630 Russian Federation (data) - 10GB, 1 day, Unlimited
45b03171-aa5b-4261-92c3-fb1573b5cf26 0829f981-3a0c-493a-af26-bee582985565 8.45 USD false 2026-03-10 02:59:00.484 Russian Federation (data) - 1 day, 10GB, Unlimited
99f70570-88d8-4dde-9ef8-5299c1905b69 119f7950-7548-4541-a04b-eae5255c3993 USD false 2025-04-15 15:42:28.480 Trinidad and Tobago (data) - 10GB, 1 day, Unlimited
015a3ee4-8632-41c1-a6dd-3e8a50068136 119f7950-7548-4541-a04b-eae5255c3993 11.9 USD false 2026-03-10 02:59:00.451 Trinidad and Tobago (data) - 1 day, 10GB, Unlimited
7ace3963-12d1-40c0-b213-9f7b4c70176a 1d72bcf5-d007-4a3e-8717-13f823116918 USD false 2025-04-15 15:42:22.496 Chile (data) - 10GB, 1 day, Unlimited
6dc7c580-836f-43ab-80f2-230119bc7d2f 1
Limit (cost=75619.09..75619.14 rows=1 width=84) (actual time=101099.589..101099.594 rows=1 loops=1)
Output: ((m.inserted_at)::date), c.updated_by_id, c.organization_id, (count(c.id)), ((sum((COALESCE(sum(m.segments) FILTER (WHERE ((m.type)::text = 'sms'::text)), '0'::bigint))))::integer), ((sum((COALESCE(sum(m.segments) FILTER (WHERE ((m.type)::text = 'mms'::text)), '0'::bigint))))::integer), (sum(a.sent_messages)), (sum(a.failed_deliveries)), (sum(a.unsubscribes)), (sum(a.responses)), (sum(a.link_clicks))
Buffers: shared hit=3268301
-> GroupAggregate (cost=75619.09..75619.19 rows=2 width=84) (actual time=101099.587..101099.592 rows=1 loops=1)
Output: ((m.inserted_at)::date), c.updated_by_id, c.organization_id, count(c.id), (sum((COALESCE(sum(m.segments) FILTER (WHERE ((m.type)::text = 'sms'::text)), '0'::bigint))))::integer, (sum((COALESCE(sum(m.segments) FILTER (WHERE ((m.type)::text = 'mms'::text)), '0'::bigint))))::integer, sum(a.sent_messages), sum(a.failed_deliveries), sum(a.unsubscribe
iex(6)> DashboardApi.Workers.MessageDetailsBackfill.enqueue
{:ok,
%Oban.Job{
__meta__: #Ecto.Schema.Metadata<:loaded, "public", "oban_jobs">,
id: 9,
state: "available",
queue: "message_details_backfill",
worker: "DashboardApi.Workers.MessageDetailsBackfill",
args: %{},
meta: %{},
defmodule Truely.EventsRepo.Migrations.AddSessionUsageProjection do
use Ecto.Migration
def up do
cluster_name = System.get_env("CLICKHOUSE_CLUSTER") || nil
cluster_stmt = if cluster_name, do: "ON CLUSTER #{cluster_name}", else: ""
execute """
ALTER TABLE core_subscriptions_events_local #{cluster_stmt}
ADD PROJECTION session_usage_by_esim
def list_plan_types_paginated(
search,
order_by \\ "id",
direction \\ "desc",
limit \\ 50,
cursor_after \\ nil,
cursor_before \\ nil,
opts \\ []
) do
from(p in PlanType, as: :plan_type)
def list_plan_types_paginated(
search,
order_by \\ "id",
direction \\ "desc",
limit \\ 50,
cursor_after \\ nil,
cursor_before \\ nil,
opts \\ []
) do
from(p in PlanType, as: :plan_type)
WITH active_enforcement AS (
SELECT DISTINCT ON (en.company_id, en.store_id, en.created_at)
en.id,
en.company_id,
en.store_id,
en.enforcement_statuses_id
FROM enforcements en
WHERE en.enforcement_statuses_id IN (1, 2, 3, 4)
ORDER BY en.company_id, en.store_id, en.created_at DESC
),
WITH active_enforcement AS (
SELECT DISTINCT ON (en.company_id, en.store_id, en.created_at)
en.*
FROM enforcements en
WHERE en.enforcement_statuses_id IN (1, 2, 3, 4)
ORDER BY en.created_at DESC
),
active_test_purchase AS (
SELECT DISTINCT ON (tp.company_id, tp.store_id, tp.created_at)
tp.*
SELECT s0."age_id",
Count(s0."id"),
s0."age_bucket"
FROM (
SELECT sm0."id" AS "id",
CASE
WHEN age < 1 THEN 1
WHEN age < 7 THEN 7
WHEN age < 31 THEN 31
ELSE NULL
SELECT s0."age_id",
Count(s0."id"),
s0."age_bucket"
FROM (
SELECT sm0."id" AS "id",
CASE
WHEN age < 1 THEN 1
WHEN age < 7 THEN 7
WHEN age < 31 THEN 31
ELSE NULL