Skip to content

Commit

Permalink
feat: add attribute to store identity overrides storage type (#3109)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewelwell authored Dec 7, 2023
1 parent 5033f37 commit c31322b
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Generated by Django 3.2.23 on 2023-12-07 12:33
from django.apps.registry import Apps
from django.db import migrations, models
from django.db.backends.base.schema import BaseDatabaseSchemaEditor

from projects.models import IdentityOverridesStorageType


def apply_defaults(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None:
apps.get_model("projects", "Project").objects.all().update(
identity_overrides_storage_type=IdentityOverridesStorageType.IDENTITY_RECORD
)


class Migration(migrations.Migration):
dependencies = [
("projects", "0020_add_environment_feature_state_version_logic"),
]

operations = [
migrations.AddField(
model_name="project",
name="identity_overrides_storage_type",
field=models.CharField(
choices=[
("IDENTITY_RECORD", "Identity Record"),
("FLAGSMITH_OVERRIDES", "Flagsmith Overrides"),
],
default=None,
max_length=50,
null=True,
),
),
migrations.RunPython(apply_defaults, reverse_code=migrations.RunPython.noop),
migrations.AlterField(
model_name="project",
name="identity_overrides_storage_type",
field=models.CharField(
choices=[
("IDENTITY_RECORD", "Identity Record"),
("FLAGSMITH_OVERRIDES", "Flagsmith Overrides"),
],
default="IDENTITY_RECORD",
max_length=50,
),
),
]
10 changes: 10 additions & 0 deletions api/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
environment_cache = caches[settings.ENVIRONMENT_CACHE_NAME]


class IdentityOverridesStorageType(models.TextChoices):
IDENTITY_RECORD = "IDENTITY_RECORD", "Identity Record"
FLAGSMITH_OVERRIDES = "FLAGSMITH_OVERRIDES", "Flagsmith Overrides"


class Project(LifecycleModelMixin, SoftDeleteExportableModel):
name = models.CharField(max_length=2000)
created_date = models.DateTimeField("DateCreated", auto_now_add=True)
Expand Down Expand Up @@ -71,6 +76,11 @@ class Project(LifecycleModelMixin, SoftDeleteExportableModel):
default=100,
help_text="Max segments overrides allowed for any (one) environment within this project",
)
identity_overrides_storage_type = models.CharField(
max_length=50,
choices=IdentityOverridesStorageType.choices,
default=IdentityOverridesStorageType.IDENTITY_RECORD,
)

objects = ProjectManager()

Expand Down

3 comments on commit c31322b

@vercel
Copy link

@vercel vercel bot commented on c31322b Dec 7, 2023

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on c31322b Dec 7, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

docs – ./docs

docs-git-main-flagsmith.vercel.app
docs-flagsmith.vercel.app
docs.bullet-train.io
docs.flagsmith.com

@vercel
Copy link

@vercel vercel bot commented on c31322b Dec 7, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.