1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
# Generated by Django 2.2.24 on 2025-08-25 10:14
import ishtar_common.models_common
import django.core.validators
from django.db import migrations, models
import re
SQL_MIGRATE_1 = """
INSERT INTO archaeological_finds_find_museum_donors
(find_id, biographicalnote_id)
SELECT id, museum_donor_id FROM archaeological_finds_find
WHERE museum_donor_id IS NOT NULL;
"""
SQL_MIGRATE_2 = """
INSERT INTO archaeological_finds_find_museum_collections
(find_id, museumcollection_id)
SELECT id, museum_collection_id FROM archaeological_finds_find
WHERE museum_collection_id IS NOT NULL;
"""
class Migration(migrations.Migration):
dependencies = [
('ishtar_common', '0263_media_exporter'),
('archaeological_finds', '0137_data_migration_treatment_status_inputstatus'),
]
operations = [
migrations.AddField(
model_name='find',
name='museum_donors',
field=models.ManyToManyField(blank=True, related_name='finds_donors', to='ishtar_common.BiographicalNote', verbose_name='Donors, testators or vendors'),
),
migrations.RunSQL(SQL_MIGRATE_1),
migrations.RemoveField(
model_name='find',
name='museum_donor',
),
migrations.RemoveField(
model_name='historicalfind',
name='museum_donor',
),
migrations.CreateModel(
name='OwnerType',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('label', models.TextField(verbose_name='Label')),
('txt_idx', models.TextField(help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+\\Z'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')], verbose_name='Textual ID')),
('comment', models.TextField(blank=True, default='', verbose_name='Comment')),
('available', models.BooleanField(default=True, verbose_name='Available')),
('order', models.IntegerField(default=10, verbose_name='Order')),
('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='archaeological_finds.OwnerType', verbose_name='Parent')),
],
options={
'verbose_name': 'Ownership type',
'verbose_name_plural': 'Owner types',
'ordering': ('order', 'parent__label', 'label'),
},
bases=(ishtar_common.models_common.Cached, models.Model),
),
migrations.CreateModel(
name='OwnershipStatus',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('label', models.TextField(verbose_name='Label')),
('txt_idx', models.TextField(help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+\\Z'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')], verbose_name='Textual ID')),
('comment', models.TextField(blank=True, default='', verbose_name='Comment')),
('available', models.BooleanField(default=True, verbose_name='Available')),
('order', models.IntegerField(default=10, verbose_name='Order')),
('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='archaeological_finds.OwnershipStatus', verbose_name='Parent')),
],
options={
'verbose_name': 'Ownership status',
'verbose_name_plural': 'Ownership status',
'ordering': ('order', 'parent__label', 'label'),
},
bases=(ishtar_common.models_common.Cached, models.Model),
),
migrations.AddField(
model_name='find',
name='owner',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='archaeological_finds.OwnerType', verbose_name='Owner'),
),
migrations.AddField(
model_name='find',
name='ownership_status',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='archaeological_finds.OwnershipStatus', verbose_name='Ownership status'),
),
migrations.AddField(
model_name='historicalfind',
name='owner',
field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='archaeological_finds.OwnerType', verbose_name='Owner'),
),
migrations.AddField(
model_name='historicalfind',
name='ownership_status',
field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='archaeological_finds.OwnershipStatus', verbose_name='Ownership status'),
),
migrations.AddField(
model_name='find',
name='museum_collections',
field=models.ManyToManyField(blank=True, to='archaeological_finds.MuseumCollection', verbose_name='Collections'),
),
migrations.RunSQL(SQL_MIGRATE_2),
migrations.RemoveField(
model_name='find',
name='museum_collection',
),
migrations.RemoveField(
model_name='historicalfind',
name='museum_collection',
),
migrations.RemoveField(
model_name='find',
name='collection',
),
migrations.RemoveField(
model_name='historicalfind',
name='collection',
),
]
|