LinHES Forums
http://forum.linhes.org/

Merging In Tables in the SQL Database?
http://forum.linhes.org/viewtopic.php?f=6&t=15857
Page 1 of 1

Author:  seano [ Thu Jul 12, 2007 3:28 pm ]
Post subject:  Merging In Tables in the SQL Database?

Problem: I did a clean install so the database no longer knows what episodes / shows I've already seen.

I still have my old sql file. Can someone tell me (or point me to) how to merge in the "shows already seen" table into my current database?

I have no idea how to use mysql. I have no idea what the name of the table that stores the already seen shows is called.

I can't revert to the old database because pretty much everything has changed in this new install (new tuners, new channels, and a buncha shows already recorded now.)

Thanks!

SeanO

Author:  alien [ Fri Jul 13, 2007 1:40 am ]
Post subject: 

I'm sure there is a more elegant way to do this, but there's always the brute force method...

1. Record (or maybe just watch is enough... not sure) with a title that you can search for in the DB. I.e. Something with words in the title that are not likely to appear too often in the DB.

2. Back up the DB. Back up the Backup of the DB (there is a good chance this will take a few tries).

3. Edit the .sql backup file. Search for the title you just recorded. It might appear a few times, but eventually you should find a table that is obviously "already seen" shows.

4. Edit the old .sql backup with the shows you've seen. Search for the table name. Delete everything except this table. Save it to a new file.

5. Edit the new backup. Delete the table, then insert the table from the file you just created.

6. Restore the backup. If you see any unusual errors, go back to step 2.

When your only tool is a hammer.... everything starts to look like a nail.

Author:  tjc [ Fri Jul 13, 2007 6:13 pm ]
Post subject: 

The table is "oldrecorded".

Use sed or grep to extract the records from your old backup and pipe the results into mysql. This can all be done in one shell command pipeline. Searching for a posting by me that mentions "gzip" or "bzip2" along with "sed" and "mysql" should turn up more detailed directions. They may even be in an obvious place like the backup/restore sticky thread. Since I don't remember this exact request coming up before you'll need to change the table name in the example, but that's easy.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/