Complete project revamp with a bunch of commits #37
2 changed files with 53 additions and 0 deletions
34
app/migrations/0002_setup.py
Normal file
34
app/migrations/0002_setup.py
Normal 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;""")
|
||||
]
|
19
scripts/create-admin.sh
Executable file
19
scripts/create-admin.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
# Copyright 2023 Julian Müller (ChaoticByte)
|
||||
|
||||
# change to correct directory, if necessary
|
||||
script_absolute=$(realpath "$0")
|
||||
script_directory=$(dirname "$script_absolute")
|
||||
desired_directory=$(realpath "$script_directory"/..)
|
||||
if [ "$PWD" != "$desired_directory" ]; then
|
||||
echo "Changing to project directory..."
|
||||
cd "$desired_directory"
|
||||
fi
|
||||
|
||||
echo "Activating venv..."
|
||||
source ./venv/bin/activate
|
||||
|
||||
echo "Applying migrations..."
|
||||
./manage.py migrate
|
||||
|
||||
./manage.py createsuperuser
|
Loading…
Add table
Add a link
Reference in a new issue