souramoo / commentoplusplus

Commento with out of the box patches and updates to add useful features and fixes. Also with one-click deploy to Heroku so you can get up and running fast.
MIT License
389 stars 62 forks source link

Export and reimport deletes names of anonymous commenters #74

Open deployn opened 2 years ago

deployn commented 2 years ago

Hi,

when I export the database.json and reimport it later, all the guest commentators are not assigned as a guest commentator anymore. Strangely enough, all of them are assigned the name of the very first commenter. But in the JSON file, I still see the correct names.

Kind regards

StevenMassaro commented 2 years ago

I also experienced this and opted instead to just backup and restore the database itself. With Heroku announcing the end of their free tier, I imagine more people will run into this.

I could be wrong about this, but my source database instance was also modified by this action, causing duplicate comments to show up. It is possible that I accidentally imported the data back into the source instance - to be honest I wasn't paying close attention, especially since the website I'm using this on isn't terribly important.

In any case, I found that the duplicate comments were associated with a new commenter and used the following hastily written sql statements to remove most of the duplicate comments:

update "comments" 
set deleted = true,
deleterhex = '',
deletiondate = now()
where commenterhex = ''

update "comments" c
set deleted = true,
deleterhex = '',
deletiondate = now()
where c.parenthex in (select cc.commenthex from "comments" cc where cc.deleted = true and cc.commenthex = c.parenthex)