I'm trying to integrate Metabase with our app (written in Laravel 6) on my local development machine for a proof-of-concept (we want our customers to be able to see charts and graphs that reflect their specific data--the Enable embedding in other applications approach).
Our local setup uses Docker via docker-compose.yml which spins up a container for a MySQL database. I modified the file to pull the latest Metabase image and linked it to the container running MySQL.
The issue I'm having is the linking process is finding un-run migrations. It tries to make a table we DO use (
permissions) but then two that we do not use--
permissions_group_membership. When I check Laravel for un-run migrations, it finds none. I tried dropping the two unused tables and shutting down all the containers and starting them again, but the same thing happens.
Any help would be appreciated!
You need to put Metabase in a database that is empty - it should only be Metabase in that database.
I might be misunderstanding some of the docs that I read.
You said "put Metabase in a database that is empty". It's not really in the database, is it? They're two separate containers. The MySQL container is where my app data is stored. The Metabase container is where--it's my understanding, at least--the charts and graphs get served from and are informed by the data pulled from the MySQL container. Are you saying that the MySQL database has to be empty of all data before Metabase can work with it?
@benh The database has to be empty.
@flamber ok. That is not so much an issue for my local dev and proof-of-concept. But that's way more of an issue for deploying to production. Are there ways to integrate Metabase with a database that has data? We couldn't erase our production data.
@flamber is there supposed to be (1) my local dev MySQL database that stores data from using the app, (2) a MySQL database that's just for Metabase to use, and (3) the Metabase container that connects to that 2nd database?
@benh You are confusing the Metabase application database with your data sources.
The Metabase application database has to be completely separate from anything else. It's not part of anything but Metabase.
Because you are using MySQL, then it's terminology might confuse even more, since you can create multiple databases within the MySQL server - Metabase just needs one of those database.
@flamber thank you for being so helpful. I added a MySQL database just for Metabase, and it's all working. Although I put this in its own container. Realizing now that I should just make a new database in the existing one, like you mentioned.
I think my final question for this setup is this form asking for my app's MySQL database info? The database that is not the Metabase application database?
@benh The application database is controlled by the environment variables. It's where Metabase stored all its information (dashboard, users, questions, etc). It has absolutely nothing to do with the database sources you want to be able to make queries again using the Metabase interface.
Application database: https://www.metabase.com/docs/latest/operations-guide/configuring-application-database.html
Data sources: https://www.metabase.com/docs/latest/administration-guide/01-managing-databases.html