constec 0.7.1__py3-none-any.whl → 0.7.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- constec/db/migrations/0006_automation_trigger_action_executionlog_notificationtemplate.py +6 -6
- constec/db/models/automation.py +2 -32
- {constec-0.7.1.dist-info → constec-0.7.2.dist-info}/METADATA +1 -1
- {constec-0.7.1.dist-info → constec-0.7.2.dist-info}/RECORD +7 -11
- constec/db/migrations/0005_event.py +0 -46
- constec/db/migrations/0007_add_organization_to_automations.py +0 -91
- constec/db/migrations/0008_refactor_creator_fields.py +0 -173
- constec/db/migrations/0009_rename_user_to_companyuser.py +0 -40
- {constec-0.7.1.dist-info → constec-0.7.2.dist-info}/WHEEL +0 -0
- {constec-0.7.1.dist-info → constec-0.7.2.dist-info}/licenses/LICENSE +0 -0
- {constec-0.7.1.dist-info → constec-0.7.2.dist-info}/top_level.txt +0 -0
|
@@ -9,7 +9,7 @@ import django.db.models.deletion
|
|
|
9
9
|
class Migration(migrations.Migration):
|
|
10
10
|
|
|
11
11
|
dependencies = [
|
|
12
|
-
('constec_db', '
|
|
12
|
+
('constec_db', '0004_rename_entities_company_cuit_idx_entities_company_e2c50f_idx_and_more'),
|
|
13
13
|
]
|
|
14
14
|
|
|
15
15
|
operations = [
|
|
@@ -58,7 +58,7 @@ class Migration(migrations.Migration):
|
|
|
58
58
|
)),
|
|
59
59
|
],
|
|
60
60
|
options={
|
|
61
|
-
'db_table': '"
|
|
61
|
+
'db_table': '"core"."automations"',
|
|
62
62
|
'ordering': ['-created_at'],
|
|
63
63
|
'indexes': [
|
|
64
64
|
models.Index(fields=['company', 'status'], name='automations_auto_company_status_idx'),
|
|
@@ -97,7 +97,7 @@ class Migration(migrations.Migration):
|
|
|
97
97
|
)),
|
|
98
98
|
],
|
|
99
99
|
options={
|
|
100
|
-
'db_table': '"
|
|
100
|
+
'db_table': '"core"."triggers"',
|
|
101
101
|
'ordering': ['-priority', 'created_at'],
|
|
102
102
|
'indexes': [
|
|
103
103
|
models.Index(fields=['automation', 'is_enabled'], name='automations_trig_automation_enabled_idx'),
|
|
@@ -155,7 +155,7 @@ class Migration(migrations.Migration):
|
|
|
155
155
|
)),
|
|
156
156
|
],
|
|
157
157
|
options={
|
|
158
|
-
'db_table': '"
|
|
158
|
+
'db_table': '"core"."actions"',
|
|
159
159
|
'ordering': ['order', 'created_at'],
|
|
160
160
|
'indexes': [
|
|
161
161
|
models.Index(fields=['automation', 'order'], name='automations_act_automation_order_idx'),
|
|
@@ -220,7 +220,7 @@ class Migration(migrations.Migration):
|
|
|
220
220
|
)),
|
|
221
221
|
],
|
|
222
222
|
options={
|
|
223
|
-
'db_table': '"
|
|
223
|
+
'db_table': '"core"."execution_logs"',
|
|
224
224
|
'ordering': ['-started_at'],
|
|
225
225
|
'indexes': [
|
|
226
226
|
models.Index(fields=['automation', 'started_at'], name='automations_exec_automation_started_idx'),
|
|
@@ -264,7 +264,7 @@ class Migration(migrations.Migration):
|
|
|
264
264
|
)),
|
|
265
265
|
],
|
|
266
266
|
options={
|
|
267
|
-
'db_table': '"
|
|
267
|
+
'db_table': '"core"."notification_templates"',
|
|
268
268
|
'ordering': ['name'],
|
|
269
269
|
'indexes': [
|
|
270
270
|
models.Index(fields=['company', 'channel', 'is_active'], name='automations_tmpl_company_channel_idx'),
|
constec/db/models/automation.py
CHANGED
|
@@ -116,21 +116,6 @@ class Automation(UUIDModel):
|
|
|
116
116
|
models.Index(fields=['status', 'next_execution_at']),
|
|
117
117
|
]
|
|
118
118
|
ordering = ['-created_at']
|
|
119
|
-
constraints = [
|
|
120
|
-
models.CheckConstraint(
|
|
121
|
-
check=Q(company__isnull=False) | Q(organization__isnull=False),
|
|
122
|
-
name='automation_requires_company_or_organization'
|
|
123
|
-
),
|
|
124
|
-
models.CheckConstraint(
|
|
125
|
-
check=Q(created_by_user__isnull=False) | Q(created_by_org_user__isnull=False),
|
|
126
|
-
name='automation_requires_creator'
|
|
127
|
-
),
|
|
128
|
-
models.CheckConstraint(
|
|
129
|
-
check=Q(created_by_user__isnull=False, created_by_org_user__isnull=True) |
|
|
130
|
-
Q(created_by_user__isnull=True, created_by_org_user__isnull=False),
|
|
131
|
-
name='automation_single_creator'
|
|
132
|
-
),
|
|
133
|
-
]
|
|
134
119
|
|
|
135
120
|
def __str__(self):
|
|
136
121
|
return f"{self.name} ({self.status})"
|
|
@@ -422,7 +407,7 @@ class NotificationTemplate(UUIDModel):
|
|
|
422
407
|
on_delete=models.CASCADE,
|
|
423
408
|
null=True,
|
|
424
409
|
blank=True,
|
|
425
|
-
related_name='
|
|
410
|
+
related_name='created_notification_templates',
|
|
426
411
|
help_text="User creator (company-level)"
|
|
427
412
|
)
|
|
428
413
|
created_by_org_user = models.ForeignKey(
|
|
@@ -430,7 +415,7 @@ class NotificationTemplate(UUIDModel):
|
|
|
430
415
|
on_delete=models.CASCADE,
|
|
431
416
|
null=True,
|
|
432
417
|
blank=True,
|
|
433
|
-
related_name='
|
|
418
|
+
related_name='created_notification_templates_org',
|
|
434
419
|
help_text="OrganizationUser creator (org-level)"
|
|
435
420
|
)
|
|
436
421
|
|
|
@@ -463,21 +448,6 @@ class NotificationTemplate(UUIDModel):
|
|
|
463
448
|
models.Index(fields=['organization', 'channel', 'is_active']),
|
|
464
449
|
]
|
|
465
450
|
ordering = ['name']
|
|
466
|
-
constraints = [
|
|
467
|
-
models.CheckConstraint(
|
|
468
|
-
check=Q(company__isnull=False) | Q(organization__isnull=False),
|
|
469
|
-
name='template_requires_company_or_organization'
|
|
470
|
-
),
|
|
471
|
-
models.CheckConstraint(
|
|
472
|
-
check=Q(created_by_user__isnull=False) | Q(created_by_org_user__isnull=False),
|
|
473
|
-
name='template_requires_creator'
|
|
474
|
-
),
|
|
475
|
-
models.CheckConstraint(
|
|
476
|
-
check=Q(created_by_user__isnull=False, created_by_org_user__isnull=True) |
|
|
477
|
-
Q(created_by_user__isnull=True, created_by_org_user__isnull=False),
|
|
478
|
-
name='template_single_creator'
|
|
479
|
-
),
|
|
480
|
-
]
|
|
481
451
|
|
|
482
452
|
def __str__(self):
|
|
483
453
|
return f"{self.channel}: {self.name}"
|
|
@@ -5,14 +5,10 @@ constec/db/migrations/0001_initial.py,sha256=ru0auCkdz83Qu3e7hGX24WjZXAlM6fE7RZt
|
|
|
5
5
|
constec/db/migrations/0002_module_level.py,sha256=Es27KUOuI_qrlyL8xBTjwsJJHVduAErNxn4Sdi0a-0w,1526
|
|
6
6
|
constec/db/migrations/0003_remove_module_level.py,sha256=3GX-VDLSZqqxaZf6KFtuc7U9nCkQ9EF8pSDxOnCz63g,275
|
|
7
7
|
constec/db/migrations/0004_rename_entities_company_cuit_idx_entities_company_e2c50f_idx_and_more.py,sha256=TCkutatVjJhVKxiQwp-RLhBlbOo5rtwSV1qQqao1qCI,11874
|
|
8
|
-
constec/db/migrations/
|
|
9
|
-
constec/db/migrations/0006_automation_trigger_action_executionlog_notificationtemplate.py,sha256=sfh1YTRPqUiBb5FIxRNJm_BnlYkDonwm7FEEihgtSe0,13628
|
|
10
|
-
constec/db/migrations/0007_add_organization_to_automations.py,sha256=08yDuetrA4WWwqNriyewr0qCpesLo_9x5YD36CDScj4,3467
|
|
11
|
-
constec/db/migrations/0008_refactor_creator_fields.py,sha256=O_bcChxFR_IPw1BV_1NDbsIdrzhlj4MfpdhPXnhdau4,6381
|
|
12
|
-
constec/db/migrations/0009_rename_user_to_companyuser.py,sha256=2UvFpelG88s1NRKQ-Q3-Uz9Cmp5D_HdLHrLGElwq5_c,1052
|
|
8
|
+
constec/db/migrations/0006_automation_trigger_action_executionlog_notificationtemplate.py,sha256=gv4aVA2osTQleiw-nT1eu1tQzNuzOwJm5Q-AS-ZARiQ,13657
|
|
13
9
|
constec/db/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
10
|
constec/db/models/__init__.py,sha256=zEUX56xTEGi09ZVcRwDzSnPeKPv1Dl7pIZdAzlLhD-U,2686
|
|
15
|
-
constec/db/models/automation.py,sha256=
|
|
11
|
+
constec/db/models/automation.py,sha256=am5WsGiEJyVGd1wA51wrLUiSofOzPJbQxqaa97Kx2dw,13643
|
|
16
12
|
constec/db/models/base.py,sha256=Urbz9iyOtSxdTfgtEYbtBLmTiea2QAcLq0L40tAzEq8,736
|
|
17
13
|
constec/db/models/company.py,sha256=APYsbiNoqQ-73wxFP0jq3AByHNHn3Jjbe_J_iwpD9gM,1047
|
|
18
14
|
constec/db/models/contact.py,sha256=VJ66YgzCqp09dzYM5IK9rZZV1jqBepJQO8YK28gA98k,2106
|
|
@@ -33,8 +29,8 @@ constec/shared/exceptions.py,sha256=8Bih40RWoH0gVhto09mH2ppSQV_drHPnGWITcoD-0J0,
|
|
|
33
29
|
constec/utils/__init__.py,sha256=brf-G4UvU-3CK_rKNPTaHwsVsxnoJSbml_QTZJSM7d0,458
|
|
34
30
|
constec/utils/cuit.py,sha256=dQKGlA4pRQ5DyR-N4BiV8ZsvAle2Vgjif7PU72zHx_A,2753
|
|
35
31
|
constec/utils/password.py,sha256=XNpTJ9xZQSoZNjXEAnexAEZuYkwW1dFgX4AY-B5Q0gA,1462
|
|
36
|
-
constec-0.7.
|
|
37
|
-
constec-0.7.
|
|
38
|
-
constec-0.7.
|
|
39
|
-
constec-0.7.
|
|
40
|
-
constec-0.7.
|
|
32
|
+
constec-0.7.2.dist-info/licenses/LICENSE,sha256=a1R51ONDGq0UQfV-n3ybsNL7EGhcC2sQ1sXvRANaFVI,1064
|
|
33
|
+
constec-0.7.2.dist-info/METADATA,sha256=lUQQvreB-tsCaLyCu5nr879yIYwQVDtgjSdPGBB4rVY,2954
|
|
34
|
+
constec-0.7.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
35
|
+
constec-0.7.2.dist-info/top_level.txt,sha256=bQ9AydOLlthShsr7tA7t7ivbLvlLPdhHOo0BdWgnh_Y,8
|
|
36
|
+
constec-0.7.2.dist-info/RECORD,,
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Generated manually on 2026-02-02 for automations schema
|
|
2
|
-
|
|
3
|
-
import uuid
|
|
4
|
-
from django.conf import settings
|
|
5
|
-
from django.db import migrations, models
|
|
6
|
-
import django.db.models.deletion
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class Migration(migrations.Migration):
|
|
10
|
-
|
|
11
|
-
dependencies = [
|
|
12
|
-
('constec_db', '0004_rename_entities_company_cuit_idx_entities_company_e2c50f_idx_and_more'),
|
|
13
|
-
]
|
|
14
|
-
|
|
15
|
-
operations = [
|
|
16
|
-
migrations.CreateModel(
|
|
17
|
-
name='Event',
|
|
18
|
-
fields=[
|
|
19
|
-
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
20
|
-
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
21
|
-
('updated_at', models.DateTimeField(auto_now=True)),
|
|
22
|
-
('event_type', models.CharField(choices=[('notification', 'Notification'), ('automation', 'Automation')], max_length=50)),
|
|
23
|
-
('title', models.CharField(max_length=255)),
|
|
24
|
-
('description', models.TextField(blank=True)),
|
|
25
|
-
('status', models.CharField(choices=[('active', 'Active'), ('paused', 'Paused'), ('completed', 'Completed'), ('failed', 'Failed'), ('cancelled', 'Cancelled')], default='active', max_length=20)),
|
|
26
|
-
('recurrence_type', models.CharField(choices=[('punctual', 'Punctual'), ('periodic', 'Periodic')], help_text='Tipo de recurrencia: puntual (fechas específicas) o periódico', max_length=20)),
|
|
27
|
-
('recurrence_config', models.JSONField(help_text='Configuración de recurrencia en formato JSON')),
|
|
28
|
-
('config', models.JSONField(default=dict, help_text='Configuración específica según event_type (mensaje, URL, etc.)')),
|
|
29
|
-
('next_execution_at', models.DateTimeField(blank=True, db_index=True, help_text='Próxima fecha/hora de ejecución calculada', null=True)),
|
|
30
|
-
('last_executed_at', models.DateTimeField(blank=True, help_text='Última vez que se ejecutó', null=True)),
|
|
31
|
-
('execution_count', models.IntegerField(default=0, help_text='Cantidad de veces que se ha ejecutado')),
|
|
32
|
-
('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='constec_db.company')),
|
|
33
|
-
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='created_events', to=settings.AUTH_USER_MODEL)),
|
|
34
|
-
],
|
|
35
|
-
options={
|
|
36
|
-
'db_table': '"automations"."events"',
|
|
37
|
-
'ordering': ['next_execution_at'],
|
|
38
|
-
'indexes': [
|
|
39
|
-
models.Index(fields=['company', 'event_type'], name='automations_company_ebe85a_idx'),
|
|
40
|
-
models.Index(fields=['status', 'next_execution_at'], name='automations_status_a3d45f_idx'),
|
|
41
|
-
models.Index(fields=['recurrence_type'], name='automations_recurre_5d8b2c_idx'),
|
|
42
|
-
],
|
|
43
|
-
},
|
|
44
|
-
bases=(models.Model,),
|
|
45
|
-
),
|
|
46
|
-
]
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
# Generated manually for constec automation organization support
|
|
2
|
-
|
|
3
|
-
from django.db import migrations, models
|
|
4
|
-
import django.db.models.deletion
|
|
5
|
-
from django.db.models import Q
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class Migration(migrations.Migration):
|
|
9
|
-
|
|
10
|
-
dependencies = [
|
|
11
|
-
('constec_db', '0006_automation_trigger_action_executionlog_notificationtemplate'),
|
|
12
|
-
]
|
|
13
|
-
|
|
14
|
-
operations = [
|
|
15
|
-
# Add organization field to Automation
|
|
16
|
-
migrations.AddField(
|
|
17
|
-
model_name='automation',
|
|
18
|
-
name='organization',
|
|
19
|
-
field=models.ForeignKey(
|
|
20
|
-
blank=True,
|
|
21
|
-
db_index=True,
|
|
22
|
-
help_text='Organization para automations compartidas (opcional si se define company)',
|
|
23
|
-
null=True,
|
|
24
|
-
on_delete=django.db.models.deletion.CASCADE,
|
|
25
|
-
to='constec_db.organization'
|
|
26
|
-
),
|
|
27
|
-
),
|
|
28
|
-
# Make company field nullable in Automation
|
|
29
|
-
migrations.AlterField(
|
|
30
|
-
model_name='automation',
|
|
31
|
-
name='company',
|
|
32
|
-
field=models.ForeignKey(
|
|
33
|
-
blank=True,
|
|
34
|
-
db_index=True,
|
|
35
|
-
help_text='Company específica (opcional si se define organization)',
|
|
36
|
-
null=True,
|
|
37
|
-
on_delete=django.db.models.deletion.CASCADE,
|
|
38
|
-
to='constec_db.company'
|
|
39
|
-
),
|
|
40
|
-
),
|
|
41
|
-
# Add organization field to NotificationTemplate
|
|
42
|
-
migrations.AddField(
|
|
43
|
-
model_name='notificationtemplate',
|
|
44
|
-
name='organization',
|
|
45
|
-
field=models.ForeignKey(
|
|
46
|
-
blank=True,
|
|
47
|
-
db_index=True,
|
|
48
|
-
help_text='Organization para templates compartidos (opcional si se define company)',
|
|
49
|
-
null=True,
|
|
50
|
-
on_delete=django.db.models.deletion.CASCADE,
|
|
51
|
-
to='constec_db.organization'
|
|
52
|
-
),
|
|
53
|
-
),
|
|
54
|
-
# Make company field nullable in NotificationTemplate
|
|
55
|
-
migrations.AlterField(
|
|
56
|
-
model_name='notificationtemplate',
|
|
57
|
-
name='company',
|
|
58
|
-
field=models.ForeignKey(
|
|
59
|
-
blank=True,
|
|
60
|
-
db_index=True,
|
|
61
|
-
help_text='Company específica (opcional si se define organization)',
|
|
62
|
-
null=True,
|
|
63
|
-
on_delete=django.db.models.deletion.CASCADE,
|
|
64
|
-
to='constec_db.company'
|
|
65
|
-
),
|
|
66
|
-
),
|
|
67
|
-
# Add indexes for organization
|
|
68
|
-
migrations.AddIndex(
|
|
69
|
-
model_name='automation',
|
|
70
|
-
index=models.Index(fields=['organization', 'status'], name='automations_org_status_idx'),
|
|
71
|
-
),
|
|
72
|
-
migrations.AddIndex(
|
|
73
|
-
model_name='notificationtemplate',
|
|
74
|
-
index=models.Index(fields=['organization', 'channel', 'is_active'], name='templates_org_channel_active_idx'),
|
|
75
|
-
),
|
|
76
|
-
# Add constraint: at least one of company or organization must be set
|
|
77
|
-
migrations.AddConstraint(
|
|
78
|
-
model_name='automation',
|
|
79
|
-
constraint=models.CheckConstraint(
|
|
80
|
-
check=Q(company__isnull=False) | Q(organization__isnull=False),
|
|
81
|
-
name='automation_requires_company_or_organization'
|
|
82
|
-
),
|
|
83
|
-
),
|
|
84
|
-
migrations.AddConstraint(
|
|
85
|
-
model_name='notificationtemplate',
|
|
86
|
-
constraint=models.CheckConstraint(
|
|
87
|
-
check=Q(company__isnull=False) | Q(organization__isnull=False),
|
|
88
|
-
name='template_requires_company_or_organization'
|
|
89
|
-
),
|
|
90
|
-
),
|
|
91
|
-
]
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
# Generated manually - Refactor creator fields to support User and OrganizationUser
|
|
2
|
-
|
|
3
|
-
from django.db import migrations, models
|
|
4
|
-
import django.db.models.deletion
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def migrate_creator_data(apps, schema_editor):
|
|
8
|
-
"""Migrate existing created_by data to created_by_user."""
|
|
9
|
-
Automation = apps.get_model('constec_db', 'Automation')
|
|
10
|
-
NotificationTemplate = apps.get_model('constec_db', 'NotificationTemplate')
|
|
11
|
-
|
|
12
|
-
# Migrate Automation creators
|
|
13
|
-
for automation in Automation.objects.all():
|
|
14
|
-
if automation.created_by:
|
|
15
|
-
automation.created_by_user = automation.created_by
|
|
16
|
-
automation.save(update_fields=['created_by_user'])
|
|
17
|
-
|
|
18
|
-
# Migrate NotificationTemplate creators
|
|
19
|
-
for template in NotificationTemplate.objects.all():
|
|
20
|
-
if template.created_by:
|
|
21
|
-
template.created_by_user = template.created_by
|
|
22
|
-
template.save(update_fields=['created_by_user'])
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class Migration(migrations.Migration):
|
|
26
|
-
|
|
27
|
-
dependencies = [
|
|
28
|
-
('constec_db', '0007_add_organization_to_automations'),
|
|
29
|
-
]
|
|
30
|
-
|
|
31
|
-
operations = [
|
|
32
|
-
# 1. Add new creator fields to Automation (nullable temporarily for data migration)
|
|
33
|
-
migrations.AddField(
|
|
34
|
-
model_name='automation',
|
|
35
|
-
name='created_by_user',
|
|
36
|
-
field=models.ForeignKey(
|
|
37
|
-
blank=True,
|
|
38
|
-
help_text='User creator (company-level)',
|
|
39
|
-
null=True,
|
|
40
|
-
on_delete=django.db.models.deletion.CASCADE,
|
|
41
|
-
related_name='created_automations',
|
|
42
|
-
to='constec_db.user'
|
|
43
|
-
),
|
|
44
|
-
),
|
|
45
|
-
migrations.AddField(
|
|
46
|
-
model_name='automation',
|
|
47
|
-
name='created_by_org_user',
|
|
48
|
-
field=models.ForeignKey(
|
|
49
|
-
blank=True,
|
|
50
|
-
help_text='OrganizationUser creator (org-level)',
|
|
51
|
-
null=True,
|
|
52
|
-
on_delete=django.db.models.deletion.CASCADE,
|
|
53
|
-
related_name='created_automations',
|
|
54
|
-
to='constec_db.organizationuser'
|
|
55
|
-
),
|
|
56
|
-
),
|
|
57
|
-
|
|
58
|
-
# 2. Add new creator fields to NotificationTemplate (nullable temporarily for data migration)
|
|
59
|
-
migrations.AddField(
|
|
60
|
-
model_name='notificationtemplate',
|
|
61
|
-
name='created_by_user',
|
|
62
|
-
field=models.ForeignKey(
|
|
63
|
-
blank=True,
|
|
64
|
-
help_text='User creator (company-level)',
|
|
65
|
-
null=True,
|
|
66
|
-
on_delete=django.db.models.deletion.CASCADE,
|
|
67
|
-
related_name='created_templates',
|
|
68
|
-
to='constec_db.user'
|
|
69
|
-
),
|
|
70
|
-
),
|
|
71
|
-
migrations.AddField(
|
|
72
|
-
model_name='notificationtemplate',
|
|
73
|
-
name='created_by_org_user',
|
|
74
|
-
field=models.ForeignKey(
|
|
75
|
-
blank=True,
|
|
76
|
-
help_text='OrganizationUser creator (org-level)',
|
|
77
|
-
null=True,
|
|
78
|
-
on_delete=django.db.models.deletion.CASCADE,
|
|
79
|
-
related_name='created_templates',
|
|
80
|
-
to='constec_db.organizationuser'
|
|
81
|
-
),
|
|
82
|
-
),
|
|
83
|
-
|
|
84
|
-
# 3. Add triggered_by_org_user to ExecutionLog
|
|
85
|
-
migrations.AddField(
|
|
86
|
-
model_name='executionlog',
|
|
87
|
-
name='triggered_by_org_user',
|
|
88
|
-
field=models.ForeignKey(
|
|
89
|
-
blank=True,
|
|
90
|
-
help_text='OrganizationUser who triggered execution (org-level)',
|
|
91
|
-
null=True,
|
|
92
|
-
on_delete=django.db.models.deletion.SET_NULL,
|
|
93
|
-
related_name='triggered_executions',
|
|
94
|
-
to='constec_db.organizationuser'
|
|
95
|
-
),
|
|
96
|
-
),
|
|
97
|
-
|
|
98
|
-
# 4. Update existing triggered_by_user field help text
|
|
99
|
-
migrations.AlterField(
|
|
100
|
-
model_name='executionlog',
|
|
101
|
-
name='triggered_by_user',
|
|
102
|
-
field=models.ForeignKey(
|
|
103
|
-
blank=True,
|
|
104
|
-
help_text='User who triggered execution (company-level)',
|
|
105
|
-
null=True,
|
|
106
|
-
on_delete=django.db.models.deletion.SET_NULL,
|
|
107
|
-
related_name='triggered_executions',
|
|
108
|
-
to='constec_db.user'
|
|
109
|
-
),
|
|
110
|
-
),
|
|
111
|
-
|
|
112
|
-
# 5. Migrate data from old created_by to new created_by_user
|
|
113
|
-
migrations.RunPython(migrate_creator_data, reverse_code=migrations.RunPython.noop),
|
|
114
|
-
|
|
115
|
-
# 6. Remove old created_by fields
|
|
116
|
-
migrations.RemoveField(
|
|
117
|
-
model_name='automation',
|
|
118
|
-
name='created_by',
|
|
119
|
-
),
|
|
120
|
-
migrations.RemoveField(
|
|
121
|
-
model_name='notificationtemplate',
|
|
122
|
-
name='created_by',
|
|
123
|
-
),
|
|
124
|
-
|
|
125
|
-
# 7. Add constraints for Automation
|
|
126
|
-
migrations.AddConstraint(
|
|
127
|
-
model_name='automation',
|
|
128
|
-
constraint=models.CheckConstraint(
|
|
129
|
-
check=models.Q(
|
|
130
|
-
('created_by_user__isnull', False),
|
|
131
|
-
('created_by_org_user__isnull', True)
|
|
132
|
-
) | models.Q(
|
|
133
|
-
('created_by_user__isnull', True),
|
|
134
|
-
('created_by_org_user__isnull', False)
|
|
135
|
-
),
|
|
136
|
-
name='automation_single_creator'
|
|
137
|
-
),
|
|
138
|
-
),
|
|
139
|
-
migrations.AddConstraint(
|
|
140
|
-
model_name='automation',
|
|
141
|
-
constraint=models.CheckConstraint(
|
|
142
|
-
check=models.Q(('created_by_user__isnull', False)) | models.Q(('created_by_org_user__isnull', False)),
|
|
143
|
-
name='automation_requires_creator'
|
|
144
|
-
),
|
|
145
|
-
),
|
|
146
|
-
|
|
147
|
-
# 8. Add constraints for NotificationTemplate
|
|
148
|
-
migrations.AddConstraint(
|
|
149
|
-
model_name='notificationtemplate',
|
|
150
|
-
constraint=models.CheckConstraint(
|
|
151
|
-
check=models.Q(
|
|
152
|
-
('created_by_user__isnull', False),
|
|
153
|
-
('created_by_org_user__isnull', True)
|
|
154
|
-
) | models.Q(
|
|
155
|
-
('created_by_user__isnull', True),
|
|
156
|
-
('created_by_org_user__isnull', False)
|
|
157
|
-
),
|
|
158
|
-
name='template_single_creator'
|
|
159
|
-
),
|
|
160
|
-
),
|
|
161
|
-
migrations.AddConstraint(
|
|
162
|
-
model_name='notificationtemplate',
|
|
163
|
-
constraint=models.CheckConstraint(
|
|
164
|
-
check=models.Q(('created_by_user__isnull', False)) | models.Q(('created_by_org_user__isnull', False)),
|
|
165
|
-
name='template_requires_creator'
|
|
166
|
-
),
|
|
167
|
-
),
|
|
168
|
-
|
|
169
|
-
# 9. Delete deprecated Event model
|
|
170
|
-
migrations.DeleteModel(
|
|
171
|
-
name='Event',
|
|
172
|
-
),
|
|
173
|
-
]
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# Generated manually - Rename User to CompanyUser for clarity and consistency
|
|
2
|
-
|
|
3
|
-
from django.db import migrations
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class Migration(migrations.Migration):
|
|
7
|
-
|
|
8
|
-
dependencies = [
|
|
9
|
-
('constec_db', '0008_refactor_creator_fields'),
|
|
10
|
-
]
|
|
11
|
-
|
|
12
|
-
operations = [
|
|
13
|
-
# Rename tables
|
|
14
|
-
migrations.RenameModel(
|
|
15
|
-
old_name='User',
|
|
16
|
-
new_name='CompanyUser',
|
|
17
|
-
),
|
|
18
|
-
migrations.RenameModel(
|
|
19
|
-
old_name='UserRole',
|
|
20
|
-
new_name='CompanyUserRole',
|
|
21
|
-
),
|
|
22
|
-
migrations.RenameModel(
|
|
23
|
-
old_name='UserCompanyAccess',
|
|
24
|
-
new_name='CompanyUserAccess',
|
|
25
|
-
),
|
|
26
|
-
|
|
27
|
-
# Update table names
|
|
28
|
-
migrations.AlterModelTable(
|
|
29
|
-
name='companyuser',
|
|
30
|
-
table='core"."company_users',
|
|
31
|
-
),
|
|
32
|
-
migrations.AlterModelTable(
|
|
33
|
-
name='companyuserrole',
|
|
34
|
-
table='core"."company_user_roles',
|
|
35
|
-
),
|
|
36
|
-
migrations.AlterModelTable(
|
|
37
|
-
name='companyuseraccess',
|
|
38
|
-
table='core"."company_user_access',
|
|
39
|
-
),
|
|
40
|
-
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|