forked from adamlaska/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0018_remove_old_document_field.py
More file actions
125 lines (119 loc) · 4.04 KB
/
0018_remove_old_document_field.py
File metadata and controls
125 lines (119 loc) · 4.04 KB
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
124
125
# Copyright The IETF Trust 2019-2020, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-20 09:53
from django.db import migrations, models
import django.db.models.deletion
import ietf.utils.models
class Migration(migrations.Migration):
dependencies = [
('doc', '0017_make_document_id_primary_key'),
]
operations = [
migrations.AlterModelOptions(
name='documentauthor',
options={'ordering': ['document2', 'order']},
),
migrations.RemoveIndex(
model_name='docevent',
name='doc_doceven_type_43e53e_idx',
),
migrations.RemoveField(
model_name='docalias',
name='document',
),
migrations.RemoveField(
model_name='docevent',
name='doc',
),
migrations.RemoveField(
model_name='dochistory',
name='doc',
),
migrations.RemoveField(
model_name='documentauthor',
name='document',
),
migrations.RemoveField(
model_name='documenturl',
name='doc',
),
migrations.RemoveField(
model_name='relateddochistory',
name='target',
),
migrations.RemoveField(
model_name='relateddocument',
name='source',
),
migrations.RemoveField(
model_name='relateddocument',
name='target',
),
migrations.AddIndex(
model_name='docevent',
index=models.Index(fields=['type', 'doc2'], name='doc_doceven_type_ac7748_idx'),
),
# The following 9 migrations are related to the m2m fields on Document
# Remove the intermediary model field pointing to Document.name
migrations.RemoveField(
model_name='documentlanguages',
name='document',
),
migrations.RemoveField(
model_name='documentstates',
name='document',
),
migrations.RemoveField(
model_name='documenttags',
name='document',
),
# Rename the intermediary model field pointing to Document.id, to
# match the implicit m2m table
migrations.RenameField(
model_name='documentlanguages',
old_name='document2',
new_name='document',
),
migrations.RenameField(
model_name='documentstates',
old_name='document2',
new_name='document',
),
migrations.RenameField(
model_name='documenttags',
old_name='document2',
new_name='document',
),
# Alter the fields to point to Document.pk instead of Document.name
migrations.AlterField(
model_name='documentlanguages',
name='document',
field=ietf.utils.models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='doc.Document'),
),
migrations.AlterField(
model_name='documentstates',
name='document',
field=ietf.utils.models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='doc.Document'),
),
migrations.AlterField(
model_name='documenttags',
name='document',
field=ietf.utils.models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='doc.Document'),
),
# Remove the implicit m2m tables which point to Document.name
migrations.RemoveField(
model_name='document',
name='formal_languages',
),
migrations.RemoveField(
model_name='document',
name='states',
),
migrations.RemoveField(
model_name='document',
name='tags',
),
# Next (in a separate migration, in order to commit the above before
# we proceed) we'll create the implicit m2m tables again, this time
# pointing to Document.id since that's now the primary key.
]