old_contents: # -*- coding: utf-8 -*-
  """
      flaskbb.utils.database
      ~~~~~~~~~~~~~~~~~~~~~~
  
      Some database helpers such as a CRUD mixin.
  
      :copyright: (c) 2015 by the FlaskBB Team.
      :license: BSD, see LICENSE for more details.
  """
  import pytz
  
  from flaskbb.extensions import db
  
  
  class CRUDMixin(object):
      def __repr__(self):
          return "<{}>".format(self.__class__.__name__)
  
      def save(self):
          """Saves the object to the database."""
          db.session.add(self)
          db.session.commit()
          return self
  
      def delete(self):
          """Delete the object from the database."""
          db.session.delete(self)
          db.session.commit()
          return self
  
  
  class UTCDateTime(db.TypeDecorator):
      impl = db.DateTime
  
      def process_bind_param(self, value, dialect):
          """Way into the database."""
          if value is not None:
              # store naive datetime for sqlite
              if dialect.name == "sqlite":
                  return value.replace(tzinfo=None)
  
              return value.astimezone(pytz.UTC)
  
      def process_result_value(self, value, dialect):
          """Way out of the database."""
          # convert naive datetime to non naive datetime
          if dialect.name == "sqlite" and value is not None:
              return value.replace(tzinfo=pytz.UTC)
  
          # other dialects are already non-naive
          return value
  
new_contents: # -*- coding: utf-8 -*-
  """
      flaskbb.utils.database
      ~~~~~~~~~~~~~~~~~~~~~~
  
      Some database helpers such as a CRUD mixin.
  
      :copyright: (c) 2015 by the FlaskBB Team.
      :license: BSD, see LICENSE for more details.
  """
  import pytz
  
  from flaskbb.extensions import db
  
  
  class CRUDMixin(object):
      def __repr__(self):
          return "<{}>".format(self.__class__.__name__)
  
      def save(self):
          """Saves the object to the database."""
          db.session.add(self)
          db.session.commit()
          return self
  
      def delete(self):
          """Delete the object from the database."""
          db.session.delete(self)
          db.session.commit()
          return self
  
  
  class UTCDateTime(db.TypeDecorator):
      impl = db.DateTime
  
      def process_bind_param(self, value, dialect):
          """Way into the database."""
          if value is not None:
              # store naive datetime for sqlite and mysql
              if dialect.name in ("sqlite", "mysql"):
                  return value.replace(tzinfo=None)
  
              return value.astimezone(pytz.UTC)
  
      def process_result_value(self, value, dialect):
          """Way out of the database."""
          # convert naive datetime to non naive datetime
          if dialect.name in ("sqlite", "mysql") and value is not None:
              return value.replace(tzinfo=pytz.UTC)
  
          # other dialects are already non-naive
          return value
  
subject: Use the naive datetime format for MySQL as well