import psycopg2
import time
+from daklib.dak_exceptions import DBUpdateError
################################################################################
import psycopg2
import time
+from daklib.dak_exceptions import DBUpdateError
################################################################################
try:
c = self.db.cursor()
- try:
- # This might not exist on a fresh install, so don't fail
- # needlessly
+ # The reason we try and check to see if it exists is that
+ # psycopg2 might leave the cursor invalid if the drop fails
+ c.execute("SELECT proname from pg_catalog.pg_proc WHERE proname = 'versioncmp'")
+ rows = c.fetchall()
+ if rows:
c.execute("DROP FUNCTION versioncmp(text, text);")
- except:
- pass
+ else:
+ print "function already does not exist"
+
c.execute("UPDATE config SET value = '3' WHERE name = 'db_revision'")
self.db.commit()
import psycopg2
import time
+from daklib.dak_exceptions import DBUpdateError
################################################################################
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
+ * Create the following groups in postgres: ftpmaster ftpteam ftptrainee
* 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'.
o Copy all templates from the "templates" directory to to the directory
specified in Dir::Templates, and adapt them to your distribution.
-o Create an 'ftpmaster' group in postgres.