0001_initial.py 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. # Generated by Django 4.1.3 on 2023-05-21 16:09
  2. from django.db import migrations, models
  3. import django.db.models.deletion
  4. class Migration(migrations.Migration):
  5. initial = True
  6. dependencies = [
  7. ('metaservicesynced', '0001_initial'),
  8. ]
  9. operations = [
  10. migrations.CreateModel(
  11. name='Achievement',
  12. fields=[
  13. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  14. ('time_received', models.DateTimeField(auto_now_add=True)),
  15. ],
  16. options={
  17. 'verbose_name': 'достижение пользователя',
  18. 'verbose_name_plural': 'достижения пользователя',
  19. 'db_table': 'achievement',
  20. },
  21. ),
  22. migrations.CreateModel(
  23. name='Achievements',
  24. fields=[
  25. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  26. ('title', models.CharField(help_text='Название достижения', max_length=128)),
  27. ('description', models.CharField(help_text='Описание достижения, за что получается', max_length=255)),
  28. ('image', models.ImageField(help_text='статичная картинка достижения', upload_to='sports/achievements/')),
  29. ('image_animated', models.ImageField(blank=True, help_text='анимированная картинка достижения. Если отсутствует, то используется статичная картинка', null=True, upload_to='sports/achievements/')),
  30. ('value', models.FloatField(default=0, help_text='Очки за выполение')),
  31. ],
  32. options={
  33. 'verbose_name': 'достижения',
  34. 'verbose_name_plural': 'достижения',
  35. 'db_table': 'achievements',
  36. },
  37. ),
  38. migrations.CreateModel(
  39. name='BlockedSportsman',
  40. fields=[
  41. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  42. ],
  43. options={
  44. 'verbose_name': 'заблокированный ползователь',
  45. 'verbose_name_plural': 'заблокированные пользователи',
  46. 'db_table': 'blocked_sportsman',
  47. },
  48. ),
  49. migrations.CreateModel(
  50. name='BrowseEvent',
  51. fields=[
  52. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  53. ('time_browsed', models.DateTimeField(auto_now_add=True, help_text='Для сортировки объектов после соединения browseEvent и browseUser')),
  54. ],
  55. options={
  56. 'verbose_name': 'просмотренное мероприятие',
  57. 'verbose_name_plural': 'просмотренные мероприятия',
  58. 'db_table': 'browse_event',
  59. },
  60. ),
  61. migrations.CreateModel(
  62. name='BrowseSportsman',
  63. fields=[
  64. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  65. ('time_browsed', models.DateTimeField(auto_now_add=True, help_text='Для сортировки объектов после соединения browseEvent и browseUser')),
  66. ],
  67. options={
  68. 'verbose_name': 'просмотренный пользователь',
  69. 'verbose_name_plural': 'просмотренные пользователи',
  70. 'db_table': 'browse_sportsman',
  71. },
  72. ),
  73. migrations.CreateModel(
  74. name='Event',
  75. fields=[
  76. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  77. ('required_gender', models.CharField(blank=True, choices=[('M', 'Мужчина'), ('F', 'Женщина')], default=None, max_length=1, null=True)),
  78. ('description', models.CharField(blank=True, max_length=512)),
  79. ('time_updated', models.DateTimeField(auto_now=True, null=True)),
  80. ('time_close', models.DateTimeField(blank=True, null=True)),
  81. ('max_participants', models.IntegerField(help_text='максимальное количесво участников')),
  82. ('min_participants', models.IntegerField(help_text='минимальное количесво участников')),
  83. ('max_age', models.IntegerField(help_text='максимальный возраст для участия')),
  84. ('min_age', models.IntegerField(help_text='минимальный возраст для участия')),
  85. ('required_level', models.IntegerField(blank=True, help_text='необходимое минимальное значение в поле level у пользователя для участия', null=True)),
  86. ('location', models.CharField(max_length=100)),
  87. ('event_place_start', models.CharField(max_length=128)),
  88. ('event_place_finish_prediction', models.CharField(blank=True, max_length=128, null=True)),
  89. ('event_place_finish_real', models.CharField(blank=True, max_length=128, null=True)),
  90. ('is_public', models.BooleanField(default=True)),
  91. ],
  92. options={
  93. 'verbose_name': 'мероприятие',
  94. 'verbose_name_plural': 'мероприятия',
  95. 'db_table': 'event',
  96. },
  97. ),
  98. migrations.CreateModel(
  99. name='Participant',
  100. fields=[
  101. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  102. ('is_finished', models.BooleanField(default=False)),
  103. ('event_participant', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='event_participant', to='sports.event')),
  104. ],
  105. options={
  106. 'verbose_name': 'участник',
  107. 'verbose_name_plural': 'участники',
  108. 'db_table': 'participant',
  109. },
  110. ),
  111. migrations.CreateModel(
  112. name='SavedEvent',
  113. fields=[
  114. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  115. ('event_savedevent', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='event_savedevent', to='sports.event')),
  116. ],
  117. options={
  118. 'verbose_name': 'сохранённое мероприятие',
  119. 'verbose_name_plural': 'сохранённые мероприятия',
  120. 'db_table': 'saved_event',
  121. },
  122. ),
  123. migrations.CreateModel(
  124. name='SavedSportsman',
  125. fields=[
  126. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  127. ],
  128. options={
  129. 'verbose_name': 'сохранённый ползователь',
  130. 'verbose_name_plural': 'сохранённые пользователи',
  131. 'db_table': 'saved_sportsman',
  132. },
  133. ),
  134. migrations.CreateModel(
  135. name='Sport',
  136. fields=[
  137. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  138. ('title', models.CharField(max_length=128)),
  139. ('image', models.ImageField(help_text='иконка вида спорта', upload_to='sports/sport/')),
  140. ],
  141. options={
  142. 'verbose_name': 'вид спорта',
  143. 'verbose_name_plural': 'виды спорта',
  144. 'db_table': 'sport',
  145. },
  146. ),
  147. migrations.CreateModel(
  148. name='SportPreferrence',
  149. fields=[
  150. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  151. ('sport', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='sport', to='sports.sport')),
  152. ],
  153. options={
  154. 'verbose_name': 'предпочитаемый вид спорта',
  155. 'verbose_name_plural': 'предпочитаемые виды спорта',
  156. 'db_table': 'sport_preferrence',
  157. },
  158. ),
  159. migrations.CreateModel(
  160. name='Sportsman',
  161. fields=[
  162. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  163. ('bio', models.CharField(blank=True, max_length=512)),
  164. ('level', models.FloatField(default=0)),
  165. ('birthdate', models.DateField(blank=True, null=True)),
  166. ('active_status', models.CharField(default='Active', max_length=64)),
  167. ('time_updated', models.DateTimeField(blank=True, null=True)),
  168. ('preferred_time', models.CharField(blank=True, help_text='список дней и времени', max_length=128)),
  169. ('reliance_rating', models.FloatField(default=0)),
  170. ('gender', models.CharField(blank=True, choices=[('M', 'Мужчина'), ('F', 'Женщина')], default=None, max_length=1, null=True)),
  171. ('achievement', models.ManyToManyField(through='sports.Achievement', to='sports.achievements')),
  172. ('blocked_sportsman', models.ManyToManyField(through='sports.BlockedSportsman', to='sports.sportsman')),
  173. ('browse_event', models.ManyToManyField(related_name='sportsman_browseevent', through='sports.BrowseEvent', to='sports.event')),
  174. ('browse_sportsman', models.ManyToManyField(through='sports.BrowseSportsman', to='sports.sportsman')),
  175. ('client', models.ForeignKey(help_text='клиент, которому соответствует роль спортсмена', on_delete=django.db.models.deletion.DO_NOTHING, to='metaservicesynced.client')),
  176. ('participant', models.ManyToManyField(related_name='sportsman_participant', through='sports.Participant', to='sports.event')),
  177. ('saved_event', models.ManyToManyField(through='sports.SavedEvent', to='sports.event')),
  178. ('saved_sportsman', models.ManyToManyField(through='sports.SavedSportsman', to='sports.sportsman')),
  179. ('sport_preferrence', models.ManyToManyField(through='sports.SportPreferrence', to='sports.sport')),
  180. ],
  181. options={
  182. 'verbose_name': 'Спортсмена',
  183. 'verbose_name_plural': 'Спортсмены',
  184. 'db_table': 'sportsman',
  185. },
  186. ),
  187. migrations.CreateModel(
  188. name='SportsmanGallery',
  189. fields=[
  190. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  191. ('image', models.ImageField(upload_to='sports/sportsman/%Y/%m/%d/')),
  192. ('sportsman', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='sports.sportsman')),
  193. ],
  194. options={
  195. 'verbose_name': 'фото пользователя',
  196. 'verbose_name_plural': 'фото пользователя',
  197. 'db_table': 'sportsman_gallery',
  198. },
  199. ),
  200. migrations.AddField(
  201. model_name='sportpreferrence',
  202. name='sportsman',
  203. field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='sportsman_sportpreferrence', to='sports.sportsman'),
  204. ),
  205. migrations.AddField(
  206. model_name='savedsportsman',
  207. name='sportsman',
  208. field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='sportsman_savedsportsman', to='sports.sportsman'),
  209. ),
  210. migrations.AddField(
  211. model_name='savedsportsman',
  212. name='sportsman_saved',
  213. field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='sportsman_saved', to='sports.sportsman'),
  214. ),
  215. migrations.AddField(
  216. model_name='savedevent',
  217. name='sportsman',
  218. field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='sportsman_savedevent', to='sports.sportsman'),
  219. ),
  220. migrations.AddField(
  221. model_name='participant',
  222. name='sportsman',
  223. field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='sportsman_participant', to='sports.sportsman'),
  224. ),
  225. migrations.CreateModel(
  226. name='EventGallery',
  227. fields=[
  228. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  229. ('image', models.ImageField(upload_to='sports/event/')),
  230. ('event', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='sports.event')),
  231. ],
  232. options={
  233. 'verbose_name': 'фото мероприятия',
  234. 'verbose_name_plural': 'фото мероприятия',
  235. 'db_table': 'event_gallery',
  236. },
  237. ),
  238. migrations.AddField(
  239. model_name='event',
  240. name='host',
  241. field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='sports.sportsman'),
  242. ),
  243. migrations.AddField(
  244. model_name='event',
  245. name='orders',
  246. field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='metaservicesynced.orders'),
  247. ),
  248. migrations.AddField(
  249. model_name='event',
  250. name='sport',
  251. field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='sports.sport'),
  252. ),
  253. migrations.AddField(
  254. model_name='browsesportsman',
  255. name='sportsman',
  256. field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='sportsman_browsesportsman', to='sports.sportsman'),
  257. ),
  258. migrations.AddField(
  259. model_name='browsesportsman',
  260. name='sportsman_browsed',
  261. field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='sportsman_browsed', to='sports.sportsman'),
  262. ),
  263. migrations.AddField(
  264. model_name='browseevent',
  265. name='event_browseevent',
  266. field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='event_browseevent', to='sports.event'),
  267. ),
  268. migrations.AddField(
  269. model_name='browseevent',
  270. name='sportsman',
  271. field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='sportsman_browseevent', to='sports.sportsman'),
  272. ),
  273. migrations.AddField(
  274. model_name='blockedsportsman',
  275. name='sportsman',
  276. field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='sportsman_blockedsportsman', to='sports.sportsman'),
  277. ),
  278. migrations.AddField(
  279. model_name='blockedsportsman',
  280. name='sportsman_blocked',
  281. field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='sportsman_blocked', to='sports.sportsman'),
  282. ),
  283. migrations.AddField(
  284. model_name='achievement',
  285. name='achievement',
  286. field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='achievement', to='sports.achievements'),
  287. ),
  288. migrations.AddField(
  289. model_name='achievement',
  290. name='sportsman',
  291. field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='sportsman_achievement', to='sports.sportsman'),
  292. ),
  293. migrations.AddConstraint(
  294. model_name='sportpreferrence',
  295. constraint=models.UniqueConstraint(fields=('sportsman', 'sport'), name='unique_sportpreferrence'),
  296. ),
  297. migrations.AddConstraint(
  298. model_name='savedsportsman',
  299. constraint=models.UniqueConstraint(fields=('sportsman', 'sportsman_saved'), name='unique_saved_sportsman'),
  300. ),
  301. migrations.AddConstraint(
  302. model_name='savedevent',
  303. constraint=models.UniqueConstraint(fields=('sportsman', 'event_savedevent'), name='unique_saved_event'),
  304. ),
  305. migrations.AddConstraint(
  306. model_name='participant',
  307. constraint=models.UniqueConstraint(fields=('sportsman', 'event_participant'), name='unique_participant'),
  308. ),
  309. migrations.AddConstraint(
  310. model_name='browsesportsman',
  311. constraint=models.UniqueConstraint(fields=('sportsman', 'sportsman_browsed'), name='unique_browse_sportsman'),
  312. ),
  313. migrations.AddConstraint(
  314. model_name='browseevent',
  315. constraint=models.UniqueConstraint(fields=('sportsman', 'event_browseevent'), name='unique_browse_event'),
  316. ),
  317. migrations.AddConstraint(
  318. model_name='blockedsportsman',
  319. constraint=models.UniqueConstraint(fields=('sportsman', 'sportsman_blocked'), name='unique_blocked_sportsman'),
  320. ),
  321. migrations.AddConstraint(
  322. model_name='achievement',
  323. constraint=models.UniqueConstraint(fields=('sportsman', 'achievement'), name='unique_achievement'),
  324. ),
  325. ]