Page 1 of 1

list for not removing custom tables on db upgrade

PostPosted: Fri Jul 04, 2014 10:46 am
by greedysoul
Please if it's possible allow a textfile list of (custom) tables and views not to be removed when doing an upgrade. I'm stuck at version 4.10.9 and upgrading to version 4.11.x attempts to remove all my custom tables/views which I have a few dozen and would rather not touch when upgrading. :cry:

Re: list for not removing custom tables on db upgrade

PostPosted: Fri Jul 04, 2014 11:14 am
by WhiteRider
We do not support modifying PokerTracker databases so I'm afraid you will need to maintain any changes you make. Having PT4 avoid any changes could make the update process less efficient (take longer), and would certainly involve some development work which would only help a tiny proportion of our users.

Re: list for not removing custom tables on db upgrade

PostPosted: Sun Jul 06, 2014 10:32 pm
by _dave_
OP, look in to the command line program pg_dump (part of default postgresql installation). for example:

Code: Select all
pg_dump -t 'custom_table1' -t 'custom_table2'  pt4_1213213_!23213 > db.sql


would create an SQL file you could reload to restore your custom table 1 & 2 after the update has completed.

http://www.postgresql.org/docs/9.1/stat ... gdump.html

Views should just be copy/pastable from PGAdmin, although dump's -t option will work on a view also. If you prefix all your custom stuff with a certain sequence, you can use wildcards in -t also - e.g.
Code: Select all
-t 'custom_table*'
would dump them both from the above example.

I might try the "it will certainly involve some development effort" excuse next time a customer requests me develop them some software that doesn't have the side effect of delete their work! lol

Re: list for not removing custom tables on db upgrade

PostPosted: Sun Jul 06, 2014 10:39 pm
by _dave_
in fact, here I've done most of the work for you!

add to your update code, before it executes: ( - capital T excludes a table)

Code: Select all
pg_dump -T 'tourney_hand_player_statistics' -T 'tourney_hand_summary' ...

complete the list with the names of all PT4 tables, which surely isn't hard for a PT4 developer to find, and there you go - it will backup any alien tables. after update is done, restore them.

Might not work, didn't test of course - would be too much effort :p But it should I think!