Skip to content

Commit

Permalink
Merge branch 'main' into schedule-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsuta authored Nov 28, 2024
2 parents 392ee4f + a2fda52 commit 66cf4d3
Show file tree
Hide file tree
Showing 93 changed files with 3,268 additions and 1,149 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,9 @@ def upgrade():
op.drop_table('marketplace_application')
op.add_column('receipt_item', sa.Column('fk_id', residue.UUID(), nullable=True))
op.add_column('receipt_item', sa.Column('fk_model', sa.Unicode(), server_default='', nullable=False))
op.create_index(op.f('ix_receipt_item_fk_id'), 'receipt_item', ['fk_id'], unique=False)


def downgrade():
op.drop_index(op.f('ix_receipt_item_fk_id'), table_name='receipt_item')
op.drop_column('receipt_item', 'fk_model')
op.drop_column('receipt_item', 'fk_id')
op.create_table('marketplace_application',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""Add checkbox to opt into art show won bids email
Revision ID: 6f2db268b938
Revises: df998079da32
Create Date: 2024-11-11 15:46:11.969424
"""


# revision identifiers, used by Alembic.
revision = '6f2db268b938'
down_revision = 'df998079da32'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa



try:
is_sqlite = op.get_context().dialect.name == 'sqlite'
except Exception:
is_sqlite = False

if is_sqlite:
op.get_context().connection.execute('PRAGMA foreign_keys=ON;')
utcnow_server_default = "(datetime('now', 'utc'))"
else:
utcnow_server_default = "timezone('utc', current_timestamp)"

def sqlite_column_reflect_listener(inspector, table, column_info):
"""Adds parenthesis around SQLite datetime defaults for utcnow."""
if column_info['default'] == "datetime('now', 'utc')":
column_info['default'] = utcnow_server_default

sqlite_reflect_kwargs = {
'listeners': [('column_reflect', sqlite_column_reflect_listener)]
}

# ===========================================================================
# HOWTO: Handle alter statements in SQLite
#
# def upgrade():
# if is_sqlite:
# with op.batch_alter_table('table_name', reflect_kwargs=sqlite_reflect_kwargs) as batch_op:
# batch_op.alter_column('column_name', type_=sa.Unicode(), server_default='', nullable=False)
# else:
# op.alter_column('table_name', 'column_name', type_=sa.Unicode(), server_default='', nullable=False)
#
# ===========================================================================


def upgrade():
op.add_column('art_show_bidder', sa.Column('email_won_bids', sa.Boolean(), server_default='False', nullable=False))


def downgrade():
op.drop_column('art_show_bidder', 'email_won_bids')
73 changes: 73 additions & 0 deletions alembic/versions/8224640bc6cc_add_badge_pickup_groups.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
"""Add badge pickup groups
Revision ID: 8224640bc6cc
Revises: 6f2db268b938
Create Date: 2024-11-13 04:55:18.730126
"""


# revision identifiers, used by Alembic.
revision = '8224640bc6cc'
down_revision = '6f2db268b938'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
import residue


try:
is_sqlite = op.get_context().dialect.name == 'sqlite'
except Exception:
is_sqlite = False

if is_sqlite:
op.get_context().connection.execute('PRAGMA foreign_keys=ON;')
utcnow_server_default = "(datetime('now', 'utc'))"
else:
utcnow_server_default = "timezone('utc', current_timestamp)"

def sqlite_column_reflect_listener(inspector, table, column_info):
"""Adds parenthesis around SQLite datetime defaults for utcnow."""
if column_info['default'] == "datetime('now', 'utc')":
column_info['default'] = utcnow_server_default

sqlite_reflect_kwargs = {
'listeners': [('column_reflect', sqlite_column_reflect_listener)]
}

# ===========================================================================
# HOWTO: Handle alter statements in SQLite
#
# def upgrade():
# if is_sqlite:
# with op.batch_alter_table('table_name', reflect_kwargs=sqlite_reflect_kwargs) as batch_op:
# batch_op.alter_column('column_name', type_=sa.Unicode(), server_default='', nullable=False)
# else:
# op.alter_column('table_name', 'column_name', type_=sa.Unicode(), server_default='', nullable=False)
#
# ===========================================================================


def upgrade():
op.create_table('badge_pickup_group',
sa.Column('id', residue.UUID(), nullable=False),
sa.Column('created', residue.UTCDateTime(), server_default=sa.text("timezone('utc', current_timestamp)"), nullable=False),
sa.Column('last_updated', residue.UTCDateTime(), server_default=sa.text("timezone('utc', current_timestamp)"), nullable=False),
sa.Column('external_id', postgresql.JSONB(astext_type=sa.Text()), server_default='{}', nullable=False),
sa.Column('last_synced', postgresql.JSONB(astext_type=sa.Text()), server_default='{}', nullable=False),
sa.Column('public_id', residue.UUID(), nullable=True),
sa.Column('account_id', sa.Unicode(), server_default='', nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_badge_pickup_group'))
)
op.add_column('attendee', sa.Column('badge_pickup_group_id', residue.UUID(), nullable=True))
op.create_foreign_key(op.f('fk_attendee_badge_pickup_group_id_badge_pickup_group'), 'attendee', 'badge_pickup_group', ['badge_pickup_group_id'], ['id'], ondelete='SET NULL')


def downgrade():
op.drop_constraint(op.f('fk_attendee_badge_pickup_group_id_badge_pickup_group'), 'attendee', type_='foreignkey')
op.drop_column('attendee', 'badge_pickup_group_id')
op.drop_table('badge_pickup_group')
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
"""Add list of refund txns to receipt txns
Revision ID: 9c23621e5e12
Revises: f01a2ad10d79
Create Date: 2024-11-06 17:59:12.695586
"""


# revision identifiers, used by Alembic.
revision = '9c23621e5e12'
down_revision = 'f01a2ad10d79'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa
import residue


try:
is_sqlite = op.get_context().dialect.name == 'sqlite'
except Exception:
is_sqlite = False

if is_sqlite:
op.get_context().connection.execute('PRAGMA foreign_keys=ON;')
utcnow_server_default = "(datetime('now', 'utc'))"
else:
utcnow_server_default = "timezone('utc', current_timestamp)"

def sqlite_column_reflect_listener(inspector, table, column_info):
"""Adds parenthesis around SQLite datetime defaults for utcnow."""
if column_info['default'] == "datetime('now', 'utc')":
column_info['default'] = utcnow_server_default

sqlite_reflect_kwargs = {
'listeners': [('column_reflect', sqlite_column_reflect_listener)]
}

# ===========================================================================
# HOWTO: Handle alter statements in SQLite
#
# def upgrade():
# if is_sqlite:
# with op.batch_alter_table('table_name', reflect_kwargs=sqlite_reflect_kwargs) as batch_op:
# batch_op.alter_column('column_name', type_=sa.Unicode(), server_default='', nullable=False)
# else:
# op.alter_column('table_name', 'column_name', type_=sa.Unicode(), server_default='', nullable=False)
#
# ===========================================================================


def upgrade():
#op.create_index(op.f('ix_receipt_item_fk_id'), 'receipt_item', ['fk_id'], unique=False)
op.add_column('receipt_transaction', sa.Column('refunded_txn_id', residue.UUID(), nullable=True))
op.create_foreign_key(op.f('fk_receipt_transaction_refunded_txn_id_receipt_transaction'), 'receipt_transaction', 'receipt_transaction', ['refunded_txn_id'], ['id'], ondelete='SET NULL')


def downgrade():
op.drop_constraint(op.f('fk_receipt_transaction_refunded_txn_id_receipt_transaction'), 'receipt_transaction', type_='foreignkey')
op.drop_column('receipt_transaction', 'refunded_txn_id')
op.drop_index(op.f('ix_receipt_item_fk_id'), table_name='receipt_item')
59 changes: 59 additions & 0 deletions alembic/versions/df998079da32_add_admin_notes_to_receipt_items.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""Add admin notes to receipt items
Revision ID: df998079da32
Revises: 9c23621e5e12
Create Date: 2024-11-11 00:27:15.421118
"""


# revision identifiers, used by Alembic.
revision = 'df998079da32'
down_revision = '9c23621e5e12'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa



try:
is_sqlite = op.get_context().dialect.name == 'sqlite'
except Exception:
is_sqlite = False

if is_sqlite:
op.get_context().connection.execute('PRAGMA foreign_keys=ON;')
utcnow_server_default = "(datetime('now', 'utc'))"
else:
utcnow_server_default = "timezone('utc', current_timestamp)"

def sqlite_column_reflect_listener(inspector, table, column_info):
"""Adds parenthesis around SQLite datetime defaults for utcnow."""
if column_info['default'] == "datetime('now', 'utc')":
column_info['default'] = utcnow_server_default

sqlite_reflect_kwargs = {
'listeners': [('column_reflect', sqlite_column_reflect_listener)]
}

# ===========================================================================
# HOWTO: Handle alter statements in SQLite
#
# def upgrade():
# if is_sqlite:
# with op.batch_alter_table('table_name', reflect_kwargs=sqlite_reflect_kwargs) as batch_op:
# batch_op.alter_column('column_name', type_=sa.Unicode(), server_default='', nullable=False)
# else:
# op.alter_column('table_name', 'column_name', type_=sa.Unicode(), server_default='', nullable=False)
#
# ===========================================================================


def upgrade():
op.add_column('receipt_item', sa.Column('admin_notes', sa.Unicode(), server_default='', nullable=False))


def downgrade():
op.drop_column('receipt_item', 'admin_notes')
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
"""Add escalation tickets for attendee check-in
Revision ID: ecb1983d7dfd
Revises: 8224640bc6cc
Create Date: 2024-11-15 22:59:42.134196
"""


# revision identifiers, used by Alembic.
revision = 'ecb1983d7dfd'
down_revision = '8224640bc6cc'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from sqlalchemy.schema import Sequence, CreateSequence, DropSequence
import residue


try:
is_sqlite = op.get_context().dialect.name == 'sqlite'
except Exception:
is_sqlite = False

if is_sqlite:
op.get_context().connection.execute('PRAGMA foreign_keys=ON;')
utcnow_server_default = "(datetime('now', 'utc'))"
else:
utcnow_server_default = "timezone('utc', current_timestamp)"

def sqlite_column_reflect_listener(inspector, table, column_info):
"""Adds parenthesis around SQLite datetime defaults for utcnow."""
if column_info['default'] == "datetime('now', 'utc')":
column_info['default'] = utcnow_server_default

sqlite_reflect_kwargs = {
'listeners': [('column_reflect', sqlite_column_reflect_listener)]
}

# ===========================================================================
# HOWTO: Handle alter statements in SQLite
#
# def upgrade():
# if is_sqlite:
# with op.batch_alter_table('table_name', reflect_kwargs=sqlite_reflect_kwargs) as batch_op:
# batch_op.alter_column('column_name', type_=sa.Unicode(), server_default='', nullable=False)
# else:
# op.alter_column('table_name', 'column_name', type_=sa.Unicode(), server_default='', nullable=False)
#
# ===========================================================================


def upgrade():
op.execute(CreateSequence(Sequence('escalation_ticket_ticket_id_seq')))
op.create_table('escalation_ticket',
sa.Column('id', residue.UUID(), nullable=False),
sa.Column('created', residue.UTCDateTime(), server_default=sa.text("timezone('utc', current_timestamp)"), nullable=False),
sa.Column('last_updated', residue.UTCDateTime(), server_default=sa.text("timezone('utc', current_timestamp)"), nullable=False),
sa.Column('external_id', postgresql.JSONB(astext_type=sa.Text()), server_default='{}', nullable=False),
sa.Column('last_synced', postgresql.JSONB(astext_type=sa.Text()), server_default='{}', nullable=False),
sa.Column('ticket_id', sa.Integer(), server_default=sa.text("nextval('escalation_ticket_ticket_id_seq')"), nullable=False),
sa.Column('description', sa.Unicode(), server_default='', nullable=False),
sa.Column('admin_notes', sa.Unicode(), server_default='', nullable=False),
sa.Column('resolved', residue.UTCDateTime(), nullable=True),
sa.PrimaryKeyConstraint('id', name=op.f('pk_escalation_ticket')),
sa.UniqueConstraint('ticket_id', name=op.f('uq_escalation_ticket_ticket_id'))
)
op.create_table('attendee_escalation_ticket',
sa.Column('attendee_id', residue.UUID(), nullable=False),
sa.Column('escalation_ticket_id', residue.UUID(), nullable=False),
sa.ForeignKeyConstraint(['attendee_id'], ['attendee.id'], name=op.f('fk_attendee_escalation_ticket_attendee_id_attendee')),
sa.ForeignKeyConstraint(['escalation_ticket_id'], ['escalation_ticket.id'], name=op.f('fk_attendee_escalation_ticket_escalation_ticket_id_escalation_ticket')),
sa.UniqueConstraint('attendee_id', 'escalation_ticket_id', name=op.f('uq_attendee_escalation_ticket_attendee_id'))
)
op.create_index('ix_attendee_escalation_ticket_attendee_id', 'attendee_escalation_ticket', ['attendee_id'], unique=False)
op.create_index('ix_attendee_escalation_ticket_escalation_ticket_id', 'attendee_escalation_ticket', ['escalation_ticket_id'], unique=False)


def downgrade():
op.drop_index('ix_attendee_escalation_ticket_escalation_ticket_id', table_name='attendee_escalation_ticket')
op.drop_index('ix_attendee_escalation_ticket_attendee_id', table_name='attendee_escalation_ticket')
op.drop_table('attendee_escalation_ticket')
op.drop_table('escalation_ticket')
op.execute(DropSequence(Sequence('escalation_ticket_ticket_id_seq')))
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,10 @@ def sqlite_column_reflect_listener(inspector, table, column_info):


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('indie_game_image', sa.Column('is_header', sa.Boolean(), server_default='False', nullable=False))
op.add_column('indie_game_image', sa.Column('is_thumbnail', sa.Boolean(), server_default='False', nullable=False))
#op.create_unique_constraint(op.f('uq_lottery_application_attendee_id'), 'lottery_application', ['attendee_id'])
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(op.f('uq_lottery_application_attendee_id'), 'lottery_application', type_='unique')
op.drop_column('indie_game_image', 'is_thumbnail')
op.drop_column('indie_game_image', 'is_header')
# ### end Alembic commands ###
Loading

0 comments on commit 66cf4d3

Please sign in to comment.