<p>I finally got to the bottom of what happened. I deleted a user about a month ago and after 30 days (the soft delete period) Craft deleted all related pages that the user had originally created. Thankfully, I was able to restore those pages by re-creating records for each in the entries table with a different authorid.</p>
<p>I ran this script on a backup of the database to find the entries for that author.</p>
<pre><code>select es.uri, c.title, et.*, e.* from entries e 
inner join entrytypes et on e.typeid=et.id
inner join elements el on e.id = el.id
inner join elements_sites es on es.elementid = el.id
left outer join content c on c.elementid = el.id
where e.authorid=DELETED_USER_ID
and el.revisionid is null
</code></pre>
<p>And then created insert scripts for the entries table for each one I needed to restore. The elements and other data was still in the database so I just had to re-create the entries records.</p>
<pre><code>insert into entries (id, sectionid, parentid, typeid, authorid, postDate, deletedWithEntryType, dateCreated, dateUpdated, uid)
VALUES(ORIGINAL_ENTRY_ID, ORIGINAL_SECTION_ID, ORIGINAL_PARENT_ID, ORIGINAL_TYPE_ID, NEW_AUTHOR_USER_ID, ORIGINAL_POST_DATE, 0, ORIGINAL_DATE_CREATED, ORIGINAL_DATE_UDPATE, ORIGINAL_UID)
</code></pre>

CC BY-SA 4.0
2021-04-02T18:29:34.390Z
Thanks for this info. We had the same thing happen. There is a bug report here (already fixed for the next release) https://github.com/craftcms/cms/issues/7751
Alex Kendrick
CC BY-SA 4.0
2020-08-20T16:35:04.013Z
2020-08-20T16:35:04.013Z
Austin
<p>I've setup a Craft 3 site for a client and we are seeing the strangest thing where pages are just disappearing. Best we can tell no-one has deleted the entry, but we get a 404 on the front-end and it is not showing up on the back-end, even under &quot;Trashed&quot;. What is weird is that when I re-create the page I can't use the same slug so it seems like it is still in the database. I've tried querying the database and I can see rows in the elements_sites table with that uri, but I don't know enough about the data scheme to tell where the disconnect is or tables to look at to determine which is the &quot;live&quot; version. One other note that may be related is several pages disappeared that were all sub-pages to a parent page (but the parent page is still there on the site)</p>
<p>Here is a query I ran for one of the pages that is missing:</p>
<p><a href="https://i.sstatic.net/NL1XY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/NL1XY.png" alt="Craft DB Query" /></a></p>
<p>Any suggestions for how to figure out what is happening or a query to run to determine which pages are live and where the disconnect may be for those pages?</p>

CC BY-SA 4.0
2020-08-19T15:32:05.817Z
Whenever I've experienced anything similar, it's because someone deleted a user and managed to completely ignore/misread the warning box that comes up asking if you also want to delete that user's content...
James Smith
CC BY-SA 4.0
2020-08-19T15:34:56.983Z
Thanks @JamesSmith. Is there any way to restore that content by re-assigning it to another user?
Austin
CC BY-SA 4.0
2020-08-19T19:08:56.613Z
Yes, that's one of the options that comes up during the use deletion process.
James Smith
CC BY-SA 4.0
2020-08-19T19:48:36.613Z
@JamesSmith What about if that option wasn't chosen during the deletion process. It looks like the data is still in the database. Is there a way to re-assign it in the database after the user was deleted?
Austin
<craft3><mysql>
Craft CMS Entries Disappearing
# Craft CMS Entries Disappearing

(Asked by: username_0 on 2020-08-19)

I've setup a Craft 3 site for a client and we are seeing the strangest thing where pages are just disappearing. Best we can tell no-one has deleted the entry, but we get a 404 on the front-end and it is not showing up on the back-end, even under "Trashed". What is weird is that when I re-create the page I can't use the same slug so it seems like it is still in the database. I've tried querying the database and I can see rows in the elements\_sites table with that uri, but I don't know enough about the data scheme to tell where the disconnect is or tables to look at to determine which is the "live" version. One other note that may be related is several pages disappeared that were all sub-pages to a parent page (but the parent page is still there on the site)

Here is a query I ran for one of the pages that is missing:

[![Craft DB Query](https://i.sstatic.net/NL1XY.png)](https://i.sstatic.net/NL1XY.png)

Any suggestions for how to figure out what is happening or a query to run to determine which pages are live and where the disconnect may be for those pages?

**Tags:** craft3, mysql
> **Comments:**
> **username_1**: Whenever I've experienced anything similar, it's because someone deleted a user and managed to completely ignore/misread the warning box that comes up asking if you also want to delete that user's content...  
> **username_0**: Thanks @JamesSmith. Is there any way to restore that content by re-assigning it to another user?  
> **username_1**: Yes, that's one of the options that comes up during the use deletion process.  
> **username_0**: @JamesSmith What about if that option wasn't chosen during the deletion process. It looks like the data is still in the database. Is there a way to re-assign it in the database after the user was deleted?  

---

## 1 answers

### Answer by username_0 on 2020-08-20. Score: 3

I finally got to the bottom of what happened. I deleted a user about a month ago and after 30 days (the soft delete period) Craft deleted all related pages that the user had originally created. Thankfully, I was able to restore those pages by re-creating records for each in the entries table with a different authorid.
I ran this script on a backup of the database to find the entries for that author.
select es.uri, c.title, et.*, e.* from entries e 
inner join entrytypes et on e.typeid=et.id
inner join elements el on e.id = el.id
inner join elements_sites es on es.elementid = el.id
left outer join content c on c.elementid = el.id
where e.authorid=DELETED_USER_ID
and el.revisionid is null

And then created insert scripts for the entries table for each one I needed to restore. The elements and other data was still in the database so I just had to re-create the entries records.
insert into entries (id, sectionid, parentid, typeid, authorid, postDate, deletedWithEntryType, dateCreated, dateUpdated, uid)
VALUES(ORIGINAL_ENTRY_ID, ORIGINAL_SECTION_ID, ORIGINAL_PARENT_ID, ORIGINAL_TYPE_ID, NEW_AUTHOR_USER_ID, ORIGINAL_POST_DATE, 0, ORIGINAL_DATE_CREATED, ORIGINAL_DATE_UDPATE, ORIGINAL_UID)

> **Comments:**
> **username_2**: Thanks for this info. We had the same thing happen. There is a bug report here (already fixed for the next release) https://github.com/craftcms/cms/issues/7751  

---

