[mythtv-users] Import/export shows from database question

Kristo Kriechbaum klk+myth at robotics.caltech.edu
Mon Aug 18 11:42:58 EDT 2003


Hi,

I had myth 0.10 working great, except for the fact that I was getting
low on hard drive space.  I got a new big drive, and did a clean
install of 0.11 on it.  The only problem is I have a bunch of shows on
the old one I want to keep around.

I tried fiddling around with the database, but I can't get things out
of the old one, and into the new one.  Here's basically what I did-

-dumped the db from the 0.10 version, call this dumped010.sql

-looking through the dumped db, it seemed to me that all I needed to
import was the 'recorded' and 'recordedmarkup' tables.  Is this a
correct assumption?

-I tried to import the dumped010.sql, but then realized that it
wouldn't work because I should have upgraded it to the 0.11 structure
first.

-At this point, I was tired of constantly switching the drives around
and rebooting, so I made a new scratch db on the new drive, call it
testmth.

-I did something like 'mysql -u root < dumped010.sql' This got my old
db in.

-Then 'mysql -u root < 0.10-to-0.11.sql' to update the "old" stuff to
be in the new db format.  Before doing this though, I edited
0.10-to-0.11.sql and changed the line 'USE mythconverg' to 'USE
testmth', so it would update the correct one.

-Then I did 'mysqldump testmth recorded recordedmarkup > goodimport.sql'
This got only the tables I wanted.

-Finally, I edited goodimport.sql and got rid of the sections where it
created the tables, since they were already there (because 0.11 is
working fine).  I just left all the lines like "INSERT INTO ..."

-I tried to import this into the db, and it won't go.  The problem is
that table structure for the fresh 0.11 install and the upgraded 0.10
install didn't quite match.  All of the same fields are there, just in
a slightly different order.

The fresh 0.11 install:
CREATE TABLE recorded (
  chanid int(10) unsigned NOT NULL default '0',
  starttime timestamp(14) NOT NULL,
  endtime timestamp(14) NOT NULL,
  title varchar(128) default NULL,
  subtitle varchar(128) default NULL,
  description text,
  category varchar(64) default NULL,
  hostname varchar(255) default NULL,
  bookmark varchar(128) default NULL,
  editing int(10) unsigned NOT NULL default '0',
  cutlist text,
  autoexpire int(11) NOT NULL default '0',
  PRIMARY KEY  (chanid,starttime),
  KEY endtime (endtime)
) TYPE=MyISAM;

my upgraded 0.10:
CREATE TABLE recorded (
  chanid int(10) unsigned NOT NULL default '0',
  starttime timestamp(14) NOT NULL,
  endtime timestamp(14) NOT NULL,
  title varchar(128) default NULL,
  subtitle varchar(128) default NULL,
  description text,
  hostname varchar(255) default NULL,
  bookmark varchar(128) default NULL,
  editing int(10) unsigned NOT NULL default '0',
  cutlist text,
  category varchar(64) default NULL,
  autoexpire int(11) NOT NULL default '0',
  PRIMARY KEY  (chanid,starttime),
  KEY endtime (endtime)
) TYPE=MyISAM;

I know that I'll need to change the hostname field (because it did
change), but that's a simple one liner.  Is there a similarly easy way
to change the order of the fields in this table to make them match up?

Sorry for this inordinately long message.  I tried searching the
archives for this problem and didn't come across it.

Thanks for any help,
Kristo


More information about the mythtv-users mailing list