def setup_sms_providers_with_history(db_session, setup_sms_providers): db_session.query(ProviderDetailsHistory).delete() providers_history = [ ProviderDetailsHistory.from_original(provider) for provider in setup_sms_providers ] db_session.add_all(providers_history) return setup_sms_providers
def _update_provider_details_without_commit(provider_details): """ Doesn't commit, for when you need to control the database transaction manually """ provider_details.version += 1 provider_details.updated_at = datetime.utcnow() history = ProviderDetailsHistory.from_original(provider_details) db.session.add(provider_details) db.session.add(history)
def dao_update_provider_details(provider_details): provider_details.version += 1 provider_details.updated_at = datetime.utcnow() history = ProviderDetailsHistory.from_original(provider_details) db.session.add(provider_details) db.session.add(history)