remove many to many relationship between entries and feeds

This commit is contained in:
Athou
2013-07-24 15:39:20 +02:00
parent fdacac74cc
commit c2b53b117c
18 changed files with 350 additions and 251 deletions

View File

@@ -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;
}