Нет описания

0001_initial.py 26KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. # Generated by Django 4.2.24 on 2025-09-21 09:39
  2. from django.conf import settings
  3. from django.db import migrations, models
  4. import django.db.models.deletion
  5. import django.utils.timezone
  6. class Migration(migrations.Migration):
  7. initial = True
  8. dependencies = [
  9. ('contenttypes', '0002_remove_content_type_name'),
  10. migrations.swappable_dependency(settings.AUTH_USER_MODEL),
  11. ('orgs', '__first__'),
  12. ]
  13. operations = [
  14. migrations.CreateModel(
  15. name='Customer',
  16. fields=[
  17. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  18. ('created_at', models.DateTimeField(auto_now_add=True)),
  19. ('updated_at', models.DateTimeField(auto_now=True)),
  20. ('name', models.CharField(max_length=255)),
  21. ('email', models.EmailField(blank=True, max_length=254)),
  22. ('phone', models.CharField(blank=True, max_length=64)),
  23. ('billing_address', models.TextField(blank=True)),
  24. ('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='customers', to='orgs.organization')),
  25. ],
  26. options={
  27. 'abstract': False,
  28. },
  29. ),
  30. migrations.CreateModel(
  31. name='CustomerSite',
  32. fields=[
  33. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  34. ('created_at', models.DateTimeField(auto_now_add=True)),
  35. ('updated_at', models.DateTimeField(auto_now=True)),
  36. ('name', models.CharField(blank=True, max_length=255)),
  37. ('address', models.TextField()),
  38. ('contact_name', models.CharField(blank=True, max_length=255)),
  39. ('contact_phone', models.CharField(blank=True, max_length=64)),
  40. ('contact_email', models.EmailField(blank=True, max_length=254)),
  41. ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sites', to='recycle_core.customer')),
  42. ],
  43. options={
  44. 'abstract': False,
  45. },
  46. ),
  47. migrations.CreateModel(
  48. name='Invoice',
  49. fields=[
  50. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  51. ('created_at', models.DateTimeField(auto_now_add=True)),
  52. ('updated_at', models.DateTimeField(auto_now=True)),
  53. ('currency_code', models.CharField(default='USD', max_length=8)),
  54. ('total_amount', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
  55. ('status', models.CharField(choices=[('draft', 'Draft'), ('issued', 'Issued'), ('paid', 'Paid'), ('void', 'Void')], db_index=True, default='draft', max_length=8)),
  56. ('issued_at', models.DateTimeField(blank=True, null=True)),
  57. ('due_at', models.DateTimeField(blank=True, null=True)),
  58. ('customer', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='invoices', to='recycle_core.customer')),
  59. ('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='invoices', to='orgs.organization')),
  60. ],
  61. options={
  62. 'abstract': False,
  63. },
  64. ),
  65. migrations.CreateModel(
  66. name='Material',
  67. fields=[
  68. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  69. ('created_at', models.DateTimeField(auto_now_add=True)),
  70. ('updated_at', models.DateTimeField(auto_now=True)),
  71. ('name', models.CharField(max_length=255)),
  72. ('code', models.CharField(blank=True, max_length=64)),
  73. ('default_unit', models.CharField(choices=[('kg', 'Kilogram'), ('lb', 'Pound'), ('pcs', 'Pieces')], default='kg', max_length=8)),
  74. ],
  75. ),
  76. migrations.CreateModel(
  77. name='PickupOrder',
  78. fields=[
  79. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  80. ('created_at', models.DateTimeField(auto_now_add=True)),
  81. ('updated_at', models.DateTimeField(auto_now=True)),
  82. ('status', models.CharField(choices=[('requested', 'Requested'), ('scheduled', 'Scheduled'), ('en_route', 'En Route'), ('collecting', 'Collecting'), ('at_facility', 'At Facility'), ('weighed', 'Weighed'), ('invoiced', 'Invoiced'), ('completed', 'Completed'), ('canceled', 'Canceled')], db_index=True, default='requested', max_length=16)),
  83. ('scheduled_at', models.DateTimeField(blank=True, null=True)),
  84. ('completed_at', models.DateTimeField(blank=True, null=True)),
  85. ('notes', models.TextField(blank=True)),
  86. ('assigned_driver', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='assigned_pickups', to=settings.AUTH_USER_MODEL)),
  87. ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_pickups', to=settings.AUTH_USER_MODEL)),
  88. ('customer', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='pickup_orders', to='recycle_core.customer')),
  89. ('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pickup_orders', to='orgs.organization')),
  90. ('site', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='pickup_orders', to='recycle_core.customersite')),
  91. ],
  92. options={
  93. 'abstract': False,
  94. },
  95. ),
  96. migrations.CreateModel(
  97. name='PriceList',
  98. fields=[
  99. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  100. ('created_at', models.DateTimeField(auto_now_add=True)),
  101. ('updated_at', models.DateTimeField(auto_now=True)),
  102. ('name', models.CharField(max_length=255)),
  103. ('currency_code', models.CharField(default='USD', max_length=8)),
  104. ('effective_from', models.DateField(blank=True, null=True)),
  105. ('effective_to', models.DateField(blank=True, null=True)),
  106. ('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='price_lists', to='orgs.organization')),
  107. ],
  108. options={
  109. 'abstract': False,
  110. },
  111. ),
  112. migrations.CreateModel(
  113. name='ScrapListing',
  114. fields=[
  115. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  116. ('created_at', models.DateTimeField(auto_now_add=True)),
  117. ('updated_at', models.DateTimeField(auto_now=True)),
  118. ('title', models.CharField(max_length=255)),
  119. ('description', models.TextField(blank=True)),
  120. ('auction_type', models.CharField(choices=[('open', 'Open'), ('sealed', 'Sealed')], default='open', max_length=16)),
  121. ('currency_code', models.CharField(default='USD', max_length=8)),
  122. ('reserve_price', models.DecimalField(blank=True, decimal_places=2, max_digits=14, null=True)),
  123. ('min_increment', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)),
  124. ('starts_at', models.DateTimeField(blank=True, null=True)),
  125. ('ends_at', models.DateTimeField(blank=True, null=True)),
  126. ('status', models.CharField(choices=[('draft', 'Draft'), ('open', 'Open'), ('closed', 'Closed'), ('awarded', 'Awarded'), ('canceled', 'Canceled')], db_index=True, default='draft', max_length=16)),
  127. ('is_public', models.BooleanField(default=True)),
  128. ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_listings', to=settings.AUTH_USER_MODEL)),
  129. ('customer', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='scrap_listings', to='recycle_core.customer')),
  130. ('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='scrap_listings', to='orgs.organization')),
  131. ('site', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='scrap_listings', to='recycle_core.customersite')),
  132. ],
  133. options={
  134. 'abstract': False,
  135. },
  136. ),
  137. migrations.CreateModel(
  138. name='WeighTicket',
  139. fields=[
  140. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  141. ('created_at', models.DateTimeField(auto_now_add=True)),
  142. ('updated_at', models.DateTimeField(auto_now=True)),
  143. ('ticket_number', models.CharField(blank=True, max_length=64)),
  144. ('gross_weight', models.DecimalField(decimal_places=3, max_digits=12)),
  145. ('tare_weight', models.DecimalField(decimal_places=3, max_digits=12)),
  146. ('net_weight', models.DecimalField(decimal_places=3, max_digits=12)),
  147. ('unit', models.CharField(choices=[('kg', 'Kilogram'), ('lb', 'Pound'), ('pcs', 'Pieces')], default='kg', max_length=8)),
  148. ('recorded_at', models.DateTimeField(default=django.utils.timezone.now)),
  149. ('pickup', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='weigh_ticket', to='recycle_core.pickuporder')),
  150. ('recorded_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='weigh_tickets', to=settings.AUTH_USER_MODEL)),
  151. ],
  152. options={
  153. 'abstract': False,
  154. },
  155. ),
  156. migrations.CreateModel(
  157. name='WeighLine',
  158. fields=[
  159. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  160. ('created_at', models.DateTimeField(auto_now_add=True)),
  161. ('updated_at', models.DateTimeField(auto_now=True)),
  162. ('quantity', models.DecimalField(decimal_places=3, max_digits=12)),
  163. ('unit', models.CharField(choices=[('kg', 'Kilogram'), ('lb', 'Pound'), ('pcs', 'Pieces')], default='kg', max_length=8)),
  164. ('material', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='recycle_core.material')),
  165. ('ticket', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='lines', to='recycle_core.weighticket')),
  166. ],
  167. options={
  168. 'abstract': False,
  169. },
  170. ),
  171. migrations.CreateModel(
  172. name='ServiceAgreement',
  173. fields=[
  174. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  175. ('created_at', models.DateTimeField(auto_now_add=True)),
  176. ('updated_at', models.DateTimeField(auto_now=True)),
  177. ('valid_from', models.DateField(blank=True, null=True)),
  178. ('valid_to', models.DateField(blank=True, null=True)),
  179. ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='agreements', to='recycle_core.customer')),
  180. ('price_list', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='agreements', to='recycle_core.pricelist')),
  181. ('site', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='agreements', to='recycle_core.customersite')),
  182. ],
  183. options={
  184. 'abstract': False,
  185. },
  186. ),
  187. migrations.CreateModel(
  188. name='ScrapListingItem',
  189. fields=[
  190. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  191. ('created_at', models.DateTimeField(auto_now_add=True)),
  192. ('updated_at', models.DateTimeField(auto_now=True)),
  193. ('quantity_estimate', models.DecimalField(decimal_places=3, max_digits=12)),
  194. ('unit', models.CharField(choices=[('kg', 'Kilogram'), ('lb', 'Pound'), ('pcs', 'Pieces')], default='kg', max_length=8)),
  195. ('listing', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='recycle_core.scraplisting')),
  196. ('material', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='recycle_core.material')),
  197. ],
  198. options={
  199. 'abstract': False,
  200. },
  201. ),
  202. migrations.CreateModel(
  203. name='ScrapBid',
  204. fields=[
  205. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  206. ('created_at', models.DateTimeField(auto_now_add=True)),
  207. ('updated_at', models.DateTimeField(auto_now=True)),
  208. ('price_total', models.DecimalField(decimal_places=2, max_digits=14)),
  209. ('message', models.TextField(blank=True)),
  210. ('status', models.CharField(choices=[('active', 'Active'), ('retracted', 'Retracted'), ('accepted', 'Accepted'), ('rejected', 'Rejected')], default='active', max_length=16)),
  211. ('bidder_org', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='bids', to='orgs.organization')),
  212. ('bidder_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='bids', to=settings.AUTH_USER_MODEL)),
  213. ('listing', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='bids', to='recycle_core.scraplisting')),
  214. ],
  215. ),
  216. migrations.CreateModel(
  217. name='ScrapAward',
  218. fields=[
  219. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  220. ('created_at', models.DateTimeField(auto_now_add=True)),
  221. ('updated_at', models.DateTimeField(auto_now=True)),
  222. ('notes', models.TextField(blank=True)),
  223. ('listing', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='award', to='recycle_core.scraplisting')),
  224. ('pickup', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='awards', to='recycle_core.pickuporder')),
  225. ('winning_bid', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='awards', to='recycle_core.scrapbid')),
  226. ],
  227. options={
  228. 'abstract': False,
  229. },
  230. ),
  231. migrations.CreateModel(
  232. name='PriceListItem',
  233. fields=[
  234. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  235. ('created_at', models.DateTimeField(auto_now_add=True)),
  236. ('updated_at', models.DateTimeField(auto_now=True)),
  237. ('unit', models.CharField(choices=[('kg', 'Kilogram'), ('lb', 'Pound'), ('pcs', 'Pieces')], default='kg', max_length=8)),
  238. ('unit_price', models.DecimalField(decimal_places=2, max_digits=12)),
  239. ('direction', models.CharField(choices=[('buy', 'Buy from customer'), ('sell', 'Sell to customer')], default='sell', max_length=8)),
  240. ('material', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='price_items', to='recycle_core.material')),
  241. ('price_list', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='recycle_core.pricelist')),
  242. ],
  243. ),
  244. migrations.CreateModel(
  245. name='PickupItem',
  246. fields=[
  247. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  248. ('created_at', models.DateTimeField(auto_now_add=True)),
  249. ('updated_at', models.DateTimeField(auto_now=True)),
  250. ('estimated_qty', models.DecimalField(blank=True, decimal_places=3, max_digits=12, null=True)),
  251. ('unit', models.CharField(choices=[('kg', 'Kilogram'), ('lb', 'Pound'), ('pcs', 'Pieces')], default='kg', max_length=8)),
  252. ('material', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='recycle_core.material')),
  253. ('pickup', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='recycle_core.pickuporder')),
  254. ],
  255. options={
  256. 'abstract': False,
  257. },
  258. ),
  259. migrations.CreateModel(
  260. name='Payout',
  261. fields=[
  262. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  263. ('created_at', models.DateTimeField(auto_now_add=True)),
  264. ('updated_at', models.DateTimeField(auto_now=True)),
  265. ('amount', models.DecimalField(decimal_places=2, max_digits=14)),
  266. ('currency_code', models.CharField(default='USD', max_length=8)),
  267. ('paid_at', models.DateTimeField(default=django.utils.timezone.now)),
  268. ('reference', models.CharField(blank=True, max_length=128)),
  269. ('customer', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='payouts', to='recycle_core.customer')),
  270. ('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payouts', to='orgs.organization')),
  271. ('pickup', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='payouts', to='recycle_core.pickuporder')),
  272. ],
  273. options={
  274. 'abstract': False,
  275. },
  276. ),
  277. migrations.CreateModel(
  278. name='Payment',
  279. fields=[
  280. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  281. ('created_at', models.DateTimeField(auto_now_add=True)),
  282. ('updated_at', models.DateTimeField(auto_now=True)),
  283. ('amount', models.DecimalField(decimal_places=2, max_digits=14)),
  284. ('currency_code', models.CharField(default='USD', max_length=8)),
  285. ('received_at', models.DateTimeField(default=django.utils.timezone.now)),
  286. ('reference', models.CharField(blank=True, max_length=128)),
  287. ('invoice', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payments', to='recycle_core.invoice')),
  288. ],
  289. options={
  290. 'abstract': False,
  291. },
  292. ),
  293. migrations.CreateModel(
  294. name='MaterialCategory',
  295. fields=[
  296. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  297. ('created_at', models.DateTimeField(auto_now_add=True)),
  298. ('updated_at', models.DateTimeField(auto_now=True)),
  299. ('name', models.CharField(max_length=255)),
  300. ('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_categories', to='orgs.organization')),
  301. ],
  302. ),
  303. migrations.AddField(
  304. model_name='material',
  305. name='category',
  306. field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='materials', to='recycle_core.materialcategory'),
  307. ),
  308. migrations.AddField(
  309. model_name='material',
  310. name='organization',
  311. field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='orgs.organization'),
  312. ),
  313. migrations.CreateModel(
  314. name='InvoiceLine',
  315. fields=[
  316. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  317. ('created_at', models.DateTimeField(auto_now_add=True)),
  318. ('updated_at', models.DateTimeField(auto_now=True)),
  319. ('description', models.CharField(max_length=255)),
  320. ('quantity', models.DecimalField(decimal_places=3, max_digits=12)),
  321. ('unit', models.CharField(choices=[('kg', 'Kilogram'), ('lb', 'Pound'), ('pcs', 'Pieces')], default='kg', max_length=8)),
  322. ('unit_price', models.DecimalField(decimal_places=2, max_digits=12)),
  323. ('line_total', models.DecimalField(decimal_places=2, max_digits=14)),
  324. ('invoice', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='lines', to='recycle_core.invoice')),
  325. ('material', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='recycle_core.material')),
  326. ],
  327. options={
  328. 'abstract': False,
  329. },
  330. ),
  331. migrations.AddField(
  332. model_name='invoice',
  333. name='pickup',
  334. field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='invoices', to='recycle_core.pickuporder'),
  335. ),
  336. migrations.CreateModel(
  337. name='Document',
  338. fields=[
  339. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  340. ('created_at', models.DateTimeField(auto_now_add=True)),
  341. ('updated_at', models.DateTimeField(auto_now=True)),
  342. ('file', models.FileField(upload_to='documents/%Y/%m/%d/')),
  343. ('kind', models.CharField(blank=True, max_length=64)),
  344. ('object_id', models.PositiveIntegerField()),
  345. ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')),
  346. ('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='documents', to='orgs.organization')),
  347. ('uploaded_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
  348. ],
  349. options={
  350. 'abstract': False,
  351. },
  352. ),
  353. migrations.AddField(
  354. model_name='customer',
  355. name='price_list',
  356. field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='customers', to='recycle_core.pricelist'),
  357. ),
  358. migrations.CreateModel(
  359. name='AuditLog',
  360. fields=[
  361. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  362. ('created_at', models.DateTimeField(auto_now_add=True)),
  363. ('updated_at', models.DateTimeField(auto_now=True)),
  364. ('action', models.CharField(max_length=64)),
  365. ('object_id', models.PositiveIntegerField()),
  366. ('metadata', models.JSONField(blank=True, default=dict)),
  367. ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')),
  368. ('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='audit_logs', to='orgs.organization')),
  369. ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
  370. ],
  371. ),
  372. migrations.CreateModel(
  373. name='ScrapListingInvite',
  374. fields=[
  375. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  376. ('created_at', models.DateTimeField(auto_now_add=True)),
  377. ('updated_at', models.DateTimeField(auto_now=True)),
  378. ('invited_org', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='listing_invites', to='orgs.organization')),
  379. ('invited_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='listing_invites', to=settings.AUTH_USER_MODEL)),
  380. ('listing', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='invites', to='recycle_core.scraplisting')),
  381. ],
  382. options={
  383. 'unique_together': {('listing', 'invited_org')},
  384. },
  385. ),
  386. migrations.AddIndex(
  387. model_name='scrapbid',
  388. index=models.Index(fields=['listing', 'price_total'], name='recycle_cor_listing_030b96_idx'),
  389. ),
  390. migrations.AlterUniqueTogether(
  391. name='pricelistitem',
  392. unique_together={('price_list', 'material', 'unit', 'direction')},
  393. ),
  394. migrations.AlterUniqueTogether(
  395. name='materialcategory',
  396. unique_together={('organization', 'name')},
  397. ),
  398. migrations.AlterUniqueTogether(
  399. name='material',
  400. unique_together={('organization', 'name')},
  401. ),
  402. migrations.AddIndex(
  403. model_name='auditlog',
  404. index=models.Index(fields=['organization', 'created_at'], name='recycle_cor_organiz_192314_idx'),
  405. ),
  406. migrations.AddIndex(
  407. model_name='auditlog',
  408. index=models.Index(fields=['action', 'created_at'], name='recycle_cor_action_aad429_idx'),
  409. ),
  410. ]