models: Migration of Message.pub_date to date_sent, part 2.

Fixes #1727.

With the server down, apply migrations 0245 and 0246. 0246 will remove
the pub_date column, so it's essential that the previous migrations
ran correctly to copy data before running this.
This commit is contained in:
Mateusz Mandera
2019-08-28 02:43:19 +02:00
committed by Tim Abbott
parent f198475281
commit dbe508bb91
37 changed files with 206 additions and 129 deletions

View File

@@ -59,7 +59,7 @@ def sent_time_in_epoch_seconds(user_message: Optional[UserMessage]) -> Optional[
return None
# We have USE_TZ = True, so our datetime objects are timezone-aware.
# Return the epoch seconds in UTC.
return calendar.timegm(user_message.message.pub_date.utctimetuple())
return calendar.timegm(user_message.message.date_sent.utctimetuple())
def get_bot_types(user_profile: UserProfile) -> List[Dict[str, object]]:
bot_types = []