Coverage for cluster / migrations / 0014_historicalmodel.py: 100%
7 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-03-24 12:43 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-03-24 12:43 +0000
1# Generated by Django 6.0.3 on 2026-03-10 07:18
3import django.db.models.deletion
4import simple_history.models
5from django.conf import settings
6from django.db import migrations, models
9class Migration(migrations.Migration):
11 dependencies = [
12 ("auth", "0012_alter_user_first_name_max_length"),
13 ("cluster", "0013_alter_model_options"),
14 (
15 "clustersoftware",
16 "0010_alter_model_options_alter_model_unique_together_and_more",
17 ),
18 migrations.swappable_dependency(settings.AUTH_USER_MODEL),
19 ]
21 operations = [
22 migrations.CreateModel(
23 name="HistoricalModel",
24 fields=[
25 (
26 "id",
27 models.BigIntegerField(
28 auto_created=True, blank=True, db_index=True, verbose_name="ID"
29 ),
30 ),
31 ("name", models.CharField(db_index=True, max_length=45)),
32 ("history_id", models.AutoField(primary_key=True, serialize=False)),
33 ("history_date", models.DateTimeField(db_index=True)),
34 ("history_change_reason", models.CharField(max_length=100, null=True)),
35 (
36 "history_type",
37 models.CharField(
38 choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
39 max_length=1,
40 ),
41 ),
42 (
43 "clustersoftware",
44 models.ForeignKey(
45 blank=True,
46 db_constraint=False,
47 null=True,
48 on_delete=django.db.models.deletion.DO_NOTHING,
49 related_name="+",
50 related_query_name="cluster",
51 to="clustersoftware.model",
52 ),
53 ),
54 (
55 "group",
56 models.ForeignKey(
57 blank=True,
58 db_constraint=False,
59 editable=False,
60 null=True,
61 on_delete=django.db.models.deletion.DO_NOTHING,
62 related_name="+",
63 to="auth.group",
64 ),
65 ),
66 (
67 "history_user",
68 models.ForeignKey(
69 null=True,
70 on_delete=django.db.models.deletion.SET_NULL,
71 related_name="+",
72 to=settings.AUTH_USER_MODEL,
73 ),
74 ),
75 ],
76 options={
77 "verbose_name": "historical model",
78 "verbose_name_plural": "historical models",
79 "ordering": ("-history_date", "-history_id"),
80 "get_latest_by": ("history_date", "history_id"),
81 },
82 bases=(simple_history.models.HistoricalChanges, models.Model),
83 ),
84 ]