Skip to content

Commit

Permalink
fix pg numeric conversion regression
Browse files Browse the repository at this point in the history
  • Loading branch information
eloyfelix committed Feb 3, 2022
1 parent 0d815db commit 06e2de0
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions cbl_migrator/conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ def ora2pg(col):
Used in ChEMBL dump generation
"""
if isinstance(col.type, Numeric):
if not col.type.precision or col.type.precision > 4:
col.type = col.type.adapt(BigInteger)
else:
if col.type.precision <= 2:
col.type = col.type.adapt(SmallInteger)
elif 2 < col.type.precision <= 4:
col.type = col.type.adapt(Integer)
if col.type.scale == 0:
if not col.type.precision or col.type.precision > 4:
col.type = col.type.adapt(BigInteger)
else:
if col.type.precision <= 2:
col.type = col.type.adapt(SmallInteger)
elif 2 < col.type.precision <= 4:
col.type = col.type.adapt(Integer)
return col


Expand Down

0 comments on commit 06e2de0

Please sign in to comment.