feat(devops): DB Migrations for Feature Flag and History model

ref: #662 #661 #659
This commit is contained in:
2025-03-02 00:28:38 +09:30
parent eda1fb673b
commit 4ecc841462

View File

@ -0,0 +1,54 @@
# Generated by Django 5.1.5 on 2025-03-01 12:57
import access.fields
import access.models.tenancy
import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('access', '0004_organizationhistory_teamhistory'),
('core', '0016_data_move_history_to_new_table'),
('itam', '0009_devicehistory_devicemodelhistory_devicetypehistory_and_more'),
]
operations = [
migrations.CreateModel(
name='FeatureFlag',
fields=[
('model_notes', models.TextField(blank=True, default=None, help_text='Tid bits of information', null=True, verbose_name='Notes')),
('id', models.AutoField(help_text='Primary key of the entry', primary_key=True, serialize=False, unique=True, verbose_name='ID')),
('name', models.CharField(help_text='Name of this feature', max_length=50, verbose_name='Name')),
('description', models.TextField(blank=True, default=None, help_text='Description of this feature', max_length=300, null=True, verbose_name='Description')),
('enabled', models.BooleanField(default=False, help_text='Is this feature enabled', verbose_name='Enabled')),
('created', access.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, help_text='Date and time of creation', verbose_name='Created')),
('modified', access.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, help_text='Date and time of last modification', verbose_name='Modified')),
('organization', models.ForeignKey(help_text='Organization this belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='+', to='access.organization', validators=[access.models.tenancy.TenancyObject.validatate_organization_exists], verbose_name='Organization')),
('software', models.ForeignKey(help_text='Software this feature flag is for', null=True, on_delete=django.db.models.deletion.SET_NULL, to='itam.software', verbose_name='Software')),
],
options={
'verbose_name': 'Feature Flag',
'verbose_name_plural': 'Feature Flag',
'ordering': ['name'],
},
),
migrations.CreateModel(
name='FeatureFlagHistory',
fields=[
('modelhistory_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelhistory')),
('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='history', to='devops.featureflag', verbose_name='Model')),
],
options={
'verbose_name': 'Feature Flag History',
'verbose_name_plural': 'Feature Flags History',
'db_table': 'devops_feature_flag_history',
'ordering': ['-created'],
},
bases=('core.modelhistory',),
),
]