mysql settings for django – settings.py

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'testdjango',
        'USER': 'appointmentusr',
        'PASSWORD': 'Ap5d4Splo40',
        'HOST': '127.0.0.1',
    }
}

Commands for models:

python3 manage.py makemigrations appointments

Migrations for ‘appointments’:
appointments/migrations/0002_auto_20180726_0431.py
– Remove field id from doctors
– Alter field docid on doctors

python3 manage.py check;

System check identified no issues (0 silenced).

python3 manage.py sqlmigrate appointments 0002

BEGIN;

— Remove field id from doctors

ALTER TABLE `appointments_doctors` DROP COLUMN `id`;

— Alter field docid on doctors

ALTER TABLE `appointments_doctors` ADD CONSTRAINT appointments_doctors_docid_12b3b5ed_uniq UNIQUE (`docid`);
ALTER TABLE `appointments_doctors` DROP PRIMARY KEY;
ALTER TABLE `appointments_doctors` ADD CONSTRAINT `appointments_doctors_docid_12b3b5ed_pk` PRIMARY KEY (`docid`);
COMMIT;

Finally, migrate:

python3 manage.py migrate

Operations to perform:
Apply all migrations: admin, appointments, auth, contenttypes, sessions
Running migrations:
Applying appointments.0002_auto_20180726_0431… OK
Applying appointments.0003_auto_20180726_0440… OK