# 'bundle exec rake db:migrate' taking a long time due to calendar migration

**URL:** <https://meta.discourse.org/t/bundle-exec-rake-db-migrate-taking-a-long-time-due-to-calendar-migration/287434>\
**Category:** Self-hosting\
**Created:** [December 4, 2023, 1:58pm UTC](https://meta.discourse.org/t/bundle-exec-rake-db-migrate-taking-a-long-time-due-to-calendar-migration/287434 "2023-12-04T13:58:11Z")\
**Posts on this page:** 1\
**Showing post:** 34

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [December 5, 2023, 4:00pm UTC](https://meta.discourse.org/t/bundle-exec-rake-db-migrate-taking-a-long-time-due-to-calendar-migration/287434/34 "2023-12-05T16:00:20Z")

</div>

```plaintext
discourse=# select count(*) from calendar_events where created_at > NOW()-INTERVAL '200 days';                                                                         
  count                                                                                                                                                                
----------                                                                                                                                                             
 25970368                                                                                                                                                              
(1 row)                                                                                                                                                                
                                                                                                                                                                       
discourse=# select count(*) from calendar_events where created_at > NOW()-INTERVAL '100 days';                                                                         
  count                                                                                                                                                                
----------                                                                                                                                                             
 14377700                                                                                                                                                              
(1 row)                                                                                                                                                                
                                                                                                                                                                       
discourse=# select count(*) from calendar_events where created_at > NOW()-INTERVAL '50 days';                                                                          
  count                                                                                                                                                                
---------                                                                                                                                                              
 7207939                                                                                                                                                               
(1 row)                                                                                                                                                                
                                                                                                                                                                       
discourse=# select count(*) from calendar_events where created_at > NOW()-INTERVAL '5 days';                                                                           
 count                                                                                                                                                                 
--------                                                                                                                                                               
 589938                                  
(1 row)                                                                                                 

```

```plaintext
iscourse=# select count(*) from calendar_events where created_at < NOW()-INTERVAL '200 days';
  count   
----------
 43754016
(1 row)

```

---

_[View the full topic](https://meta.discourse.org/t/bundle-exec-rake-db-migrate-taking-a-long-time-due-to-calendar-migration/287434)._
