Project

General

Profile

Actions

action #5804

closed

Switch database to postgresql

Added by coolo over 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Feature requests
Target version:
Start date:
2015-01-09
Due date:
% Done:

100%

Estimated time:

Description

we need an out of process database

Actions #1

Updated by ancorgs over 9 years ago

That reminds me another partially related task we have always wanted to perform, remove so many foreign key and use strings instead of state_id and result_id. Maybe I'll take the opportunity.

Actions #2

Updated by coolo over 9 years ago

really? I thought foreign keys to 4 rows tables are a fetish of Ludwig. It would make the code so much easier if result was an enum instead of an id

Actions #3

Updated by ancorgs over 9 years ago

If I remember correctly, they were a fetish of Alberto. As far as I remember, Ludwig didn't have a strong opinion on that regard.

Actions #4

Updated by ancorgs over 9 years ago

Initial switch was smooth except for the timestamp triggers. They are driving me completely nuts. The mechanisms for triggers are different in each database system. For example, in PostgreSQL you need to define a PL/SQL function, which means having a special privilege in the database and dealing with SQL::Translator::Schema::Procedure in order to make everything work with our migrations (I have not managed to succeed yet after a whole afternoon.

From the very beginning I suggested to use https://metacpan.org/pod/DBIx::Class::TimeStamp instead of adding the triggers because I was afraid if hitting exactly this situation. I would like to play my I-told-you card here (as with state_id and result_id) and take the opportunity of the migration to change some database-related things. That is, switching to Class::Timestamp instead of triggers and to label instead of foreign keys for the states and results.

Anybody against it?

Actions #5

Updated by coolo over 9 years ago

I'm not. As expressed in the call, I have very little patience with the timestamps anyway.

Actions #6

Updated by ancorgs over 9 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 70

Mostly done. Tested PostgreSQL (fresh install) and SQLite (both fresh and update). Timestamps are now managed in Perl code instead of db triggers. Introduced dependencies and a config file. https://github.com/os-autoinst/openQA/pull/128

Actions #7

Updated by ancorgs over 9 years ago

Not closing because the packaging tasks are still pending (there are new dependencies and a new configuration file) and I expect some bugs to arise.

I finally didn't remove states and results tables because it was not needed. I still want to do it but I'll add a separate issue in progress for it.

Maybe dump_templates and load_templates can be extended to migrate everything to a new engine without wiping the existent data out. Should we consider it part of this issue or create a new one?

Actions #8

Updated by ancorgs over 9 years ago

Some time spent researching to create a tool to migrate between engines. Not feasible. Instead I have almost-working SQL scripts to dump sqlite and to populate postgresql with the resulting data.

Actions #9

Updated by ancorgs over 9 years ago

Finished the sql scripts to dump the SQLite db (http://paste.opensuse.org/18660049) and restore the info in a PostgreSQL db (http://paste.opensuse.org/99854883)

Actions #10

Updated by ancorgs about 9 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 70 to 100

Now that the package is ready, I consider this to be finished.

Actions

Also available in: Atom PDF