Concert date to datetime
bzr revid: fabian@tinyerp.com-20080918123116-r5999hs4i7fe0qw4
This commit is contained in:
parent
43daa23bad
commit
deec1863f6
|
@ -1441,6 +1441,12 @@ class orm(orm_template):
|
||||||
cr.execute("UPDATE \"%s\" SET \"%s\"=temp_change_size::VARCHAR(%d)" % (self._table, k, f.size))
|
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.execute("ALTER TABLE \"%s\" DROP COLUMN temp_change_size" % (self._table,))
|
||||||
cr.commit()
|
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))
|
||||||
|
cr.execute("UPDATE \"%s\" SET \"%s\"=temp_change_type::TIMESTAMP" % (self._table, k))
|
||||||
|
cr.execute("ALTER TABLE \"%s\" DROP COLUMN temp_change_type" % (self._table,))
|
||||||
|
cr.commit()
|
||||||
# if the field is required and hasn't got a NOT NULL constraint
|
# if the field is required and hasn't got a NOT NULL constraint
|
||||||
if f.required and f_pg_notnull == 0:
|
if f.required and f_pg_notnull == 0:
|
||||||
# set the field to the default value if any
|
# set the field to the default value if any
|
||||||
|
|
Loading…
Reference in New Issue