From 80b9e2ff78ef04acf5861c3f9e8a02c632e0dd5f Mon Sep 17 00:00:00 2001 From: Loic d'Anterroches Date: Thu, 20 Nov 2008 10:05:40 +0100 Subject: [PATCH] Fixed issue 59, field idf_idf_conf.vdesc is a varchar(250) instead of text (MySQL). --- src/IDF/Conf.php | 3 +- src/IDF/Migrations/5DescToText.php | 47 ++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 src/IDF/Migrations/5DescToText.php diff --git a/src/IDF/Conf.php b/src/IDF/Conf.php index ea5b4a4..57fbca2 100644 --- a/src/IDF/Conf.php +++ b/src/IDF/Conf.php @@ -62,9 +62,8 @@ class IDF_Conf extends Pluf_Model ), 'vdesc' => array( - 'type' => 'Pluf_DB_Field_Varchar', + 'type' => 'Pluf_DB_Field_Text', 'blank' => false, - 'size' => 250, 'verbose' => __('value'), ), ); diff --git a/src/IDF/Migrations/5DescToText.php b/src/IDF/Migrations/5DescToText.php new file mode 100644 index 0000000..77c8e7b --- /dev/null +++ b/src/IDF/Migrations/5DescToText.php @@ -0,0 +1,47 @@ +getSqlTable(); + $sql = array(); + $sql['PostgreSQL'] = 'ALTER TABLE '.$table.' ALTER vdesc TYPE text'; + $sql['MySQL'] = 'ALTER TABLE '.$table.' MODIFY vdesc TYPE text'; + $db = Pluf::db(); + $engine = Pluf::f('db_engine'); + if (!isset($sql[$engine])) { + echo 'Skip SQLite upgrade as not needed.'."\n"; + return; + } + $db->execute($sql[$engine]); +} + +function IDF_Migrations_5DescToText_down($params=null) +{ + // lazy, do not care + return; +} \ No newline at end of file