Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4013 closed enhancement (fixed)

Prompt before upgrading database schema

Reported by: Nigel Owned by: Isaac Richards
Priority: minor Milestone: 0.21
Component: mythtv Version: head
Severity: medium Keywords: rogue update
Cc: Ticket locked: no

Description

This adds a new method, MythContext::PromptForSchemaUpgrade() which if possible asks the user before upgrading the database schema. If the context has a GUI (mythtv-setup, mythfrontend) it will use a Popup. If the context has no GUI (mythbackend and friends), it prompts in the command shell (unless stdin or stdout is redirected, in which case it defaults to the current behaviour - upgrading).

If the user/developer wants to always live dangerously, set DBSchemaAutoUpgrade in the database.

The patch enables this for TV database schema upgrades only, but it could also be added to plugins.


Please test. Bug reports, better warning messages or button labels are all very welcome.
I would like to add this soon, before too many UPnP autodiscovery testers wreck their backends :-)

Attachments (2)

promptSchema.patch (4.0 KB) - added by Nigel 12 years ago.
promptSchema.2.patch (7.4 KB) - added by Nigel 12 years ago.
Expert mode for "Use existing", confirmation prompting, check for newer schema

Download all attachments as: .zip

Change History (6)

Changed 12 years ago by Nigel

Attachment: promptSchema.patch added

comment:1 Changed 12 years ago by Nigel

(In [14562]) Use defaults for user response from non-interactive shells. Only currently used when prompting for database params (mysql.txt), but schema upgrading will also use it in the future (see #4013).

Changed 12 years ago by Nigel

Attachment: promptSchema.2.patch added

Expert mode for "Use existing", confirmation prompting, check for newer schema

comment:2 Changed 12 years ago by Nigel

Resolution: fixed
Status: newclosed

(In [14673]) Prompt for database schema upgrades. Closes #4013. Doesn't check for multiple clients connected to the backend yet.

comment:3 Changed 12 years ago by stev391

My backend refused to automatically update the database schema. It defaulted to no when queried to continue when stating that a database backup should be performed. It did default to yes to the first question. It took my ssh session as a none interactive console and would not let me input values. I had to run an X session without the frontend to run mythtv-setup to confirm that I wanted it to update.

This is what it stated (with or without interactive console) without any verbose commands: 2007-10-14 20:39:55.511 Using runtime prefix = /usr 2007-10-14 20:39:55.537 New DB connection, total: 1 2007-10-14 20:39:55.541 Connected to database 'mythconverg' at host: localhost 2007-10-14 20:39:55.543 Current Schema Version: 1199

Warning: MythTV wants to upgrade your database schema, from 1199 to 1200.

Shall I upgrade this database? [yes] [console is not interactive, using default 'yes']

A database backup might be a good idea Are you sure you want to upgrade? [no] [console is not interactive, using default 'no'] 2007-10-14 20:39:55.549 Couldn't upgrade database to new schema 2007-10-14 20:40:02.36 /root/bin/mythmon: mythbackend not running!!! 2007-10-14 20:50:01.202 /root/bin/mythmon: mythbackend not running!!!

comment:4 Changed 12 years ago by Nigel

(In [14685]) For non-interactive shells, always default to upgrading the database schema (i.e. original behaviour). I wish there was a simple way to detect interactive shells that works for ssh, but the amount of code isn't worth it. See #4013

Note: See TracTickets for help on using tickets.