sarapis / orservices

ORServices is an open source, smartphone-friendly directory application that enables you to collect, verify, organize and share information about social services in your community with your stakeholders, beneficiaries, partner organizations and more.
https://sarapis.org/human-services/orservices/
22 stars 16 forks source link

Database dump loading issues with 06032024.sql #132

Closed royappa closed 4 months ago

royappa commented 4 months ago

The configuration instructions at https://github.com/sarapis/orservices have some sequencing issues, making it very difficult for brand new users to get a system up and running.

The sequence there is:

  1. Create MySQL database
  2. php artisan migrate
  3. php artisan db:seed
  4. Then "Create database and upload sql dump file from database/dump/latest_date.sql"

First, the "create database" was already done, so those words can be removed. Next, the problem is that with this sequence we get the error "Table 'accessibilities' already exists", because the "migrate" has already created the table. So I tried changing the "CREATE TABLE" to "CREATE TABLE IF NOT EXISTS". But then, loading the dump 06032024.sql gives a different error, "ERROR 1054 (42S22) at line 998: Unknown column 'top_menu_link_color' in 'field list'".

So the dump file, I think is not compatible with the migrations.

That may be hard to sort out so I just loaded the dump file and SKIPPED the "migrate", since it should after all have the correct database. With this route, we get a constraint error "Duplicate entry 'admin@admin.com' for key 'users.users_email_unique'". And of course, we don't know what password 'admin@admin.com' might have in the dump file.

So in the end I did these steps:

  1. Create database
  2. Load 06032024.sql
  3. Delete the row for admin@admin.com in 'users' table
  4. php artisan db:seed

This way, I was able to get the site running, and login with 'admin@admin.com'.

If you can guarantee that the dump always has the default password for 'admin@admin.com' then we don't need steps 3, 4.

d9it commented 4 months ago

If you import the DB file, you won't need to run migrate and seed.