Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions shared/django_apps/codecov_auth/migrations/0066_add_pro_plan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
from django.db import migrations

from shared.django_apps.utils.config import RUN_ENV


def add_pro_plan(apps, schema_editor):
if RUN_ENV != "ENTERPRISE":
return

Plan = apps.get_model("codecov_auth", "Plan")
Tier = apps.get_model("codecov_auth", "Tier")
Owner = apps.get_model("codecov_auth", "Owner")
Account = apps.get_model("codecov_auth", "Account")

defaults = {
"bundle_analysis": True,
"test_analytics": True,
"flaky_test_detection": True,
"project_coverage": True,
"private_repo_support": True,
}
pro_tier, _ = Tier.objects.update_or_create(
tier_name="pro",
defaults=defaults,
)

plan_defaults = {
"tier": pro_tier,
"base_unit_price": 10,
"benefits": [
"Configurable # of users",
"Unlimited public repositories",
"Unlimited private repositories",
"Priority Support",
],
"billing_rate": "annually",
"is_active": True,
"marketing_name": "Pro",
"max_seats": None,
"monthly_uploads_limit": None,
"paid_plan": True,
}

Plan.objects.update_or_create(
name="users-pr-inappy",
defaults=plan_defaults,
)

Owner.objects.all().update(plan="users-pr-inappy")

Account.objects.all().update(plan="users-pr-inappy")


class Migration(migrations.Migration):
dependencies = [
("codecov_auth", "0065_alter_account_plan_alter_owner_plan"),
]

operations = [
migrations.RunPython(add_pro_plan),
]
1 change: 1 addition & 0 deletions shared/django_apps/dummy_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
# Needed as certain migrations refer to it
SKIP_RISKY_MIGRATION_STEPS = get_config("migrations", "skip_risky_steps", default=False) # noqa: F405


TEST = True

# Database
Expand Down
4 changes: 3 additions & 1 deletion shared/plan/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from dataclasses import dataclass
from typing import List, Optional

from shared.django_apps.utils.config import RUN_ENV


class MonthlyUploadLimits(enum.Enum):
CODECOV_FREE_PLAN = 250
Expand All @@ -23,7 +25,7 @@ class PlanMarketingName(enum.Enum):
TEAM = "Team"


DEFAULT_FREE_PLAN = "users-developer"
DEFAULT_FREE_PLAN = "users-pr-inappy" if RUN_ENV == "ENTERPRISE" else "users-developer"


class PlanName(enum.Enum):
Expand Down