Skip to content

Commit

Permalink
TO REMOVE: undo SQL adaptation to pullrequest env
Browse files Browse the repository at this point in the history
  • Loading branch information
tconte-pass committed Feb 7, 2025
1 parent 15d41ea commit 852dcbe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import sqlalchemy as sa
import time_machine

from pcapi import settings
from pcapi.core.bookings import factories as bookings_factory
from pcapi.core.finance import conf as finance_conf
from pcapi.core.finance import models as finance_models
Expand Down Expand Up @@ -284,15 +283,9 @@ def create_short_email_beneficiaries() -> dict[str, User]:
lastName=fake.last_name(),
needsToFillCulturalSurvey=False,
)
if settings.IS_DEV:
db.session.execute(sa.text("ALTER TABLE booking DISABLE TRIGGER booking_update;"))
else:
db.session.execute(sa.text("SELECT disable_booking_update_trigger();"))
db.session.execute(sa.text("ALTER TABLE booking DISABLE TRIGGER booking_update;"))
bookings_factory.BookingFactory(user=beneficiary_and_exunderage)
if settings.IS_DEV:
db.session.execute(sa.text("ALTER TABLE booking ENABLE TRIGGER booking_update;"))
else:
db.session.execute(sa.text("SELECT enable_booking_update_trigger();"))
db.session.execute(sa.text("ALTER TABLE booking ENABLE TRIGGER booking_update;"))

fraud_factories.BeneficiaryFraudCheckFactory(user=beneficiary_and_exunderage)
users_factories.DepositGrantFactory(user=beneficiary_and_exunderage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -880,9 +880,5 @@ def create_national_programs() -> list[educational_models.NationalProgram]:


def reset_offer_id_seq() -> None:
if settings.IS_DEV:
db.session.execute(sa.text("ALTER SEQUENCE collective_offer_id_seq RESTART WITH 1"))
db.session.execute(sa.text("ALTER SEQUENCE collective_offer_template_id_seq RESTART WITH 1"))
else:
db.session.execute(sa.text("SELECT reset_sequence('collective_offer_id_seq')"))
db.session.execute(sa.text("SELECT reset_sequence('collective_offer_template_id_seq')"))
db.session.execute(sa.text("ALTER SEQUENCE collective_offer_id_seq RESTART WITH 1"))
db.session.execute(sa.text("ALTER SEQUENCE collective_offer_template_id_seq RESTART WITH 1"))

0 comments on commit 852dcbe

Please sign in to comment.