]> git.decadent.org.uk Git - dak.git/commitdiff
dak update-db: fixes to make it work on a fresh install
authorRaphael Hertzog <hertzog@debian.org>
Sun, 1 Mar 2009 00:28:10 +0000 (01:28 +0100)
committerRaphael Hertzog <hertzog@debian.org>
Sun, 1 Mar 2009 21:32:24 +0000 (22:32 +0100)
Also update docs/README.first to advise to run dak update-db
before dak init-db.

Signed-off-by: Raphael Hertzog <hertzog@debian.org>
dak/dakdb/update3.py
dak/dakdb/update5.py
docs/README.first

index eef7d4c6a003ade245a2afc2bc7a49054f64ba40..ccd463c4bef3c4866f63ade9f1c9839be0e40a7f 100755 (executable)
@@ -31,7 +31,12 @@ def do_update(self):
 
     try:
         c = self.db.cursor()
-        c.execute("DROP FUNCTION versioncmp(text, text);")
+        try:
+            # This might not exist on a fresh install, so don't fail
+            # needlessly
+            c.execute("DROP FUNCTION versioncmp(text, text);")
+        except:
+            pass
         c.execute("UPDATE config SET value = '3' WHERE name = 'db_revision'")
 
         self.db.commit()
index 1d820de43adf3a501928fd8df2be952a65ff8192..c89813e65a2bb8018c9527160e1a2982ae4ff2de 100755 (executable)
@@ -36,7 +36,6 @@ def do_update(self):
     print "Fixing bin_assoc_by_arch view"
     try:
         c = self.db.cursor()
-        c.execute("DROP VIEW bin_assoc_by_arch")
 
         c.execute("""CREATE OR REPLACE VIEW bin_assoc_by_arch AS
         SELECT ba.suite, ba.bin, a.id AS arch
index 9b7aa9cb221ce5d7ffe200199db6545a13068da5..237d63cf6b54f0929a5c86bacab1556a31591c8e 100644 (file)
@@ -114,6 +114,7 @@ o If you have an existing archive:
      which are needed for this.  After changing all occurences of "projectb"
      to the name of your database (as defined in DB::Name) you can run:
          psql <DB::Name> < init_pool.sql
+   * Run 'dak update-db' to upgrade the database schema.
    * Run 'dak init-db': it will populate your database with the values from
      dak.conf and apt.conf.
    * Run 'psql <DB::Name> < add_constraints.sql'.