mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
remove many to many relationship between entries and feeds
This commit is contained in:
@@ -10,6 +10,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.commafeed.backend.dao.FeedDAO;
|
||||
import com.commafeed.backend.dao.FeedEntryContentDAO;
|
||||
import com.commafeed.backend.dao.FeedEntryDAO;
|
||||
import com.commafeed.backend.dao.FeedSubscriptionDAO;
|
||||
import com.commafeed.backend.model.Feed;
|
||||
@@ -28,6 +29,9 @@ public class DatabaseCleaner {
|
||||
|
||||
@Inject
|
||||
FeedSubscriptionDAO feedSubscriptionDAO;
|
||||
|
||||
@Inject
|
||||
FeedEntryContentDAO feedEntryContentDAO;
|
||||
|
||||
@Inject
|
||||
ApplicationSettingsService applicationSettingsService;
|
||||
@@ -45,16 +49,16 @@ public class DatabaseCleaner {
|
||||
return total;
|
||||
}
|
||||
|
||||
public long cleanEntriesWithoutFeeds() {
|
||||
public long cleanContentsWithoutEntries() {
|
||||
|
||||
long total = 0;
|
||||
int deleted = -1;
|
||||
do {
|
||||
deleted = feedEntryDAO.deleteWithoutFeeds(100);
|
||||
deleted = feedEntryContentDAO.deleteWithoutEntries(10);
|
||||
total += deleted;
|
||||
log.info("removed {} entries without feeds", total);
|
||||
log.info("removed {} feeds without subscriptions", total);
|
||||
} while (deleted != 0);
|
||||
log.info("cleanup done: {} entries without feeds deleted", total);
|
||||
log.info("cleanup done: {} feeds without subscriptions deleted", total);
|
||||
return total;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user