forked from Minecraft/minecraft_manager
49 lines
1.7 KiB
Python
49 lines
1.7 KiB
Python
|
# Generated by Django 2.0.5 on 2018-12-13 20:20
|
||
|
|
||
|
from django.conf import settings
|
||
|
from django.db import migrations, models
|
||
|
import django.db.models.deletion
|
||
|
|
||
|
|
||
|
def migrate_notes(apps, schema_editor):
|
||
|
Note = apps.get_model('minecraft_manager', 'Note')
|
||
|
TicketNote = apps.get_model('minecraft_manager', 'TicketNote')
|
||
|
for note in Note.objects.all():
|
||
|
ticket_note = TicketNote(author=note.author, ticket_id=note.ref_id, message=note.message, last_update=note.last_update, date=note.date)
|
||
|
ticket_note.save()
|
||
|
|
||
|
|
||
|
class Migration(migrations.Migration):
|
||
|
|
||
|
dependencies = [
|
||
|
('minecraft_manager', '0012_token_description'),
|
||
|
]
|
||
|
|
||
|
operations = [
|
||
|
migrations.CreateModel(
|
||
|
name='TicketNote',
|
||
|
fields=[
|
||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||
|
('message', models.TextField(max_length=1000)),
|
||
|
('last_update', models.DateTimeField(auto_now_add=True, null=True)),
|
||
|
('date', models.DateTimeField(auto_now_add=True, null=True)),
|
||
|
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||
|
('ticket',
|
||
|
models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='minecraft_manager.Ticket')),
|
||
|
],
|
||
|
),
|
||
|
migrations.RunPython(migrate_notes),
|
||
|
migrations.DeleteModel(
|
||
|
name='Note',
|
||
|
),
|
||
|
migrations.RenameModel(
|
||
|
old_name='Warning',
|
||
|
new_name='Note'
|
||
|
),
|
||
|
migrations.RenameField(
|
||
|
model_name='Note',
|
||
|
old_name='severity',
|
||
|
new_name='importance'
|
||
|
)
|
||
|
]
|