|
| 1 | +# Generated by Django 5.2.14 on 2026-05-19 11:05 |
| 2 | + |
| 3 | +import django.db.models.deletion |
| 4 | +import django_lifecycle.mixins # type: ignore[import-untyped] |
| 5 | +import uuid |
| 6 | +from django.db import migrations, models |
| 7 | + |
| 8 | + |
| 9 | +class Migration(migrations.Migration): |
| 10 | + |
| 11 | + initial = True |
| 12 | + |
| 13 | + dependencies = [ |
| 14 | + ("environments", "0037_add_uuid_field"), |
| 15 | + ] |
| 16 | + |
| 17 | + operations = [ |
| 18 | + migrations.CreateModel( |
| 19 | + name="WarehouseConnection", |
| 20 | + fields=[ |
| 21 | + ( |
| 22 | + "id", |
| 23 | + models.AutoField( |
| 24 | + auto_created=True, |
| 25 | + primary_key=True, |
| 26 | + serialize=False, |
| 27 | + verbose_name="ID", |
| 28 | + ), |
| 29 | + ), |
| 30 | + ( |
| 31 | + "deleted_at", |
| 32 | + models.DateTimeField( |
| 33 | + blank=True, |
| 34 | + db_index=True, |
| 35 | + default=None, |
| 36 | + editable=False, |
| 37 | + null=True, |
| 38 | + ), |
| 39 | + ), |
| 40 | + ( |
| 41 | + "uuid", |
| 42 | + models.UUIDField(default=uuid.uuid4, editable=False, unique=True), |
| 43 | + ), |
| 44 | + ( |
| 45 | + "warehouse_type", |
| 46 | + models.CharField( |
| 47 | + choices=[ |
| 48 | + ("flagsmith", "Flagsmith"), |
| 49 | + ("snowflake", "Snowflake"), |
| 50 | + ("clickhouse", "ClickHouse"), |
| 51 | + ], |
| 52 | + max_length=50, |
| 53 | + ), |
| 54 | + ), |
| 55 | + ( |
| 56 | + "status", |
| 57 | + models.CharField( |
| 58 | + choices=[ |
| 59 | + ("pending_connection", "Pending Connection"), |
| 60 | + ("connected", "Connected"), |
| 61 | + ("errored", "Errored"), |
| 62 | + ], |
| 63 | + default="pending_connection", |
| 64 | + max_length=50, |
| 65 | + ), |
| 66 | + ), |
| 67 | + ("name", models.CharField(max_length=255)), |
| 68 | + ("created_at", models.DateTimeField(auto_now_add=True)), |
| 69 | + ( |
| 70 | + "environment", |
| 71 | + models.ForeignKey( |
| 72 | + on_delete=django.db.models.deletion.CASCADE, |
| 73 | + related_name="warehouse_connections", |
| 74 | + to="environments.environment", |
| 75 | + ), |
| 76 | + ), |
| 77 | + ], |
| 78 | + options={ |
| 79 | + "constraints": [ |
| 80 | + models.UniqueConstraint( |
| 81 | + condition=models.Q(("deleted_at__isnull", True)), |
| 82 | + fields=("warehouse_type", "environment"), |
| 83 | + name="unique_active_warehouse_per_type_and_env", |
| 84 | + ) |
| 85 | + ], |
| 86 | + }, |
| 87 | + bases=(django_lifecycle.mixins.LifecycleModelMixin, models.Model), |
| 88 | + ), |
| 89 | + ] |
0 commit comments