0008_statuspage_statuspage_unique_organization_slug.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Generated by Django 4.2.2 on 2023-06-09 15:40
  2. from django.db import migrations, models
  3. import django.db.models.deletion
  4. import django_extensions.db.fields
  5. class Migration(migrations.Migration):
  6. dependencies = [
  7. ("organizations_ext", "0004_organizationsubscription_alter_organization_slug"),
  8. ("uptime", "0007_monitorcheck_is_change_and_more"),
  9. ]
  10. operations = [
  11. migrations.CreateModel(
  12. name="StatusPage",
  13. fields=[
  14. (
  15. "id",
  16. models.BigAutoField(
  17. auto_created=True,
  18. primary_key=True,
  19. serialize=False,
  20. verbose_name="ID",
  21. ),
  22. ),
  23. ("created", models.DateTimeField(auto_now_add=True, db_index=True)),
  24. ("name", models.CharField(max_length=200)),
  25. (
  26. "slug",
  27. django_extensions.db.fields.AutoSlugField(
  28. blank=True,
  29. editable=False,
  30. max_length=200,
  31. populate_from=["name"],
  32. ),
  33. ),
  34. (
  35. "is_public",
  36. models.BooleanField(
  37. help_text="When true, the status page URL is publicly accessible"
  38. ),
  39. ),
  40. ("monitors", models.ManyToManyField(blank=True, to="uptime.monitor")),
  41. (
  42. "organization",
  43. models.ForeignKey(
  44. on_delete=django.db.models.deletion.CASCADE,
  45. to="organizations_ext.organization",
  46. ),
  47. ),
  48. ],
  49. ),
  50. migrations.AddConstraint(
  51. model_name="statuspage",
  52. constraint=models.UniqueConstraint(
  53. fields=("organization", "slug"), name="unique_organization_slug"
  54. ),
  55. ),
  56. ]