# Database SP-7 Error: Table doesn't exist!

**URL:** <https://speciforum.org/t/database-sp-7-error-table-doesnt-exist/1944>\
**Category:** Get Help\
**Created:** [September 4, 2024, 5:52pm UTC](https://speciforum.org/t/database-sp-7-error-table-doesnt-exist/1944 "2024-09-04T17:52:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Heryk](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/heryk/32/5730_2.png) [@Heryk](https://speciforum.org/u/Heryk)\
**Post date:** [September 4, 2024, 5:52pm UTC](https://speciforum.org/t/database-sp-7-error-table-doesnt-exist/1944/1 "2024-09-04T17:52:12Z")

</div>

Hello,  
I had issues with my DB ([Important: Specify Database Backups Can Fail - #2 by Heryk](https://speciforum.org/t/important-specify-database-backups-can-fail/927/2)) so I decided to restore a previous version. However now I’m getting a new error message when authenticating in SP-7:

```auto
{"exception": "ProgrammingError", "message": "1146", "data": "Table 'mycology.spuserpolicy' doesn't exist",...

```

I thought it was may be linked to a sp-7 upgrading issue so as indicated in another ticket ([Upgrading to Specify 7.7+: HTTP 500 error - Documentation / Configuration & Installation - Specify Community Forum (specifysoftware.org)](https://speciforum.org/t/upgrading-to-specify-7-7-http-500-error/733)), I used my DB root credentials as my master credentials when starting the containers (Sp-7). But I’m still having the same issue error message. The missing tables are not added.

I also tried this sql command and starting over but it did not change anything:

```auto
delete from django_migrations where app = 'permissions';

```

Any suggestions would be very appreciated.  
Thanks

---

<div class="post-metadata">

**Author:** ![Heryk](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/heryk/32/5730_2.png) [@Heryk](https://speciforum.org/u/Heryk)\
**Post date:** [September 4, 2024, 8:37pm UTC](https://speciforum.org/t/database-sp-7-error-table-doesnt-exist/1944/2 "2024-09-04T20:37:24Z")

</div>

PS. I created a new local dummy DB on SP-6. Then I made a backup of it and restored on my server DB. However, I’m still stuck with the same SP-7 error message…

```auto
{"exception": "ProgrammingError", "message": "1146", "data": "Table 'mycology.spuserpolicy' doesn't exist", 

```

BTW, the table spuserpolicy is missing in both my local and server DB.

If I understand it correctly, SP 7.9.6.2 is supposed to add certain new tables to the SP-6 created database… but it doesn’t seem to be working here despite using my DB root credentials as my master credentials when starting the containerized Sp-7.

---

<div class="post-metadata">

**Author:** ![Heryk](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/heryk/32/5730_2.png) [@Heryk](https://speciforum.org/u/Heryk)\
**Post date:** [September 4, 2024, 10:53pm UTC](https://speciforum.org/t/database-sp-7-error-table-doesnt-exist/1944/3 "2024-09-04T22:53:39Z")

</div>

I read this post describing a similar “Table doesn’t exist” error message… [Data Export for Webportal / Specify 7.7 Upgrade - Get Help - Specify Community Forum (specifysoftware.org)](https://speciforum.org/t/data-export-for-webportal-specify-7-7-upgrade/1062/9)

So I manually modify the DB `AppVersion` to `6.8.01` in the spversion table and redeployed SP-7. Unfortunately, it not solve my problem (same error message) so I put it back to `6.8.03`. BTW, my `SchemaVersion` is `2.9`.

---

<div class="post-metadata">

**Author:** ![Heryk](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/heryk/32/5730_2.png) [@Heryk](https://speciforum.org/u/Heryk)\
**Post date:** [September 5, 2024, 1:12pm UTC](https://speciforum.org/t/database-sp-7-error-table-doesnt-exist/1944/4 "2024-09-05T13:12:54Z")

</div>

I finally got it to work… I’m not sure what fixed it. I had to restart from scratch! I deleted the mycology DB and the SP-7 docker instance (including the volumes) on my web server. Then I created a new backup file of mycology DB located on my computer and restored it on the server DB. And finally, I recreated all the SP-7 containers on the web server. There was something blocking me from deploying with SP-7. Probably something to do with an SP-7 (7.9) update not able to add its necessary new tables to my SP-6 created DB. BTW. I temporally used my DB root credentials in my container config for initial startup of the container. I will now put back the DB master credentials in my SP-7 config. Cheers

---

<div class="post-metadata">

**Author:** ![mcruz](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/mcruz/32/451_2.png) [@mcruz](https://speciforum.org/u/mcruz)\
**Post date:** [September 11, 2024, 3:19pm UTC](https://speciforum.org/t/database-sp-7-error-table-doesnt-exist/1944/5 "2024-09-11T15:19:08Z")

</div>

You run the container the first time. Then you have to restart it a second time for it to create that table.

---

<div class="post-metadata">

**Author:** ![mcruz](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/mcruz/32/451_2.png) [@mcruz](https://speciforum.org/u/mcruz)\
**Post date:** [September 18, 2024, 9:37pm UTC](https://speciforum.org/t/database-sp-7-error-table-doesnt-exist/1944/6 "2024-09-18T21:37:31Z")

</div>

> [@Upgrading to Specify 7.7+: HTTP 500 error](https://speciforum.org/t/upgrading-to-specify-7-7-http-500-error/733):
>
> If you are updating to Specify 7.7 or newer, Specify is supposed to create new tables related to the security and accounts features. If you encounter the following error upon updating to 7.9.3, you should follow the same instructions: "exception": "ProgrammingError", "message": "1146", "data": "Table 'db\_name.uniquenessrule' doesn't exist" In your docker-compose.yml file, you should use your root user credentials instead of the master user credentials for the first run in Specify 7. You just…
