56 lines
3.2 KiB
Python
Executable File
56 lines
3.2 KiB
Python
Executable File
import uuid
|
|
|
|
import django.db.models.deletion
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
initial = True
|
|
dependencies = []
|
|
operations = [
|
|
migrations.CreateModel(name="Account", fields=[
|
|
("id", models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
("uid", models.CharField(max_length=48, unique=True)),
|
|
("email", models.EmailField(max_length=254)),
|
|
("ldap_dn", models.CharField(max_length=1024)),
|
|
("ldap_uuid", models.CharField(max_length=64, unique=True)),
|
|
("oidc_sub", models.CharField(max_length=512, null=True, unique=True)),
|
|
("stripe_customer", models.CharField(max_length=128, null=True, unique=True)),
|
|
("checkout_id", models.CharField(blank=True, max_length=128)),
|
|
("checkout_key", models.UUIDField(default=uuid.uuid4)),
|
|
("last_billing_sync", models.DateTimeField(null=True)),
|
|
("last_ldap_sync", models.DateTimeField(null=True)),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
]),
|
|
migrations.CreateModel(name="Registration", fields=[
|
|
("token_hash", models.CharField(max_length=64, primary_key=True, serialize=False)),
|
|
("uid", models.CharField(max_length=48)),
|
|
("email", models.EmailField(max_length=254)),
|
|
("expires_at", models.DateTimeField(db_index=True)),
|
|
]),
|
|
migrations.CreateModel(name="RateWindow", fields=[
|
|
("key", models.CharField(max_length=64, primary_key=True, serialize=False)),
|
|
("count", models.PositiveIntegerField(default=0)),
|
|
("expires_at", models.DateTimeField(db_index=True)),
|
|
]),
|
|
migrations.CreateModel(name="Subscription", fields=[
|
|
("stripe_id", models.CharField(max_length=128, primary_key=True, serialize=False)),
|
|
("tier", models.CharField(blank=True, max_length=48)),
|
|
("status", models.CharField(max_length=32)),
|
|
("paid_until", models.DateTimeField(null=True)),
|
|
("cancel_at_period_end", models.BooleanField(default=False)),
|
|
("account", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name="subscriptions", to="members.account")),
|
|
]),
|
|
migrations.CreateModel(name="ManagedGroup", fields=[
|
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
|
("dn", models.CharField(max_length=1024)),
|
|
("account", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name="managed_groups", to="members.account")),
|
|
], options={"constraints": [models.UniqueConstraint(fields=("account", "dn"), name="unique_account_group")]}),
|
|
migrations.CreateModel(name="WebhookEvent", fields=[
|
|
("stripe_id", models.CharField(max_length=128, primary_key=True, serialize=False)),
|
|
("received_at", models.DateTimeField(auto_now_add=True)),
|
|
("processed_at", models.DateTimeField(null=True)),
|
|
("account", models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to="members.account")),
|
|
]),
|
|
]
|