refactor: Squash migrations so there is less of them for model notes

ref: #525 #389
This commit is contained in:
2025-02-09 20:40:25 +09:30
parent 4d5f029913
commit 05d4c4a94d
35 changed files with 393 additions and 748 deletions

View File

@ -1,4 +1,4 @@
# Generated by Django 5.1.5 on 2025-02-07 08:39
# Generated by Django 5.1.5 on 2025-02-09 11:07
import access.models
import django.db.models.deletion
@ -8,7 +8,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('access', '0004_organizationnotes'),
('access', '0003_alter_team_organization_organizationnotes_teamnotes'),
('core', '0013_alter_manufacturer_organization_and_more'),
('itam', '0007_alter_device_uuid'),
]
@ -64,4 +64,116 @@ class Migration(migrations.Migration):
name='organization',
field=models.ForeignKey(help_text='Organization this belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='+', to='access.organization', validators=[access.models.TenancyObject.validatate_organization_exists], verbose_name='Organization'),
),
migrations.CreateModel(
name='DeviceModelNotes',
fields=[
('modelnotes_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelnotes')),
('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='itam.devicemodel', verbose_name='Model')),
],
options={
'verbose_name': 'Device Model Note',
'verbose_name_plural': 'Device Model Notes',
'db_table': 'itam_device_mdel_notes',
'ordering': ['-created'],
},
bases=('core.modelnotes',),
),
migrations.CreateModel(
name='DeviceNotes',
fields=[
('modelnotes_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelnotes')),
('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='itam.device', verbose_name='Model')),
],
options={
'verbose_name': 'Device Note',
'verbose_name_plural': 'Device Notes',
'db_table': 'itam_device_notes',
'ordering': ['-created'],
},
bases=('core.modelnotes',),
),
migrations.CreateModel(
name='DeviceTypeNotes',
fields=[
('modelnotes_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelnotes')),
('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='itam.devicetype', verbose_name='Model')),
],
options={
'verbose_name': 'Device Type Note',
'verbose_name_plural': 'Device TypeNotes',
'db_table': 'itam_device_type_notes',
'ordering': ['-created'],
},
bases=('core.modelnotes',),
),
migrations.CreateModel(
name='OperatingSystemNotes',
fields=[
('modelnotes_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelnotes')),
('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='itam.operatingsystem', verbose_name='Model')),
],
options={
'verbose_name': 'Operating System Note',
'verbose_name_plural': 'Operating System Notes',
'db_table': 'itam_operating_system_notes',
'ordering': ['-created'],
},
bases=('core.modelnotes',),
),
migrations.CreateModel(
name='OperatingSystemVersionNotes',
fields=[
('modelnotes_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelnotes')),
('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='itam.operatingsystemversion', verbose_name='Model')),
],
options={
'verbose_name': 'Operating System Version Note',
'verbose_name_plural': 'Operating System Version Notes',
'db_table': 'itam_operating_system_version_notes',
'ordering': ['-created'],
},
bases=('core.modelnotes',),
),
migrations.CreateModel(
name='SoftwareCategoryNotes',
fields=[
('modelnotes_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelnotes')),
('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='itam.softwarecategory', verbose_name='Model')),
],
options={
'verbose_name': 'Software Category Note',
'verbose_name_plural': 'Software Category Notes',
'db_table': 'itam_software_category_notes',
'ordering': ['-created'],
},
bases=('core.modelnotes',),
),
migrations.CreateModel(
name='SoftwareNotes',
fields=[
('modelnotes_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelnotes')),
('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='itam.software', verbose_name='Model')),
],
options={
'verbose_name': 'Software Note',
'verbose_name_plural': 'Software Notes',
'db_table': 'itam_software_notes',
'ordering': ['-created'],
},
bases=('core.modelnotes',),
),
migrations.CreateModel(
name='SoftwareVersionNotes',
fields=[
('modelnotes_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelnotes')),
('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='itam.softwareversion', verbose_name='Model')),
],
options={
'verbose_name': 'Software Version Note',
'verbose_name_plural': 'Software Version Notes',
'db_table': 'itam_software_version_notes',
'ordering': ['-created'],
},
bases=('core.modelnotes',),
),
]

View File

@ -1,29 +0,0 @@
# Generated by Django 5.1.5 on 2025-02-07 08:39
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0013_alter_manufacturer_organization_and_more'),
('itam', '0008_alter_device_organization_and_more'),
]
operations = [
migrations.CreateModel(
name='DeviceNotes',
fields=[
('modelnotes_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelnotes')),
('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='itam.device', verbose_name='Model')),
],
options={
'verbose_name': 'Device Note',
'verbose_name_plural': 'Device Notes',
'db_table': 'itam_device_notes',
'ordering': ['-created'],
},
bases=('core.modelnotes',),
),
]

View File

@ -1,29 +0,0 @@
# Generated by Django 5.1.5 on 2025-02-07 10:05
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0015_manufacturernotes'),
('itam', '0009_devicenotes'),
]
operations = [
migrations.CreateModel(
name='OperatingSystemNotes',
fields=[
('modelnotes_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelnotes')),
('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='itam.operatingsystem', verbose_name='Model')),
],
options={
'verbose_name': 'Operating System Note',
'verbose_name_plural': 'Operating System Notes',
'db_table': 'itam_operating_system_notes',
'ordering': ['-created'],
},
bases=('core.modelnotes',),
),
]

View File

@ -1,29 +0,0 @@
# Generated by Django 5.1.5 on 2025-02-07 10:16
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0015_manufacturernotes'),
('itam', '0010_operatingsystemnotes'),
]
operations = [
migrations.CreateModel(
name='SoftwareNotes',
fields=[
('modelnotes_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelnotes')),
('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='itam.software', verbose_name='Model')),
],
options={
'verbose_name': 'Software Note',
'verbose_name_plural': 'Software Notes',
'db_table': 'itam_software_notes',
'ordering': ['-created'],
},
bases=('core.modelnotes',),
),
]

View File

@ -1,29 +0,0 @@
# Generated by Django 5.1.5 on 2025-02-07 11:37
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0015_manufacturernotes'),
('itam', '0011_softwarenotes'),
]
operations = [
migrations.CreateModel(
name='DeviceTypeNotes',
fields=[
('modelnotes_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelnotes')),
('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='itam.devicetype', verbose_name='Model')),
],
options={
'verbose_name': 'Device Type Note',
'verbose_name_plural': 'Device TypeNotes',
'db_table': 'itam_device_type_notes',
'ordering': ['-created'],
},
bases=('core.modelnotes',),
),
]

View File

@ -1,29 +0,0 @@
# Generated by Django 5.1.5 on 2025-02-07 12:00
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0015_manufacturernotes'),
('itam', '0012_devicetypenotes'),
]
operations = [
migrations.CreateModel(
name='DeviceModelNotes',
fields=[
('modelnotes_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelnotes')),
('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='itam.devicemodel', verbose_name='Model')),
],
options={
'verbose_name': 'Device Model Note',
'verbose_name_plural': 'Device Model Notes',
'db_table': 'itam_device_mdel_notes',
'ordering': ['-created'],
},
bases=('core.modelnotes',),
),
]

View File

@ -1,29 +0,0 @@
# Generated by Django 5.1.5 on 2025-02-07 12:36
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0015_manufacturernotes'),
('itam', '0013_devicemodelnotes'),
]
operations = [
migrations.CreateModel(
name='OperatingSystemVersionNotes',
fields=[
('modelnotes_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelnotes')),
('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='itam.operatingsystemversion', verbose_name='Model')),
],
options={
'verbose_name': 'Operating System Version Note',
'verbose_name_plural': 'Operating System Version Notes',
'db_table': 'itam_operating_system_version_notes',
'ordering': ['-created'],
},
bases=('core.modelnotes',),
),
]

View File

@ -1,29 +0,0 @@
# Generated by Django 5.1.5 on 2025-02-07 13:00
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0015_manufacturernotes'),
('itam', '0014_operatingsystemversionnotes'),
]
operations = [
migrations.CreateModel(
name='SoftwareCategoryNotes',
fields=[
('modelnotes_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelnotes')),
('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='itam.softwarecategory', verbose_name='Model')),
],
options={
'verbose_name': 'Software Category Note',
'verbose_name_plural': 'Software Category Notes',
'db_table': 'itam_software_category_notes',
'ordering': ['-created'],
},
bases=('core.modelnotes',),
),
]

View File

@ -1,29 +0,0 @@
# Generated by Django 5.1.5 on 2025-02-07 13:09
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0015_manufacturernotes'),
('itam', '0015_softwarecategorynotes'),
]
operations = [
migrations.CreateModel(
name='SoftwareVersionNotes',
fields=[
('modelnotes_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelnotes')),
('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='itam.softwareversion', verbose_name='Model')),
],
options={
'verbose_name': 'Software Version Note',
'verbose_name_plural': 'Software Version Notes',
'db_table': 'itam_software_version_notes',
'ordering': ['-created'],
},
bases=('core.modelnotes',),
),
]