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 in schema check for MsSql Server #361

Closed
enietom opened this Issue Apr 14, 2016 · 5 comments

Comments

Projects
None yet
2 participants
@enietom

enietom commented Apr 14, 2016

I have a JaverSqlRepository configuration with "MSSQL" as dialect. Everything was working fine, but the second time I started the app I got an SQL exception error after the following warning message:

WARN JaversSchemaManager- column jv_snapshot.version not exists, running ALTER TABLE ...

I debuged in order to see what was going on, and it appears to be an issue in JaversSchemaManager.addSnapshotVersionColumnIfNeeded. Javers is trying to execute:

ALTER TABLE jv_snapshot ADD COLUMN version BIGINT

but "COLUMN" is not recognized by MsSQL. I tried running:

ALTER TABLE jv_snapshot ADD version BIGINT

and it executed correctly.

This is happening in the last version of Javers and Microsoft SQL Server 2012.

@bartoszwalacik bartoszwalacik added the bug label Apr 15, 2016

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Apr 15, 2016

That's because I don't have Windows to test these schema migration scripts ...
Thanks for reporting, I will fix it

bartoszwalacik added a commit that referenced this issue Apr 15, 2016

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Apr 15, 2016

Do you think this fix is correct? ab32812

bartoszwalacik added a commit that referenced this issue Apr 15, 2016

@enietom

This comment has been minimized.

enietom commented Apr 15, 2016

That throws a...

"Cannot find data type NUMBER."

... error (at least on my MSSQL 2012 server). Guess you would have to add a new "else if" for the "MsSqlDialect" and then the SQL should be:

ALTER TABLE jv_snapshot ADD version BIGINT

bartoszwalacik added a commit that referenced this issue Apr 16, 2016

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Apr 16, 2016

ok, the last version should work

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Apr 17, 2016

fix released in javers 1.6.3
plese let me know if it is fine now

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