OLD | NEW |
1 #This file is part of Tryton. The COPYRIGHT file at the top level of | 1 #This file is part of Tryton. The COPYRIGHT file at the top level of |
2 #this repository contains the full copyright notices and license terms. | 2 #this repository contains the full copyright notices and license terms. |
3 | 3 |
4 from trytond.backend.table import TableHandlerInterface | 4 from trytond.backend.table import TableHandlerInterface |
5 import logging | 5 import logging |
6 | 6 |
7 | 7 |
8 class TableHandler(TableHandlerInterface): | 8 class TableHandler(TableHandlerInterface): |
9 | 9 |
10 def __init__(self, cursor, model, module_name=None, history=False): | 10 def __init__(self, cursor, model, module_name=None, history=False): |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 if size is None: | 390 if size is None: |
391 size = self._columns[column_name]['size'] | 391 size = self._columns[column_name]['size'] |
392 if default is None: | 392 if default is None: |
393 default = self._columns[column_name]['default'] | 393 default = self._columns[column_name]['default'] |
394 res = '' | 394 res = '' |
395 if typname == 'varchar': | 395 if typname == 'varchar': |
396 if int(size) > 255: | 396 if int(size) > 255: |
397 size = 255 | 397 size = 255 |
398 res = 'varchar(%s)' % str(size) | 398 res = 'varchar(%s)' % str(size) |
399 elif typname == 'decimal': | 399 elif typname == 'decimal': |
400 res = 'decimal(16, 8)' | 400 res = 'decimal(65, 30)' |
| 401 elif typname == 'double': |
| 402 res = 'double(255, 30)' |
401 else: | 403 else: |
402 res = typname | 404 res = typname |
403 # Default value for timestamp doesn't work | 405 # Default value for timestamp doesn't work |
404 if typname == 'timestamp' and not nullable: | 406 if typname == 'timestamp' and not nullable: |
405 nullable = True | 407 nullable = True |
406 if nullable: | 408 if nullable: |
407 res += ' NULL' | 409 res += ' NULL' |
408 else: | 410 else: |
409 res += ' NOT NULL' | 411 res += ' NOT NULL' |
410 if default is not None: | 412 if default is not None: |
411 res += ' DEFAULT %s' % default | 413 res += ' DEFAULT %s' % default |
412 return res | 414 return res |
OLD | NEW |