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 while instaling on postgresql #36

Open
marcin-github opened this issue Feb 27, 2018 · 14 comments
Open

Error while instaling on postgresql #36

marcin-github opened this issue Feb 27, 2018 · 14 comments

Comments

@marcin-github
Copy link

Hello!
I'm using Mantis with postgresql. timetracking plugin tries to create table but special word user isn't properly escaped ( https://www.postgresql.org/docs/current/static/sql-keywords-appendix.html ):
ERROR: syntax error at or near "user" at character 134
2018-02-27 19:53:30 CET HOST:127.0.0.1 xxx VTID:3/55833 STATEMENT: CREATE TABLE mantis_plugin_TimeTracking_data_table (
id SERIAL,
bug_id INTEGER DEFAULT NULL,
user INTEGER DEFAULT NULL,
expenditure_date TIMESTAMP DEFAULT NULL,
hours FLOAT8 DEFAULT NULL,
timestamp TIMESTAMP DEFAULT NULL,
category VARCHAR(255) DEFAULT NULL,
info VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (id)
)

@cproensa
Copy link
Contributor

Are you using "master" branch? if so, then i guess it cant be installed then...

The "next" branch (which is an experimental rewrite of the functionality) uses "user_id" for that reason.
However, by the nature of schema updates applying incrementally, the starting step will fail too. You could modify manually the schema definitions to get to the final state where the old "user" field is dropped, and the new field "user_id" is kept.

@marcin-github
Copy link
Author

Yes, I'm trying master branch.
I tried branch next, with some manual sqling I installed plugin. Now I'm trying to discover how plugin works. I enabled time tracking in Mantis core earlier, maybe I shouldn't do it?

@dregad
Copy link
Member

dregad commented Feb 28, 2018

by the nature of schema updates applying incrementally, the starting step will fail too.

I have not actually tested this, but maybe it could work by altering schema step 0 to create the table with the correct column name (user_id), and somehow make the new column creation and data migration conditional to the existence of the user column. Maybe you can try to rename the column instead of manually creating/copying data/dropping it.

If it's too complex or not feasible, then make a breaking change so that the plugin installs cleanly, and provide manual upgrade instructions in the form of SQL statements for users upgrading from earlier versions.

@cproensa
Copy link
Contributor

I have not actually tested this, but maybe it could work by altering schema step 0 to create the table with the correct column name (user_id), and somehow make the new column creation and data migration conditional to the existence of the user column.

yes, that's what i had in mind, something in that line.

Maybe you can try to rename the column instead of manually creating/copying data/dropping it.

I think with the previous suggestion, it's better to keep the "create column" for the proper naming

@semanticfire
Copy link

I'm still having issues with installing the next branch on a Postgres installation ( Mantis BT 2.22.0 / 209 )

@cproensa
Copy link
Contributor

@semanticfire can you test this pull request: #46
to address this issue

@semanticfire
Copy link

The installation works, let me check later this week if everything works as expected

@semanticfire
Copy link

So the install works but I now run into errors when opening a issue, claiming the table for the plugin is missing ( which actually is true )

@cproensa
Copy link
Contributor

cproensa commented Feb 7, 2020

So the install works but I now run into errors when opening a issue, claiming the table for the plugin is missing ( which actually is true )

Have you:

  • Delete plugin_TimeTracking_schema config
  • Delete the table (if it exists)
  • install plugin

@semanticfire
Copy link

That does the trick!
( maybe unrelated, should it migrate existing time spend information? )

@cproensa
Copy link
Contributor

cproensa commented Feb 7, 2020

( maybe unrelated, should it migrate existing time spend information? )

you can migrate the data from the builtin timetracking to be used in this plugin (and can skip the "delete old data" step), but this new branch is not stable and may have unexpected changes.

@semanticfire
Copy link

Where can I find this migration?

@cproensa
Copy link
Contributor

cproensa commented Feb 9, 2020 via email

@zamachuga
Copy link

MantisBT 2.25.2
PostgreSQL 9.6.9

Install plugin error:
APPLICATION ERROR #2503
Plugin schema update crashed at block # 1

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

No branches or pull requests

5 participants