Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running create_db on an already created database causes invalid state #2516

Open
jbeemster opened this issue May 4, 2018 · 1 comment
Open

Comments

@jbeemster
Copy link

Issue Summary

If the create_db command is run on an existing Redash database of an older version it is stamped as the latest version but no migrations end up being run. Any attempt to run upgrades afterwards simply do nothing as the system thinks it is up-to date.

To resolve you need to manually stamp the database at the previous versions migrations and to then run the upgrade process again.

This function stamps regardless of pre-existing database version: https://github.com/getredash/redash/blob/v4.0.1/redash/cli/database.py#L13

It would be great if either this process:

  1. Failed if the database already existed or;
  2. Ran the migrations (db upgrade) if the database does exist

Steps to Reproduce

  1. Install Redash V3
  2. Launch Redash V4 docker image with command: run --rm server create_db
  3. Attempt to access Redash running V4
  4. Attempt to run run --rm server manage db upgrade: this simply does nothing as the database appears to be up-to-date

All access to the Redash fails as it still has the database for V3 not V4.

Resolution requires manually stamping the database at the latest revision for V3 and then running the db upgrade process again - this time it will correctly update the database and everything will work again.

Technical details:

  • How did you install Redash: Docker
@citrin
Copy link
Contributor

citrin commented May 21, 2019

+1
It would be more easy to maintain Redash if instead two commands: server create_db and manage db upgrade, there will be a single command which will create DB if there is no tables and upgrade schema if previous version is found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants