timetracking icon indicating copy to clipboard operation
timetracking copied to clipboard

Error while instaling on postgresql

Open marcin-github opened this issue 7 years ago • 14 comments

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) )

marcin-github avatar Feb 27 '18 19:02 marcin-github

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.

cproensa avatar Feb 27 '18 19:02 cproensa

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?

marcin-github avatar Feb 28 '18 09:02 marcin-github

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.

dregad avatar Feb 28 '18 11:02 dregad

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

cproensa avatar Feb 28 '18 12:02 cproensa

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

semanticfire avatar Jan 28 '20 11:01 semanticfire

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

cproensa avatar Jan 29 '20 01:01 cproensa

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

semanticfire avatar Feb 05 '20 21:02 semanticfire

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 )

semanticfire avatar Feb 07 '20 20:02 semanticfire

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

cproensa avatar Feb 07 '20 21:02 cproensa

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

semanticfire avatar Feb 07 '20 23:02 semanticfire

( 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.

cproensa avatar Feb 07 '20 23:02 cproensa

Where can I find this migration?

semanticfire avatar Feb 09 '20 19:02 semanticfire

That branch has another directory with the migration tool. Its a separate plugin

El dom., 9 feb. 2020 20:37, Bart van Leeuwen [email protected] escribió:

Where can I find this migration?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mantisbt-plugins/timetracking/issues/36?email_source=notifications&email_token=ADLYGI3URVBGCS5GWYRE7MTRCBLQTA5CNFSM4ESV7LQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELGV3GY#issuecomment-583884187, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLYGIYNXAFL5KZPIEEUO3DRCBLQTANCNFSM4ESV7LQQ .

cproensa avatar Feb 09 '20 21:02 cproensa

MantisBT 2.25.2 PostgreSQL 9.6.9

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

zamachuga avatar Jul 01 '21 09:07 zamachuga