Reverting back to admin pages as login and updates in the mobile api

This commit is contained in:
Vivek
2025-12-17 22:05:13 +05:30
parent 48c8abb366
commit 105da4a876
39 changed files with 2147 additions and 452 deletions

40
db_reset.py Normal file
View File

@@ -0,0 +1,40 @@
# reset_db.py
import os
import sys
import django
from django.core.management import call_command
from django.db import connection
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "eventify.settings")
django.setup()
def reset_postgres_schema():
user = connection.settings_dict.get("USER", "postgres")
with connection.cursor() as cursor:
cursor.execute("""
DROP SCHEMA public CASCADE;
CREATE SCHEMA public;
GRANT ALL ON SCHEMA public TO {user};
GRANT ALL ON SCHEMA public TO public;
""".format(user=user))
def main():
if "--force" not in sys.argv:
print("Refusing to run without --force (this DROPS ALL TABLES).")
sys.exit(1)
engine = connection.settings_dict.get("ENGINE", "")
if "postgresql" not in engine:
print("This script is intended for PostgreSQL. Aborting.")
sys.exit(1)
print("Dropping all tables by recreating public schema…")
reset_postgres_schema()
print("Running migrations…")
call_command("migrate", interactive=False)
print("Done.")
if __name__ == "__main__":
main()