diff --git a/src/api/src/backend/migrations/0030_pipeline_enabled_pipeline_lock_expiration_policy_and_more.py b/src/api/src/backend/migrations/0030_pipeline_enabled_pipeline_lock_expiration_policy_and_more.py new file mode 100644 index 00000000..da7b4410 --- /dev/null +++ b/src/api/src/backend/migrations/0030_pipeline_enabled_pipeline_lock_expiration_policy_and_more.py @@ -0,0 +1,41 @@ +# Generated by Django 4.1.2 on 2024-05-13 16:29 + +import backend.views.http.requests +from django.db import migrations, models +import django.db.models.deletion +import uuid + + +class Migration(migrations.Migration): + + dependencies = [ + ('backend', '0029_pipelinerun_description_pipelinerun_name'), + ] + + operations = [ + migrations.AddField( + model_name='pipeline', + name='enabled', + field=models.BooleanField(default=True), + ), + migrations.AddField( + model_name='pipeline', + name='lock_expiration_policy', + field=models.CharField(choices=[(backend.views.http.requests.EnumLockExpirationPolicy['NoOp'], backend.views.http.requests.EnumLockExpirationPolicy['NoOp']), (backend.views.http.requests.EnumLockExpirationPolicy['DeleteLock'], backend.views.http.requests.EnumLockExpirationPolicy['DeleteLock']), (backend.views.http.requests.EnumLockExpirationPolicy['DisablePipeline'], backend.views.http.requests.EnumLockExpirationPolicy['DisablePipeline'])], default=backend.views.http.requests.EnumLockExpirationPolicy['DisablePipeline'], max_length=16), + ), + migrations.CreateModel( + name='PipelineLock', + fields=[ + ('created_at', models.DateTimeField(auto_now_add=True)), + ('acquired_at', models.DateTimeField(default=None, null=True)), + ('expires_in', models.BigIntegerField(default=0)), + ('uuid', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)), + ('pipeline', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pipelinelocks', to='backend.pipeline')), + ('pipeline_run', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='pipelinelocks', to='backend.pipelinerun')), + ], + ), + migrations.AddConstraint( + model_name='pipelinelock', + constraint=models.UniqueConstraint(fields=('pipeline', 'pipeline_run'), name='pipelinelock_pipeline_pipeline_run'), + ), + ]