accounts.migrations.0012_auto_20250628_1215
1# Generated by Django 5.2.2 on 2025-06-28 06:45 2 3from django.db import migrations 4from accounts.models import User 5 6def create_initial_data(apps, schema_editor): 7 User.objects.create_superuser( 8 institution_id='admin', 9 role=None, # Assuming role is set to None for superuser 10 phone_number='1234567890', 11 hospital=None, # Assuming hospital is set to None for superuser 12 password='admin123', 13 ) 14 15class Migration(migrations.Migration): 16 17 dependencies = [ 18 ('accounts', '0011_user_is_logged_in'), 19 ] 20 21 operations = [ 22 migrations.RunPython(create_initial_data), 23 ]
def
create_initial_data(apps, schema_editor):
class
Migration(django.db.migrations.migration.Migration):
16class Migration(migrations.Migration): 17 18 dependencies = [ 19 ('accounts', '0011_user_is_logged_in'), 20 ] 21 22 operations = [ 23 migrations.RunPython(create_initial_data), 24 ]
The base class for all migrations.
Migration files will import this from django.db.migrations.Migration and subclass it as a class called Migration. It will have one or more of the following attributes:
- operations: A list of Operation instances, probably from django.db.migrations.operations
- dependencies: A list of tuples of (app_path, migration_name)
- run_before: A list of tuples of (app_path, migration_name)
- replaces: A list of migration_names
Note that all migrations come out of migrations and into the Loader or Graph as instances, having been initialized with their app label and name.