Last active
January 14, 2025 03:07
-
-
Save clarkbw/1e9eab452eaebb41aa6d403b79d8cdc0 to your computer and use it in GitHub Desktop.
SQL case to segment the database services by their URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case | |
when host like '%cluster-%.rds.amazonaws.com%' then 'Aurora' | |
when host like '%rds.amazonaws.com%' then 'RDS' | |
when host like 'ec2%' then 'EC2 Self-Hosted' | |
when host like '%supabase.co%' then 'Supabase' -- db.project.supabase.co & region.supabase.com | |
when host like '%timescale.com%' then 'Timescale' | |
when host like '%postgres.vercel-storage.com%' then 'Vercel Postgres' | |
when host like '%azure.neon.tech%' then 'Neon (Azure)' | |
when host like '%aws.neon.tech%' then 'Neon (AWS)' | |
when host like '%.turso.io%' then 'Turso' | |
when host like '%xata.sh%' then 'Xata' | |
when host like '%postgres.render.com%' then 'Render' | |
when host like '%aivencloud.com%' then 'Aiven' | |
when host like '%elephantsql.com%' then 'Elephant SQL' | |
when host like '%psdb.cloud%' then 'PlanetScale' | |
when host like '%postgres.database.azure.com%' then 'Azure Postgres' | |
when host like '%mysql.database.azure.com%' then 'Azure MySQL' | |
when host like '%cosmos.azure.com%' then 'Azure CosmosDB' | |
when host like '%prisma-data.net%' then 'Prisma Postgres' | |
when host like '%db.ondigitalocean.com%' then 'Digital Ocean' | |
when host like '%rlwy.net%' then 'Railway' | |
when host like 'localhost%' then 'localhost' | |
when host like '%fly.dev%' then 'Fly.io' | |
when (host LIKE '%.%.%.%' OR host LIKE '%.%.%.%:%') then 'IP Address' -- 1.1.1.1 or 1.1.1.1:5432 | |
else 'Custom' | |
end | |
from migrations; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment