Closed maxpatiiuk closed 3 years ago
Is it a problem with the initial .sql
file I use to create the database?
Should I automatically create the needed table if it doesn't exist?
Running ./ve/bin/python manage.py migrate workbench
fixed the issue. Although, all of the datasets that were present in the database, no longer show up.
That's expected. The data sets are stored in a different table now.
I recreated a container from scratch and needed to run ./ve/bin/python manage.py migrate workbench
again to fix this issue. Seems like it doesn't migrate automatically
It should apply the migrations when the Specify 7 Docker container is started normally. If the Docker CMD is overridden, it will not. This is so that the main Docker container and the worker container don't both try to apply the migrations. I'm not really sure the best way to handle this because it would still be a problem if there were multiple instances of the Docker container started with the default CMD.
https://github.com/specify/specify7/blob/wb-upload-for-testing/docker-entrypoint.sh#L4
By default CMD, do you mean docker run ...
?
I run it with docker-compose up --build -d
(with all of the previous volumes deleted)
If there isn't an easy solution, maybe that migrations script can be made to check if the table exists, and if it does not, create it
The default CMD starts gunicorn (https://github.com/specify/specify7/blob/wb-upload-for-testing/Dockerfile#L124). When it is started by the development docker-compose (https://github.com/specify/specify7/blob/wb-upload-for-testing/docker-compose.yml#L18) it is overridden to start the development server. That causes the docker-entrypoint script to skip the migrate commands.
The migrate commands do check if the tables exist, but if more than one process runs them at the same time, there is a race condition and both process may see a table not existing and both decide to create it. It might be okay if MySQL had DDL transactions, but it doesn't.
Fixed in ca5da30e
I'm getting the
Table 'specify.spdataset' doesn't exist
error when clicking on theWorkBench
tab in Specify 7 I'm on the latest commit fromwb-upload-for-testing
. Also, I have rebuild the container from scratch and deleted the previous database and all of the previous containers, so there can't be any interference from the previous version of Specify 7