Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while running the ./django_startup.sh script #35

Closed
Kappuccino111 opened this issue Jun 4, 2024 · 1 comment · Fixed by #36
Closed

Error while running the ./django_startup.sh script #35

Kappuccino111 opened this issue Jun 4, 2024 · 1 comment · Fixed by #36
Labels
bug Something isn't working

Comments

@Kappuccino111
Copy link
Collaborator

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 :

sqlite3.IntegrityError: UNIQUE constraint failed: sensordata_resourcetype.object_id, sensordata_resourcetype.resource_id

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 ??

@Kappuccino111 Kappuccino111 added the bug Something isn't working label Jun 4, 2024
@jonas-rem
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants