0001_initial.py 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. # Copyright © 2023 Ingram Micro Inc. All rights reserved.
  2. import django.contrib.auth.validators
  3. import django.utils.timezone
  4. from django.conf import settings
  5. from django.db import migrations, models
  6. class Migration(migrations.Migration):
  7. initial = True
  8. dependencies = [
  9. ('auth', '0001_initial'),
  10. ]
  11. operations = [
  12. migrations.CreateModel(
  13. name='User',
  14. fields=[
  15. (
  16. 'id',
  17. models.BigAutoField(
  18. auto_created=True,
  19. primary_key=True,
  20. serialize=False,
  21. verbose_name='ID',
  22. ),
  23. ),
  24. ('password', models.CharField(max_length=128, verbose_name='password')),
  25. (
  26. 'last_login',
  27. models.DateTimeField(blank=True, null=True, verbose_name='last login'),
  28. ),
  29. (
  30. 'is_superuser',
  31. models.BooleanField(
  32. default=False,
  33. help_text='Designates that this user has all permissions without explicitly assigning them.',
  34. verbose_name='superuser status',
  35. ),
  36. ),
  37. (
  38. 'username',
  39. models.CharField(
  40. error_messages={'unique': 'A user with that username already exists.'},
  41. help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.',
  42. max_length=150,
  43. unique=True,
  44. validators=[django.contrib.auth.validators.UnicodeUsernameValidator()],
  45. verbose_name='username',
  46. ),
  47. ),
  48. (
  49. 'first_name',
  50. models.CharField(blank=True, max_length=150, verbose_name='first name'),
  51. ),
  52. (
  53. 'last_name',
  54. models.CharField(blank=True, max_length=150, verbose_name='last name'),
  55. ),
  56. (
  57. 'email',
  58. models.EmailField(blank=True, max_length=254, verbose_name='email address'),
  59. ),
  60. (
  61. 'is_staff',
  62. models.BooleanField(
  63. default=False,
  64. help_text='Designates whether the user can log into this admin site.',
  65. verbose_name='staff status',
  66. ),
  67. ),
  68. (
  69. 'is_active',
  70. models.BooleanField(
  71. default=True,
  72. help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.',
  73. verbose_name='active',
  74. ),
  75. ),
  76. (
  77. 'date_joined',
  78. models.DateTimeField(
  79. default=django.utils.timezone.now,
  80. verbose_name='date joined',
  81. ),
  82. ),
  83. (
  84. 'cqrs_revision',
  85. models.IntegerField(
  86. default=0,
  87. help_text="This field must be incremented on any model update. It's used to for CQRS sync.",
  88. ),
  89. ),
  90. (
  91. 'cqrs_updated',
  92. models.DateTimeField(
  93. auto_now=True,
  94. help_text="This field must be incremented on every model update. It's used to for CQRS sync.",
  95. ),
  96. ),
  97. (
  98. 'groups',
  99. models.ManyToManyField(
  100. blank=True,
  101. help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.',
  102. related_name='user_set',
  103. related_query_name='user',
  104. to='auth.Group',
  105. verbose_name='groups',
  106. ),
  107. ),
  108. (
  109. 'user_permissions',
  110. models.ManyToManyField(
  111. blank=True,
  112. help_text='Specific permissions for this user.',
  113. related_name='user_set',
  114. related_query_name='user',
  115. to='auth.Permission',
  116. verbose_name='user permissions',
  117. ),
  118. ),
  119. ],
  120. options={
  121. 'abstract': False,
  122. },
  123. ),
  124. migrations.CreateModel(
  125. name='Product',
  126. fields=[
  127. (
  128. 'id',
  129. models.BigAutoField(
  130. auto_created=True,
  131. primary_key=True,
  132. serialize=False,
  133. verbose_name='ID',
  134. ),
  135. ),
  136. (
  137. 'cqrs_revision',
  138. models.IntegerField(
  139. default=0,
  140. help_text="This field must be incremented on any model update. It's used to for CQRS sync.",
  141. ),
  142. ),
  143. (
  144. 'cqrs_updated',
  145. models.DateTimeField(
  146. auto_now=True,
  147. help_text="This field must be incremented on every model update. It's used to for CQRS sync.",
  148. ),
  149. ),
  150. ('name', models.CharField(max_length=50)),
  151. ],
  152. options={
  153. 'abstract': False,
  154. },
  155. ),
  156. migrations.CreateModel(
  157. name='ProductType',
  158. fields=[
  159. (
  160. 'id',
  161. models.BigAutoField(
  162. auto_created=True,
  163. primary_key=True,
  164. serialize=False,
  165. verbose_name='ID',
  166. ),
  167. ),
  168. ('name', models.CharField(max_length=50)),
  169. ],
  170. ),
  171. migrations.CreateModel(
  172. name='Purchase',
  173. fields=[
  174. (
  175. 'id',
  176. models.BigAutoField(
  177. auto_created=True,
  178. primary_key=True,
  179. serialize=False,
  180. verbose_name='ID',
  181. ),
  182. ),
  183. (
  184. 'cqrs_revision',
  185. models.IntegerField(
  186. default=0,
  187. help_text="This field must be incremented on any model update. It's used to for CQRS sync.",
  188. ),
  189. ),
  190. (
  191. 'cqrs_updated',
  192. models.DateTimeField(
  193. auto_now=True,
  194. help_text="This field must be incremented on every model update. It's used to for CQRS sync.",
  195. ),
  196. ),
  197. ('action_time', models.DateTimeField(auto_now_add=True)),
  198. (
  199. 'product',
  200. models.ForeignKey(
  201. on_delete=django.db.models.deletion.CASCADE,
  202. to='app.product',
  203. ),
  204. ),
  205. (
  206. 'user',
  207. models.ForeignKey(
  208. on_delete=django.db.models.deletion.CASCADE,
  209. to=settings.AUTH_USER_MODEL,
  210. ),
  211. ),
  212. ],
  213. options={
  214. 'abstract': False,
  215. },
  216. ),
  217. migrations.AddField(
  218. model_name='product',
  219. name='product_type',
  220. field=models.ForeignKey(
  221. on_delete=django.db.models.deletion.CASCADE,
  222. to='app.producttype',
  223. ),
  224. ),
  225. ]