more files

This commit is contained in:
Kenneth Kehl
2023-07-17 07:45:54 -07:00
parent 4d090ed9ef
commit de4812efee
11 changed files with 90 additions and 48 deletions
@@ -8,6 +8,8 @@ Create Date: 2017-07-12 13:35:45.636618
from datetime import datetime
from alembic import op
import sqlalchemy as sa
from sqlalchemy import text
from app.dao.date_util import get_month_start_and_end_date_in_utc
down_revision = '0111_drop_old_service_flags'
@@ -26,9 +28,13 @@ def upgrade():
for x in res:
start_date, end_date = get_month_start_and_end_date_in_utc(
datetime(int(x.year), datetime.strptime(x.month, '%B').month, 1))
conn.execute("update monthly_billing set start_date = '{}', end_date = '{}' where id = '{}'".format(start_date,
end_date,
x.id))
input_params = {
"start_date": start_date,
"end_date": end_date,
"x_id": x.id
}
conn.execute(text("update monthly_billing set start_date = :start_date, end_date = :end_date where id = :x_id"),
input_params)
op.alter_column('monthly_billing', 'start_date', nullable=False)
op.alter_column('monthly_billing', 'end_date', nullable=False)
op.create_index(op.f('uix_monthly_billing'), 'monthly_billing', ['service_id', 'start_date', 'notification_type'],