Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Create plans and tiers tables #467

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

RulaKhaled
Copy link
Contributor

To replace plans representation, we're making plans configurable through the DB.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Copy link

codecov bot commented Jan 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.97%. Comparing base (d4ee906) to head (2767d12).

Current head 2767d12 differs from pull request most recent head 606857e

Please upload reports for the commit 606857e to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #467      +/-   ##
==========================================
- Coverage   90.55%   89.97%   -0.58%     
==========================================
  Files         404      324      -80     
  Lines       12562     9198    -3364     
  Branches     2107     1633     -474     
==========================================
- Hits        11375     8276    -3099     
+ Misses       1078      859     -219     
+ Partials      109       63      -46     
Flag Coverage Δ
shared-docker-uploader ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


class BillingRate(models.TextChoices):
MONTHLY = "monthly"
YEARLY = "yearly"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use PlanBillingRate?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +1008 to +1010
tier = models.ForeignKey(
"Tiers", on_delete=models.CASCADE, related_name="plans", db_index=True
)
Copy link
Contributor

@nora-codecov nora-codecov Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tier = models.ForeignKey(
"Tiers", on_delete=models.CASCADE, related_name="plans", db_index=True
)
tier = models.ForeignKey(
"Tiers", on_delete=models.SET_NULL, related_name="plans"
)

I removed the index, seems unnecessary for a small table, but up to you

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed with Nora, probably don't need an index here

tier = models.ForeignKey(
"Tiers", on_delete=models.CASCADE, related_name="plans", db_index=True
)
base_unit_price = models.IntegerField(default=0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
base_unit_price = models.IntegerField(default=0)
base_unit_price = models.IntegerField(default=0, blank=True)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one should always have a value, assuming blank=True means nullable

plan_name = models.CharField(max_length=255, unique=True)

class Meta:
db_table = "plans"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this do? :O

private_repo_support = models.BooleanField(default=False)

class Meta:
db_table = "tiers"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prob not needed for a new table unless there's naming overlap with another table

Copy link
Contributor

@nora-codecov nora-codecov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good! left some comments, happy to discuss any if you want :)

I think @ajay-sentry said that there will be a lot of django admin use of these tables - I would make those pages now and test them to make sure your fields are the way you want. Same with factories.

max_seats = models.IntegerField(null=True, blank=True)
monthly_uploads_limit = models.IntegerField(null=True, blank=True)
paid_plan = models.BooleanField(default=False)
plan_name = models.CharField(max_length=255, unique=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a thought here, should we just call this "name?" since it's already on the plan 🤔

bundle_analysis = models.BooleanField(default=False)
test_analytics = models.BooleanField(default=False)
flaky_test_detection = models.BooleanField(default=False)
patch_coverage = models.BooleanField(default=False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be project coverage right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants