chandachewe10 / loan-management-system

Loan Management Software
78 stars 62 forks source link

Database migration fails on initial install #2

Closed coderintherye closed 1 year ago

coderintherye commented 1 year ago

Fresh install of latest main:

php artisan migrate Migration table created successfully. Migrating: 2014_10_12_100000_create_password_resets_table Migrated: 2014_10_12_100000_create_password_resets_table (9.91ms) Migrating: 2019_08_19_000000_create_failed_jobs_table Migrated: 2019_08_19_000000_create_failed_jobs_table (8.00ms) Migrating: 2019_12_14_000001_create_personal_access_tokens_table Migrated: 2019_12_14_000001_create_personal_access_tokens_table (13.09ms) Migrating: 2021_11_09_090003_create_transaction_histories_table Migrated: 2021_11_09_090003_create_transaction_histories_table (3.16ms) Migrating: 2021_11_18_093131_create_emailsubscriptions_table Migrated: 2021_11_18_093131_create_emailsubscriptions_table (6.69ms) Migrating: 2021_11_18_093532_create_messages_table Migrated: 2021_11_18_093532_create_messages_table (7.31ms) Migrating: 2021_12_09_235657_create_reg_employee_attachments_table

Illuminate\Database\QueryException

SQLSTATE[HY000]: General error: 1824 Failed to open the referenced table 'reg_employee_mst' (SQL: alter table reg_employee_attachments add constraint reg_employee_attachments_employee_id_foreign foreign key (employee_id) references reg_employee_mst (employee_id) on delete cascade)

coderintherye commented 1 year ago

Ahh I realize you documented this in the install steps. However, could it make sense to redo the migrations to be in order so the extra step isn't needed anymore? I could submit a patch for that if helpful.

For others, before running php artisan migrate you first need to run php artisan migrate --path=database/migrations/2022_01_31_191309_create_reg_employee_msts_table.php