forked from adamlaska/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0020_copy_docs_m2m_table.py
More file actions
34 lines (27 loc) · 1.16 KB
/
0020_copy_docs_m2m_table.py
File metadata and controls
34 lines (27 loc) · 1.16 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
# Copyright The IETF Trust 2019-2020, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-21 05:31
import sys, time
from django.db import migrations
def timestamp(apps, schema_editor):
sys.stderr.write('\n %s' % time.strftime('%Y-%m-%d %H:%M:%S'))
class Migration(migrations.Migration):
dependencies = [
('doc', '0019_rename_field_document2'),
]
operations = [
# Copy the doc IDs from the explicit m2m table to the implicit table
migrations.RunPython(timestamp, timestamp),
migrations.RunSQL(
"INSERT INTO doc_document_formal_languages SELECT id,document_id,formallanguagename_id FROM doc_documentlanguages;",
""),
migrations.RunPython(timestamp, timestamp),
migrations.RunSQL(
"INSERT INTO doc_document_states SELECT id,document_id,state_id FROM doc_documentstates;",
""),
migrations.RunPython(timestamp, timestamp),
migrations.RunSQL(
"INSERT INTO doc_document_tags SELECT id,document_id,doctagname_id FROM doc_documenttags;",
""),
migrations.RunPython(timestamp, timestamp),
]