Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions alyx/misc/management/commands/dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,20 @@ def _anonymize(path):
'subjects.genotypetest',
)

# These sentinel rows are recreated automatically the first time the schema is migrated
# (see data.models.default_data_format/default_dataset_type), so including them in the
# dump causes a duplicate-name conflict when the fixture is loaded into a freshly
# migrated database.
UNKNOWN_DEFAULTS = ('data.dataformat', 'data.datasettype')

counter = defaultdict(int)
data_out = []
for item in data:
# Max number of items per model.
if item['model'] in LIMIT_MODELS and counter[item['model']] >= N_MAX:
continue
if item['model'] in UNKNOWN_DEFAULTS and item['fields'].get('name') == 'unknown':
continue
pk = item['pk']
# Remove user password and email.
if item['model'] == 'auth.user':
Expand Down
Binary file modified data/all_dumped_anon.json.gz
Binary file not shown.
Loading