Skip to content

Remove unique product code restriction in api_tariffs model

Administrator requested to merge delete-unique-product-code-contraint into master

With this change, we can update the tariff's DB table without errors.

python manage.py importcsv --mappings='' --model='api.tariffs' --delimiter=',' api/fixtures/tariffs.csv

Before:

------------ Tariffs ------------
CSV header unmatched ignored cols = 
Using column mappings: 1=product_code 2=mm_tariff 3=additional_bond 4=additional_bond2 5=promotion
Mapping from first, header, row of CSV file
(...)
Database Error: duplicate key value violates unique constraint "api_tariffs_product_code_key"
DETAIL:  Key (product_code)=(XXXXX) already exists.
, Number: 0
Imported 0 rows to Tariffs

With this MR:

------------ Tariffs ------------
CSV header unmatched ignored cols = 
Using column mappings: 1=product_code 2=mm_tariff 3=additional_bond 4=additional_bond2 5=promotion
Mapping from first, header, row of CSV file
Imported 15 rows to Tariffs
Edited by Administrator

Merge request reports