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

Error when performing DB migration 22 #2458

Open
pogo-excalibur opened this issue Jan 24, 2018 · 4 comments
Open

Error when performing DB migration 22 #2458

pogo-excalibur opened this issue Jan 24, 2018 · 4 comments

Comments

@pogo-excalibur
Copy link
Contributor

pogo-excalibur commented Jan 24, 2018

Expected Behavior

DB migrations should run without errors on all supported DBs.

Current Behavior

Running migration 22 (#2416) on a MySQL database produces an error:

ProgrammingError: (1064, u"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CONSTRAINT CONSTRAINT_2' at line 1")

Note: the concern here is the error message - the migration gets applied 'correctly'.

Possible Solution

MySQL doesn't support CHECK constraints, so the migration is not actually required for MySQL DBs. This is why the migration gets applied 'correctly' - in this case 'correctly' means not applying it at all.

The error is raised because MySQL also doesn't used the DROP CONSTRAINT syntax use in the PR.

It may therefore be necessary to detect the DB type and only apply the migration to MariaDB databases.

Alternatively, as this doesn't cause any particular issues we could just ignore it - most users have probably updated by now, and new users don't have to run DB migrations.

Steps to Reproduce (for bugs)

  1. Have a version of the database prior to v22 (I used v21 for testing)
  2. Update to a version which contains Update to fix CONSTRAINT_4 error for spawnpoint table #2416
  3. Run the DB migration

Context

It's a small issue - particularly as our docs recommend using MariaDB - but I've seen it come up a couple of times in #help so there are at least some users using MySQL.

Your Environment

MySQL DB, rather than MariaDB.

@pogo-excalibur pogo-excalibur changed the title Fix for CONSTRAINT_4 doesn't get applied by MySQL Warning when performing DB migration 22 Jan 24, 2018
@pogo-excalibur pogo-excalibur changed the title Warning when performing DB migration 22 Error when performing DB migration 22 Jan 24, 2018
@sebastienvercammen
Copy link
Member

Confirmed, but the problem isn't that MySQL doesn't support CHECK constraints. MySQL parses but ignores them.

The problem is that MySQL doesn't know DROP CONSTRAINT, causing a syntax error.

Since the constraints aren't applied in MySQL this won't cause any issues with databases, but we should handle it better.

@dongemus
Copy link
Contributor

FYI, I got this error migrating to 22 using MariaDB. I have 4 machines running mariadb so I can't remember which it was, but they all have 10.1xx or 10.2xx

@sebastienvercammen
Copy link
Member

@dongemus I've just tested on MariaDB and it worked properly. Could you reproduce the problem on MariaDB and paste the logs?

@dongemus
Copy link
Contributor

dongemus commented Jan 30, 2018

InfiniteChaos had it happen on MariaDB as well, he posted about it in Devkat #help

I had a machine that I hadn't used for RM in a while and so I did a pull and got the error on schema upgrade. It worked fine after restarting.
https://hastebin.com/fapoduwuwi.md

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