[IMP] convert varchar to text in database

bzr revid: nel@silver-20081210140856-easnep218it0bnqu
This commit is contained in:
Najlaa 2008-12-10 15:08:56 +01:00
parent f500ecff15
commit 02663d9780
1 changed files with 6 additions and 0 deletions

View File

@ -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))