drbotzo-idlerpg/tests/test_project/ircbot/migrations/0016_placeholder_ircserver.py
Brian S. Stephan 9540c98d18
add more development tools and start the test scaffolding
this runs with a basic model and even more basic test, but I'm not
committing those yet as I'm still playing with the model (lest I make 30
revisions right off the bat)

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-05-05 23:03:23 -05:00

27 lines
762 B
Python

# Generated by Django 3.1.2 on 2021-04-25 04:11
from django.db import migrations
def create_placeholder_server(apps, schema_editor):
"""Create the first server entry, to be configured by the admin."""
IrcServer = apps.get_model('ircbot', 'IrcServer')
IrcServer.objects.create(name='default', hostname='irc.example.org', port=6667)
def delete_placeholder_server(apps, schema_editor):
"""Remove the default server."""
IrcServer = apps.get_model('ircbot', 'IrcServer')
IrcServer.objects.filter(name='default').delete()
class Migration(migrations.Migration):
dependencies = [
('ircbot', '0015_ircserver'),
]
operations = [
migrations.RunPython(create_placeholder_server, delete_placeholder_server),
]