0001_initial.py 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # Generated by Django 3.0.3 on 2020-02-28 17:52
  2. import django.contrib.postgres.fields.jsonb
  3. from django.db import migrations, models
  4. import django.db.models.deletion
  5. import django_extensions.db.fields
  6. import uuid
  7. class Migration(migrations.Migration):
  8. initial = True
  9. dependencies = [
  10. ("organizations_ext", "0001_squashed_0009_organization_scrub_ip_addresses"),
  11. ]
  12. operations = [
  13. migrations.CreateModel(
  14. name="Project",
  15. fields=[
  16. (
  17. "id",
  18. models.AutoField(
  19. auto_created=True,
  20. primary_key=True,
  21. serialize=False,
  22. verbose_name="ID",
  23. ),
  24. ),
  25. (
  26. "slug",
  27. django_extensions.db.fields.AutoSlugField(
  28. blank=True,
  29. editable=False,
  30. populate_from=["name", "organization_id"],
  31. ),
  32. ),
  33. ("name", models.CharField(max_length=200)),
  34. ("created", models.DateTimeField(auto_now_add=True, db_index=True)),
  35. ("platform", models.CharField(blank=True, max_length=64, null=True)),
  36. (
  37. "organization",
  38. models.ForeignKey(
  39. on_delete=django.db.models.deletion.CASCADE,
  40. related_name="projects",
  41. to="organizations_ext.Organization",
  42. ),
  43. ),
  44. ],
  45. options={
  46. "unique_together": {("organization", "slug")},
  47. },
  48. ),
  49. migrations.CreateModel(
  50. name="ProjectKey",
  51. fields=[
  52. (
  53. "id",
  54. models.AutoField(
  55. auto_created=True,
  56. primary_key=True,
  57. serialize=False,
  58. verbose_name="ID",
  59. ),
  60. ),
  61. ("label", models.CharField(blank=True, max_length=64)),
  62. (
  63. "public_key",
  64. models.UUIDField(default=uuid.uuid4, editable=False, unique=True),
  65. ),
  66. ("created", models.DateTimeField(auto_now_add=True)),
  67. (
  68. "rate_limit_count",
  69. models.PositiveSmallIntegerField(blank=True, null=True),
  70. ),
  71. (
  72. "rate_limit_window",
  73. models.PositiveSmallIntegerField(blank=True, null=True),
  74. ),
  75. (
  76. "data",
  77. django.contrib.postgres.fields.jsonb.JSONField(
  78. blank=True, null=True
  79. ),
  80. ),
  81. (
  82. "project",
  83. models.ForeignKey(
  84. on_delete=django.db.models.deletion.CASCADE,
  85. to="projects.Project",
  86. ),
  87. ),
  88. ],
  89. ),
  90. ]