app.memos.migrations.0003_memosnapshot

 1# Generated by Django 5.2.2 on 2025-06-19 10:59
 2
 3import django.db.models.deletion
 4from django.db import migrations, models
 5
 6
 7class Migration(migrations.Migration):
 8
 9    dependencies = [
10        ('memos', '0002_alter_memo_options_memo_created_at_memo_modified_at'),
11    ]
12
13    operations = [
14        migrations.CreateModel(
15            name='MemoSnapshot',
16            fields=[
17                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
18                ('info', models.JSONField(default=dict)),
19                ('approval_history', models.JSONField(default=dict)),
20                ('worker_status', models.JSONField(default=dict)),
21                ('timestamp', models.DateTimeField(auto_now_add=True)),
22                ('memo', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='snapshots', to='memos.memo')),
23            ],
24            options={
25                'db_table': 'memo_snapshot',
26                'ordering': ['-timestamp'],
27            },
28        ),
29    ]
class Migration(django.db.migrations.migration.Migration):
 8class Migration(migrations.Migration):
 9
10    dependencies = [
11        ('memos', '0002_alter_memo_options_memo_created_at_memo_modified_at'),
12    ]
13
14    operations = [
15        migrations.CreateModel(
16            name='MemoSnapshot',
17            fields=[
18                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
19                ('info', models.JSONField(default=dict)),
20                ('approval_history', models.JSONField(default=dict)),
21                ('worker_status', models.JSONField(default=dict)),
22                ('timestamp', models.DateTimeField(auto_now_add=True)),
23                ('memo', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='snapshots', to='memos.memo')),
24            ],
25            options={
26                'db_table': 'memo_snapshot',
27                'ordering': ['-timestamp'],
28            },
29        ),
30    ]

The base class for all migrations.

Migration files will import this from django.db.migrations.Migration and subclass it as a class called Migration. It will have one or more of the following attributes:

  • operations: A list of Operation instances, probably from django.db.migrations.operations
  • dependencies: A list of tuples of (app_path, migration_name)
  • run_before: A list of tuples of (app_path, migration_name)
  • replaces: A list of migration_names

Note that all migrations come out of migrations and into the Loader or Graph as instances, having been initialized with their app label and name.

dependencies = [('memos', '0002_alter_memo_options_memo_created_at_memo_modified_at')]
operations = [<CreateModel name='MemoSnapshot', fields=[('id', <django.db.models.fields.BigAutoField>), ('info', <django.db.models.fields.json.JSONField>), ('approval_history', <django.db.models.fields.json.JSONField>), ('worker_status', <django.db.models.fields.json.JSONField>), ('timestamp', <django.db.models.fields.DateTimeField>), ('memo', <django.db.models.fields.related.ForeignKey>)], options={'db_table': 'memo_snapshot', 'ordering': ['-timestamp']}>]