mantisbt-plugins / timetracking

Other
27 stars 43 forks source link

Error while instaling on postgresql #36

Open marcin-github opened 6 years ago

marcin-github commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 4 years ago

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

cproensa commented 4 years ago

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

semanticfire commented 4 years ago

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

semanticfire commented 4 years ago

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 commented 4 years ago

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:

semanticfire commented 4 years ago

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

cproensa commented 4 years ago

( 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 commented 4 years ago

Where can I find this migration?

cproensa commented 4 years ago

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

El dom., 9 feb. 2020 20:37, Bart van Leeuwen notifications@github.com 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 .

zamachuga commented 3 years ago

MantisBT 2.25.2 PostgreSQL 9.6.9

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