Closed Kappuccino111 closed 5 months ago
When executing the script, we can check if the database exist or not. Only if the database is newly created we need to add the initialization data.
Deleting the database is usually not required and should not be part of the script. This can be required for testing or if the database model significantly changed.
Replication: To replicate the issue , first remove the existing database through rm -rf db.sqlite3. Run the script. Stop the script. Re-running the script produces this error :
Fix : After the fixture gets loaded into the database for the first time , we add a condition to check whether the data has already been loaded through a custom script since the
sensordata_resourcetype
has a unique constraint.@jonas-rem were you deleting db.sqlite3 to run this script again ??