Heimdall icon indicating copy to clipboard operation
Heimdall copied to clipboard

Add MySQL compatibility

Open hkpanchani opened this issue 2 years ago • 7 comments

If we can add mysql compatibility, it can supercharge the dashboard.

hkpanchani avatar Apr 07 '22 07:04 hkpanchani

laravel support mysql out of the box, you can add following settings to .env file (add correct settings to each line except the first line)

DB_CONNECTION=mysql
DB_HOST=
DB_PORT=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=

and run php artisan migrate in the command line and you should be good to go.

zhujunsan avatar Apr 25 '22 10:04 zhujunsan

It throws nothing but errors after doing this.

It connects and makes all the tables but just 500 errors.

heimdall.1.k4sb7mptekh3@rbpi-02    | In Connection.php line 671:
heimdall.1.k4sb7mptekh3@rbpi-02    |
heimdall.1.k4sb7mptekh3@rbpi-02    |   SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update
heimdall.1.k4sb7mptekh3@rbpi-02    |   a child row: a foreign key constraint fails (`heimdall`.`item_tag`, CONSTRA
heimdall.1.k4sb7mptekh3@rbpi-02    |   INT `item_tag_tag_id_foreign` FOREIGN KEY (`tag_id`) REFERENCES `items` (`i
heimdall.1.k4sb7mptekh3@rbpi-02    |   d`) ON DELETE CASCADE) (SQL: insert into `item_tag` (`item_id`, `tag_id`) v
heimdall.1.k4sb7mptekh3@rbpi-02    |   alues (1, 0))
heimdall.1.k4sb7mptekh3@rbpi-02    |
heimdall.1.k4sb7mptekh3@rbpi-02    |
heimdall.1.k4sb7mptekh3@rbpi-02    | In Connection.php line 464:
heimdall.1.k4sb7mptekh3@rbpi-02    |
heimdall.1.k4sb7mptekh3@rbpi-02    |   SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update
heimdall.1.k4sb7mptekh3@rbpi-02    |   a child row: a foreign key constraint fails (`heimdall`.`item_tag`, CONSTRA
heimdall.1.k4sb7mptekh3@rbpi-02    |   INT `item_tag_tag_id_foreign` FOREIGN KEY (`tag_id`) REFERENCES `items` (`i
heimdall.1.k4sb7mptekh3@rbpi-02    |   d`) ON DELETE CASCADE)
heimdall.1.k4sb7mptekh3@rbpi-02    |
heimdall.1.k4sb7mptekh3@rbpi-02    |
heimdall.1.k4sb7mptekh3@rbpi-02    |
heimdall.1.k4sb7mptekh3@rbpi-02    | In Setting.php line 184:
heimdall.1.k4sb7mptekh3@rbpi-02    |
heimdall.1.k4sb7mptekh3@rbpi-02    |   Call to a member function settings() on null

crkinard avatar Apr 26 '22 05:04 crkinard

OK my bad, because there's some db init, you need to run php artisan migrate --seed instead.

but even you got this through, I found out the code is actually not follow the best practice of laravel and hard coded sqlite file name in the app bootstrap code... more work needed to support mysql and other db driver :(

zhujunsan avatar Apr 26 '22 11:04 zhujunsan

i also hope mysql supported but, postgres will do right now.

martadinata666 avatar Apr 26 '22 12:04 martadinata666

So postgres works fine? Been meaning to spin up a docker of that for wikiJS because it will require it soon.

crkinard avatar Apr 26 '22 14:04 crkinard

im using heimdall with postgress, i can say it work fine.

martadinata666 avatar Apr 26 '22 14:04 martadinata666

im using heimdall with postgress, i can say it work fine.

Got postgress working in docker and heimdall linked to it. All seems well so far. Thanks for the info. Does seem a bit snappier to boot.

Now if this stupid chip shortage would be over and I can upgrade my Pi3b's to Pi4b's.

crkinard avatar Apr 26 '22 19:04 crkinard

Should be done with #944

keriati avatar Nov 12 '22 22:11 keriati