Added setup migration for globals and userdeposits view, added create-admin script #16

This commit is contained in:
ChaoticByte 2023-02-11 20:21:27 +01:00
parent 0a1ada15fb
commit 9bc9d519c0
2 changed files with 53 additions and 0 deletions

View file

@ -0,0 +1,34 @@
# 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;""")
]