{"id":50454080,"url":"https://github.com/mizcausevic-dev/revops-database-lab","last_synced_at":"2026-06-01T01:05:37.738Z","repository":{"id":356353042,"uuid":"1232128128","full_name":"mizcausevic-dev/revops-database-lab","owner":"mizcausevic-dev","description":"PostgreSQL revenue operations lab for pipeline modeling, attribution analysis, forecast visibility, and renewal risk reporting.","archived":false,"fork":false,"pushed_at":"2026-05-17T05:15:33.000Z","size":259,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-17T07:30:06.171Z","etag":null,"topics":["analytics","attribution","data-modeling","database-design","forecasting","postgresql","revenue-operations","saas","sql"],"latest_commit_sha":null,"homepage":"https://mizcausevic.com/skills/","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mizcausevic-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-07T16:04:34.000Z","updated_at":"2026-05-17T05:15:36.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mizcausevic-dev/revops-database-lab","commit_stats":null,"previous_names":["mizcausevic-dev/revops-database-lab"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mizcausevic-dev/revops-database-lab","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mizcausevic-dev%2Frevops-database-lab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mizcausevic-dev%2Frevops-database-lab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mizcausevic-dev%2Frevops-database-lab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mizcausevic-dev%2Frevops-database-lab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mizcausevic-dev","download_url":"https://codeload.github.com/mizcausevic-dev/revops-database-lab/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mizcausevic-dev%2Frevops-database-lab/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33755379,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics","attribution","data-modeling","database-design","forecasting","postgresql","revenue-operations","saas","sql"],"created_at":"2026-06-01T01:05:37.647Z","updated_at":"2026-06-01T01:05:37.733Z","avatar_url":"https://github.com/mizcausevic-dev.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Revenue Operations Database Lab\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003ePostgreSQL revenue systems portfolio project\u003c/strong\u003e\u003cbr/\u003e\n  Normalized SaaS data model for pipeline, attribution, renewals, forecasting, and operating metrics.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.postgresql.org/docs/\"\u003e\u003cimg alt=\"PostgreSQL 16+\" src=\"https://img.shields.io/badge/PostgreSQL-16%2B-17324D?style=for-the-badge\u0026logo=postgresql\u0026logoColor=white\u0026labelColor=0F172A\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.postgresql.org/docs/current/sql.html\"\u003e\u003cimg alt=\"SQL Standard\" src=\"https://img.shields.io/badge/SQL-Analytics-395C8A?style=for-the-badge\u0026logo=postgresql\u0026logoColor=white\u0026labelColor=0F172A\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://docs.github.com/en/actions\"\u003e\u003cimg alt=\"GitHub Actions\" src=\"https://img.shields.io/badge/CI-GitHub%20Actions-2962FF?style=for-the-badge\u0026logo=githubactions\u0026logoColor=white\u0026labelColor=0F172A\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://opensource.org/license/mit\"\u003e\u003cimg alt=\"License MIT\" src=\"https://img.shields.io/badge/License-MIT-84CC16?style=for-the-badge\u0026logo=opensourceinitiative\u0026logoColor=white\u0026labelColor=0F172A\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003e **Recruiter takeaway:** *This portfolio piece shows production-minded data modeling, revenue analytics fluency, and the ability to design the data layer underneath growth, forecast, attribution, and retention systems.*\n\n---\n\n## Executive Summary\n\nRevOps Database Lab is a PostgreSQL-first portfolio project built to model the operating data behind modern SaaS revenue systems. It covers accounts, campaigns, leads, opportunities, attribution touches, subscriptions, renewals, and content influence in a normalized schema that supports executive reporting and operator workflows.\n\nThis repo is designed to look like the database layer beneath the other systems in the portfolio: revenue ops, attribution, forecasting, customer health, partner distribution, and executive dashboards.\n\n---\n\n## Project Overview\n\n| Attribute | Detail |\n|---|---|\n| **Database** | PostgreSQL 16+ |\n| **Schema Style** | 3NF-oriented normalized schema with UUID primary keys |\n| **Domain** | B2B SaaS revenue operations |\n| **Coverage** | Pipeline, attribution, renewals, content influence, forecast posture |\n| **Seed Data** | 12 accounts · 8 campaigns · 24 leads · 14 opportunities · 10 subscriptions |\n| **Artifacts** | Schema, seed data, analytics SQL, ERD, architecture notes, CI |\n\n---\n\n## Business Problem\n\nRevenue organizations usually report from fragmented systems:\n\n- CRM data captures opportunity state but not full attribution context\n- campaign reporting shows activity but not pipeline quality\n- renewal visibility often lives in disconnected CS spreadsheets\n- content influence is rarely modeled cleanly enough for operational queries\n- forecasting gets distorted when pipeline, renewal, and attribution logic are not aligned\n\nThe result is noisy reporting, weak operating leverage, and low confidence in executive numbers.\n\n---\n\n## Solution\n\nThis database models a practical revenue operations substrate:\n\n- **Accounts** anchor company-level commercial context\n- **Campaigns** and **content assets** capture demand generation inputs\n- **Leads** represent early pipeline and acquisition motion\n- **Opportunities** represent pipeline and sales execution\n- **Attribution touches** make influence visible without flattening the model\n- **Subscriptions** and **renewals** surface expansion, contraction, and churn exposure\n\nThe included queries translate that data into the kinds of metrics leadership teams actually use.\n\n---\n\n## Screenshots\n\n### Schema Overview\n\n![Schema overview](https://raw.githubusercontent.com/mizcausevic-dev/revops-database-lab/project/revops-database-lab/screenshots/01-schema-overview.png)\n\n### Funnel and Attribution\n\n![Funnel and attribution](https://raw.githubusercontent.com/mizcausevic-dev/revops-database-lab/project/revops-database-lab/screenshots/02-funnel-attribution.png)\n\n### Forecast and Renewals\n\n![Forecast and renewals](https://raw.githubusercontent.com/mizcausevic-dev/revops-database-lab/project/revops-database-lab/screenshots/03-forecast-renewals.png)\n\n### Query Proof\n\n![Query proof](https://raw.githubusercontent.com/mizcausevic-dev/revops-database-lab/project/revops-database-lab/screenshots/04-query-proof.png)\n\n---\n\n## Schema Architecture\n\n```mermaid\nflowchart LR\n  A[\"accounts\"] --\u003e B[\"leads\"]\n  A --\u003e C[\"opportunities\"]\n  A --\u003e D[\"subscriptions\"]\n  A --\u003e E[\"renewals\"]\n  F[\"campaigns\"] --\u003e B\n  G[\"content_assets\"] --\u003e H[\"attribution_touches\"]\n  F --\u003e H\n  B --\u003e H\n  C --\u003e H\n  D --\u003e E\n```\n\n### Core Tables\n\n| Table | Purpose | Key Columns |\n|---|---|---|\n| `accounts` | B2B customer and prospect master | `account_id`, `industry`, `region`, `employee_count`, `account_tier` |\n| `campaigns` | Demand-gen spend and channel context | `campaign_id`, `channel`, `budget`, `status`, `launch_date` |\n| `content_assets` | Content influence and governance layer | `asset_id`, `asset_type`, `theme`, `owner_team`, `published_at` |\n| `leads` | Acquisition-stage records | `lead_id`, `source_channel`, `stage`, `mql_date`, `sql_date` |\n| `opportunities` | Pipeline and forecast records | `opportunity_id`, `stage`, `forecast_category`, `amount`, `expected_close_date` |\n| `attribution_touches` | Multi-touch influence mapping | `touch_id`, `touch_position`, `touch_weight`, `touch_date` |\n| `subscriptions` | Active commercial contracts | `subscription_id`, `arr_value`, `term_months`, `billing_frequency` |\n| `renewals` | Renewal posture and risk | `renewal_id`, `renewal_status`, `risk_level`, `renewal_arr` |\n\n---\n\n## Key Design Decisions\n\n| Decision | Rationale |\n|---|---|\n| **UUID primary keys** | Clean external-safe identifiers and realistic distributed-system posture |\n| **Enum-backed lifecycle states** | Enforces valid lead, opportunity, and renewal transitions |\n| **Separate attribution table** | Preserves campaign and content influence without denormalizing pipeline |\n| **Content modeled as first-class entity** | Reflects how modern GTM teams connect content to pipeline |\n| **Renewals split from subscriptions** | Keeps current contract state separate from renewal event tracking |\n| **Forecast category on opportunities** | Enables commit / best-case / pipeline analysis directly in SQL |\n\n---\n\n## Analytics Queries\n\nThe repo includes eight business-grade SQL analyses in [sql/queries.sql](./sql/queries.sql):\n\n1. **Pipeline Coverage by Quarter**\n2. **CAC by Campaign Channel**\n3. **Lead-to-Opportunity Conversion by Campaign**\n4. **Attributed Pipeline by Touch Position**\n5. **Renewal Risk Exposure**\n6. **Forecast Category Coverage**\n7. **Content-Influenced Pipeline**\n8. **Partner-Sourced Win Performance**\n\n### Example Query\n\n```sql\nSELECT forecast_category,\n       COUNT(*) AS opportunities,\n       SUM(amount) AS total_pipeline\nFROM opportunities\nWHERE stage NOT IN ('closed_won', 'closed_lost')\nGROUP BY forecast_category\nORDER BY total_pipeline DESC;\n```\n\n---\n\n## Local Setup\n\n### Option 1: Local PostgreSQL\n\n```bash\ncreatedb revops_lab\npsql -d revops_lab -f sql/schema.sql\npsql -d revops_lab -f sql/seed.sql\npsql -d revops_lab -f sql/queries.sql\n```\n\n### Option 2: Docker\n\n```bash\ndocker run --name revops-lab -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=revops_lab -p 5432:5432 -d postgres:16\npsql -h localhost -U postgres -d revops_lab -f sql/schema.sql\npsql -h localhost -U postgres -d revops_lab -f sql/seed.sql\npsql -h localhost -U postgres -d revops_lab -f sql/queries.sql\n```\n\n---\n\n## Validation\n\n- GitHub Actions CI provisions PostgreSQL and runs schema, seed, and analytics SQL\n- Local validation in this environment may depend on whether `psql` is installed\n- The SQL artifacts are structured to run cleanly in CI against PostgreSQL 16\n\n---\n\n## What This Demonstrates\n\n- normalized schema design for revenue systems\n- realistic B2B SaaS seed modeling\n- multi-touch attribution structure\n- forecast and renewal analysis\n- content and campaign influence modeling\n- SQL fluency tied to business decisions, not toy examples\n\n---\n\n## Future Enhancements\n\n- materialized views for executive dashboards\n- dbt transformations and source freshness tests\n- dimensional reporting layer for BI consumption\n- synthetic monthly snapshots for trend analysis\n- role-based query access examples\n\n---\n\n## Portfolio Links\n\n- [Kinetic Gain](https://kineticgain.com/)\n- [Skills / Portfolio](https://mizcausevic.com/skills/)\n- [LinkedIn](https://www.linkedin.com/in/mirzacausevic)\n- [Medium](https://medium.com/@mizcausevic)\n- [GitHub](https://github.com/mizcausevic-dev)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmizcausevic-dev%2Frevops-database-lab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmizcausevic-dev%2Frevops-database-lab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmizcausevic-dev%2Frevops-database-lab/lists"}