feat(demo): add isolated demo environments
This commit is contained in:
25
apps/users/migrations/0004_user_demo_fields.py
Normal file
25
apps/users/migrations/0004_user_demo_fields.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("users", "0003_normalize_user_email_identity"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="user",
|
||||
name="demo_expires_at",
|
||||
field=models.DateTimeField(blank=True, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="user",
|
||||
name="is_demo",
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name="user",
|
||||
index=models.Index(fields=["is_demo", "demo_expires_at"], name="user_demo_expires_idx"),
|
||||
),
|
||||
]
|
||||
@@ -22,6 +22,8 @@ class User(AbstractUser, BaseModel):
|
||||
|
||||
password_updated_at = models.DateTimeField(blank=True, null=True)
|
||||
is_verified = models.BooleanField(default=False)
|
||||
is_demo = models.BooleanField(default=False)
|
||||
demo_expires_at = models.DateTimeField(blank=True, null=True)
|
||||
|
||||
USERNAME_FIELD = "mobile"
|
||||
REQUIRED_FIELDS = []
|
||||
@@ -63,6 +65,7 @@ class User(AbstractUser, BaseModel):
|
||||
indexes = (
|
||||
models.Index(fields=["id"], name="user_id_idx"),
|
||||
models.Index(fields=["mobile"], name="user_mobile_idx"),
|
||||
models.Index(fields=["is_demo", "demo_expires_at"], name="user_demo_expires_idx"),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user