From 02663d978045949ba95de5bed40eea043cd7ee6d Mon Sep 17 00:00:00 2001 From: Najlaa Date: Wed, 10 Dec 2008 15:08:56 +0100 Subject: [PATCH] [IMP] convert varchar to text in database bzr revid: nel@silver-20081210140856-easnep218it0bnqu --- bin/osv/orm.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 165bc86e126..06fb00c42ee 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1530,6 +1530,12 @@ class orm(orm_template): cr.execute("UPDATE \"%s\" SET \"%s\"=temp_change_size::VARCHAR(%d)" % (self._table, k, f.size)) cr.execute("ALTER TABLE \"%s\" DROP COLUMN temp_change_size" % (self._table,)) cr.commit() + if f_pg_type == 'varchar' and f._type == 'text': + cr.execute("ALTER TABLE \"%s\" RENAME COLUMN \"%s\" TO temp_change_type" % (self._table, k)) + cr.execute("ALTER TABLE \"%s\" ADD COLUMN \"%s\" text " % (self._table, k)) + cr.execute("UPDATE \"%s\" SET \"%s\"=temp_change_type" % (self._table, k)) + cr.execute("ALTER TABLE \"%s\" DROP COLUMN temp_change_type" % (self._table,)) + cr.commit() if f_pg_type == 'date' and f._type == 'datetime': cr.execute("ALTER TABLE \"%s\" RENAME COLUMN \"%s\" TO temp_change_type" % (self._table, k)) cr.execute("ALTER TABLE \"%s\" ADD COLUMN \"%s\" TIMESTAMP " % (self._table, k))