Closed dongbohu closed 4 years ago
The new id
field should be added into Experiment's serializer class too:
https://github.com/greenelab/py3-adage-backend/blob/74de24d82631d7e176b61fff367dd9ad6024e067/adage/analyze/serializers.py#L21
Fixed in PR #55.
Right now the primary key in
Experiment
model isacecession
field:The frontend prefers using an auto-incremented
id
field as the primary key (like most of the other models). This can be done by changing the line above into:But this will affect
analyze_experiment
andananlyze_sample_experiments
tables, both of which are populated by a management command. When both tables already have records, the migration is very awkward because the newid
field is not only the primary key inanalyze_experiment
table but also the foreign key inanalyze_sample_experiments
table.The best solution is to:
analyze/migration/
;psql> create database <new_db_name>
orshell> createdb <new_db_name>
;manage.py makemigration
andmanage.py migrate
to initialize all tables;