drinks-manager/app/migrations/0002_setup.py

35 lines
963 B
Python
Raw Normal View History

# GlobalValues Data migration #1
from django.db import migrations
def create_globals(apps, schema_editor):
Global = apps.get_model("app", "Global")
Global.objects.create(
name="global_message",
comment="Here you can set a global message that will be shown to every user",
value_float=0.0,
value_string="")
Global.objects.create(
name="admin_info",
comment="Here you can set am infotext that will be displayed on the admin panel",
value_float=0.0,
value_string="")
class Migration(migrations.Migration):
dependencies = [
('app', '0001_initial'),
]
operations = [
# create globals
migrations.RunPython(create_globals),
# create view for userdeposits
migrations.RunSQL("""
create or replace view app_userdeposits_view as
select * from app_registertransaction
where is_user_deposit = true;""")
]