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
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
{
"attributes": {
"referrals": null,
"miscarriages": 19,
"notes": [],
"form": {
"id": "9b5716fd-a0bb-47d6-bf23-68b18acc0195",
"type": "medical:form"
},
"room": null,
@ijunaid8989
ijunaid8989 / Howto.md
Created February 1, 2024 20:40 — forked from jeregrine/Howto.md
Setting up Redo and Poolboy for redis connections in Elixir

Then add

worker(Redis, []),

to your supervision tree