diff -urN form_store.orig/form_store.install form_store/form_store.install --- form_store.orig/form_store.install 2007-03-21 22:32:06.000000000 +0100 +++ form_store/form_store.install 2008-07-03 22:16:34.000000000 +0200 @@ -16,7 +16,13 @@ // TODO: Add indices. case 'pgsql': - drupal_set_message("Sorry, PostgreSQL is not yet support."); + db_query("CREATE TABLE {form_store_forms} ( + fid SERIAL, + form_id varchar(255) UNIQUE NOT NULL default '', + description varchar(255), + preview TEXT, + PRIMARY KEY (fid) + )"); break; case 'mysql': @@ -34,7 +40,10 @@ } $forms = form_store_core_forms_list(); foreach ($forms as $form_id => $description) { - db_query("INSERT INTO {form_store_forms} (form_id, description, preview) VALUES ('%s', '%s', '')", $form_id, $description); + $next_id = db_next_id('{form_store_forms}_fid'); + db_query("INSERT INTO {form_store_forms} (fid, form_id, description, preview) VALUES (%d, '%s', '%s', '')", array( + $next_id, $form_id, $description + )); } } @@ -44,7 +53,11 @@ */ function form_store_uninstall() { db_query("DROP TABLE {form_store_forms}"); - db_query("DELETE FROM {sequences} WHERE name = '{form_store_forms}_id'"); + switch ($GLOBALS['db_type']) { + case 'mysql': + case 'mysqli': + db_query("DELETE FROM {sequences} WHERE name = '{form_store_forms}_fid'"); + } } /** @@ -58,6 +71,9 @@ switch ($GLOBALS['db_type']) { case 'pgsql': + // Add a field to keep the serialized form array for previews + $ret[] = update_sql("ALTER TABLE {form_store_forms} ADD preview TEXT"); + $ret[] = update_sql("ALTER TABLE {form_store_forms} ALTER COLUMN description TYPE varchar(255) ;"); break; case 'mysql': @@ -78,6 +94,7 @@ switch ($GLOBALS['db_type']) { case 'pgsql': + // Nothing to do here.. break; case 'mysql': diff -urN form_store.orig/form_store.module form_store/form_store.module --- form_store.orig/form_store.module 2007-03-21 22:32:06.000000000 +0100 +++ form_store/form_store.module 2008-07-03 22:09:34.000000000 +0200 @@ -281,7 +281,8 @@ function form_store_add($form_id, $form) { $preview = serialize($form); $description = isset($form['#description']) ? $form['#description'] : ''; - db_query("INSERT INTO {form_store_forms} (form_id, description, preview) VALUES ('%s', '%s', '%s')", $form_id, $description, $preview); + $next_id = db_next_id('{form_store_forms}_fid'); + db_query("INSERT INTO {form_store_forms} (fid, form_id, description, preview) VALUES (%d, '%s', '%s', '%s')", $next_id, $form_id, $description, $preview); } /**