0001_squashed_0005_alter_apitoken_id.py 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # Generated by Django 4.1.3 on 2022-12-10 15:23
  2. import api_tokens.models
  3. import bitfield.models
  4. from django.conf import settings
  5. from django.db import migrations, models
  6. import django.db.models.deletion
  7. class Migration(migrations.Migration):
  8. replaces = [
  9. ("api_tokens", "0001_initial"),
  10. ("api_tokens", "0002_auto_20200821_1446"),
  11. ("api_tokens", "0003_alter_apitoken_created"),
  12. ("api_tokens", "0004_alter_apitoken_token"),
  13. ("api_tokens", "0005_alter_apitoken_id"),
  14. ]
  15. initial = True
  16. dependencies = [
  17. migrations.swappable_dependency(settings.AUTH_USER_MODEL),
  18. ]
  19. operations = [
  20. migrations.CreateModel(
  21. name="APIToken",
  22. fields=[
  23. (
  24. "id",
  25. models.BigAutoField(
  26. auto_created=True,
  27. primary_key=True,
  28. serialize=False,
  29. verbose_name="ID",
  30. ),
  31. ),
  32. (
  33. "token",
  34. models.CharField(
  35. default=api_tokens.models.generate_token,
  36. editable=False,
  37. max_length=64,
  38. unique=True,
  39. ),
  40. ),
  41. ("label", models.CharField(blank=True, max_length=255)),
  42. (
  43. "scopes",
  44. bitfield.models.BitField(
  45. (
  46. "project:read",
  47. "project:write",
  48. "project:admin",
  49. "project:releases",
  50. "team:read",
  51. "team:write",
  52. "team:admin",
  53. "event:read",
  54. "event:write",
  55. "event:admin",
  56. "org:read",
  57. "org:write",
  58. "org:admin",
  59. "member:read",
  60. "member:write",
  61. "member:admin",
  62. ),
  63. default=None,
  64. ),
  65. ),
  66. ("created", models.DateTimeField(auto_now_add=True, db_index=True)),
  67. (
  68. "user",
  69. models.ForeignKey(
  70. on_delete=django.db.models.deletion.CASCADE,
  71. to=settings.AUTH_USER_MODEL,
  72. ),
  73. ),
  74. ],
  75. ),
  76. ]