Bacula-users

[Bacula-users] SQLite 2 to SQLite 3 migration

2009-08-21 13:43:06
Subject: [Bacula-users] SQLite 2 to SQLite 3 migration
From: John Goerzen <jgoerzen AT complete DOT org>
To: bacula-users AT lists.sourceforge DOT net
Date: Fri, 21 Aug 2009 12:15:37 -0500
Hi folks,

Over at Debian, we received a bug report at
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=542810 regarding the
migration from sqlite2 to sqlite3.  We are doing the process implied
by the make_catalog_backup command; namely:

    sqlite "$DB" .dump | sqlite3 "$DB.sqlite3"

Our reporter noticed that:

  This will fail on older installations of bacula-director-sqlite,
  because the database may contain table schemas like the following:

  CREATE TABLE Filename (
    FilenameId INTEGER UNSIGNED AUTOINCREMENT,
    Name TEXT DEFAULT "",
    PRIMARY KEY(FilenameId) 
    );

  Problem is, sqlite3 does not understand AUTOINCREMENT in this way,
  this keyword is only allowed alongside a PRIMARY KEY statement. Besides, every
  integer primary key will autoincrement without this keyword, as per 
  http://sqlite.org/faq.html#q1

I mentioned this in a bug report at
http://bugs.bacula.org/view.php?id=1351 , and apparently managed to
confuse the SQLite autoincrement thing a bit.  But Kern states that:

  Converting from SQLite2 to SQLite3 is easy. You simply "export" or
  dump the SQLite2 database to an ASCII file (example in the default
  Bacula catalog backup script) then import it using SQLite3 (see
  comments at the bottom of the Bacula catalog backup script)

It seems very strongly that this is not the case due to Sqlite3 not
understanding AUTOINCREMENT.

What is the proper procedure to convert from Sqlite2 to Sqlite3,
considering this?  I have tried googling, and it hasn't turned up
anything.

Ideas?

-- John

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

<Prev in Thread] Current Thread [Next in Thread>
  • [Bacula-users] SQLite 2 to SQLite 3 migration, John Goerzen <=