Skip to content

Commit

Permalink
Fix get all fields in creation
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Sep 6, 2012
1 parent 30d74bb commit 42a2994
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions ckanext/datastore/db.py
Expand Up @@ -250,7 +250,7 @@ def create_indexes(context, data_dict):

sql_index_string = 'create {unique} index on "{res_id}" using {method}({fields})'
sql_index_strings = []
field_ids = _pluck('id', data_dict.get('fields', []))
field_ids = _pluck('id', _get_fields(context, data_dict))

if indexes != None:
_drop_indexes(context, data_dict, False)
Expand Down Expand Up @@ -368,8 +368,6 @@ def alter_table(context, data_dict):
field['type'])
context['connection'].execute(sql)

return new_fields + supplied_fields


def insert_data(context, data_dict):
'''insert all data from records'''
Expand Down Expand Up @@ -642,8 +640,7 @@ def create(context, data_dict):
if not result:
create_table(context, data_dict)
else:
all_fields = alter_table(context, data_dict)
data_dict['fields'] = all_fields
alter_table(context, data_dict)
insert_data(context, data_dict)
create_indexes(context, data_dict)
trans.commit()
Expand Down

0 comments on commit 42a2994

Please sign in to comment.