582 |
582 |
columns.append([at, 'smallint REFERENCES {role_table} (id)'])
|
583 |
583 |
comments[at] = u'fonction « %s »' % name
|
584 |
584 |
|
585 |
|
self.columns = ([name for name, _type in self.olap_feeder.columns]
|
586 |
|
+ [name for name, _type in columns])
|
|
585 |
self.columns = ([name for name, _type in self.olap_feeder.columns] + [
|
|
586 |
name for name, _type in columns])
|
587 |
587 |
self.columns.remove('geolocation_base')
|
588 |
588 |
|
589 |
589 |
self.create_table('{formdata_table}', columns, inherits='{generic_formdata_table}',
|
... | ... | |
594 |
594 |
# Creat index for JSON fields
|
595 |
595 |
if self.has_jsonb:
|
596 |
596 |
for field in fields:
|
597 |
|
if field.varname and not '-' in field.varname:
|
|
597 |
if field.varname and '-' not in field.varname:
|
598 |
598 |
self.create_formdata_json_index(field.varname)
|
599 |
599 |
|
600 |
600 |
# PostgreSQL does not propagate foreign key constraints to child tables
|
... | ... | |
775 |
775 |
if generic_evolutions:
|
776 |
776 |
self.ex('INSERT INTO {generic_evolution_table} (%s) VALUES %s' % (
|
777 |
777 |
', '.join(['formdata_id', 'generic_status_id', 'time', 'date', 'hour_id']),
|
778 |
|
', '.join(['%s'] * len(generic_evolutions))), vars=generic_evolutions)
|
|
778 |
', '.join(['%s'] * len(generic_evolutions))), vars=generic_evolutions)
|
779 |
779 |
|
780 |
780 |
# insert evolutions
|
781 |
781 |
evolutions = []
|
... | ... | |
784 |
784 |
row[0] = formdata_id
|
785 |
785 |
evolutions.append(tuple(row))
|
786 |
786 |
if len(evolutions) == 500:
|
787 |
|
self.ex('INSERT INTO {evolution_table} (%s) VALUES %s' % (
|
|
787 |
self.ex('INSERT INTO {evolution_table} (%s) VALUES %s' % (
|
788 |
788 |
', '.join(['formdata_id', 'status_id', 'time', 'date', 'hour_id']),
|
789 |
789 |
', '.join(['%s'] * len(evolutions))), vars=evolutions)
|
790 |
|
evolutions = []
|
|
790 |
evolutions = []
|
791 |
791 |
if evolutions:
|
792 |
792 |
self.ex('INSERT INTO {evolution_table} (%s) VALUES %s' % (
|
793 |
793 |
', '.join(['formdata_id', 'status_id', 'time', 'date', 'hour_id']),
|
794 |
|
-
|