Skip to content

Commit c982c65

Browse files
committed
Merge branch 'main' into oidc
2 parents c1e4021 + fb3d1ba commit c982c65

File tree

262 files changed

+6566
-4808
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

262 files changed

+6566
-4808
lines changed

.pythonstartup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
initialize_db()
1212

1313
# Make it easier to do session stuff at the command line
14-
session = Session().session
14+
session = Session()
1515

1616
if c.DEV_BOX:
1717
admin = session.query(AdminAccount).filter(

alembic/env.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
import logging
44
import sys
5+
import sqlmodel
56
from logging.config import fileConfig
67
from alembic import context
78

89
import uber
9-
from residue import CoerceUTF8, UTCDateTime, UUID
1010
from uber.migration import version_locations_option
1111
from uber.models import Choice, MultiChoice, Session
1212

@@ -25,28 +25,21 @@
2525
logger = logging.getLogger('alembic.env')
2626

2727
# Add the model's MetaData object here for "autogenerate" support.
28-
target_metadata = Session.BaseClass.metadata
28+
target_metadata = uber.models.MagModel.metadata
2929

3030

3131
def include_object(object, name, type_, reflected, compare_to):
3232
"""Exclude alembic's own version tables from alembic's consideration."""
33-
return not name.startswith('alembic_version')
33+
return not name or not name.startswith('alembic_version')
3434

3535

3636
def render_item(type_, obj, autogen_context):
3737
"""Apply custom rendering for selected items."""
3838
if type_ == 'type':
3939
if isinstance(obj, Choice):
4040
return 'sa.Integer()'
41-
elif isinstance(obj, UTCDateTime):
42-
autogen_context.imports.add('import residue')
43-
return 'residue.UTCDateTime()'
44-
elif isinstance(obj, (CoerceUTF8, MultiChoice)):
41+
if isinstance(obj, sqlmodel.sql.sqltypes.AutoString):
4542
return 'sa.Unicode()'
46-
elif isinstance(obj, UUID):
47-
autogen_context.imports.add('import residue')
48-
return 'residue.UUID()'
49-
5043
# Default rendering for other objects
5144
return False
5245

alembic/versions/05009fad3d3c_convert_approvedemail_to_automatedemail.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from sqlalchemy.schema import ForeignKey
2121
from sqlalchemy.sql import table
2222
from sqlalchemy.types import String
23-
import residue
2423

2524

2625
try:
@@ -57,20 +56,20 @@ def sqlite_column_reflect_listener(inspector, table, column_info):
5756

5857
approved_email_table = table(
5958
'approved_email',
60-
sa.Column('id', residue.UUID()),
59+
sa.Column('id', sa.Uuid(as_uuid=False)),
6160
sa.Column('ident', sa.Unicode()),
6261
)
6362

6463
email_table = table(
6564
'email',
66-
sa.Column('id', residue.UUID()),
65+
sa.Column('id', sa.Uuid(as_uuid=False)),
6766
sa.Column('ident', sa.Unicode()),
68-
sa.Column('automated_email_id', residue.UUID(), ForeignKey('automated_email.id')),
67+
sa.Column('automated_email_id', sa.Uuid(as_uuid=False), ForeignKey('automated_email.id')),
6968
)
7069

7170
automated_email_table = table(
7271
'automated_email',
73-
sa.Column('id', residue.UUID()),
72+
sa.Column('id', sa.Uuid(as_uuid=False)),
7473
sa.Column('ident', sa.Unicode()),
7574
sa.Column('approved', sa.Boolean()),
7675
)
@@ -114,8 +113,8 @@ def upgrade():
114113
batch_op.add_column(sa.Column('unapproved_count', sa.Integer(), server_default='0', nullable=False))
115114
batch_op.add_column(sa.Column('allow_post_con', sa.Boolean(), server_default='False', nullable=False))
116115
batch_op.add_column(sa.Column('allow_at_the_con', sa.Boolean(), server_default='False', nullable=False))
117-
batch_op.add_column(sa.Column('active_after', residue.UTCDateTime(), nullable=True))
118-
batch_op.add_column(sa.Column('active_before', residue.UTCDateTime(), nullable=True))
116+
batch_op.add_column(sa.Column('active_after', sa.DateTime(timezone=True), nullable=True))
117+
batch_op.add_column(sa.Column('active_before', sa.DateTime(timezone=True), nullable=True))
119118
if 'pk_approved_email' in existing_primarykeys:
120119
batch_op.drop_constraint('pk_approved_email', type_='primary')
121120
if 'approved_email_pkey' in existing_primarykeys:
@@ -138,8 +137,8 @@ def upgrade():
138137
op.add_column('automated_email', sa.Column('unapproved_count', sa.Integer(), server_default='0', nullable=False))
139138
op.add_column('automated_email', sa.Column('allow_post_con', sa.Boolean(), server_default='False', nullable=False))
140139
op.add_column('automated_email', sa.Column('allow_at_the_con', sa.Boolean(), server_default='False', nullable=False))
141-
op.add_column('automated_email', sa.Column('active_after', residue.UTCDateTime(), nullable=True))
142-
op.add_column('automated_email', sa.Column('active_before', residue.UTCDateTime(), nullable=True))
140+
op.add_column('automated_email', sa.Column('active_after', sa.DateTime(timezone=True), nullable=True))
141+
op.add_column('automated_email', sa.Column('active_before', sa.DateTime(timezone=True), nullable=True))
143142
if 'pk_approved_email' in existing_primarykeys:
144143
op.drop_constraint('pk_approved_email', 'automated_email', type_='primary')
145144
if 'approved_email_pkey' in existing_primarykeys:
@@ -154,14 +153,14 @@ def upgrade():
154153
batch_op.alter_column('dest', new_column_name='to')
155154
batch_op.add_column(sa.Column('bcc', sa.Unicode(), server_default='', nullable=False))
156155
batch_op.add_column(sa.Column('cc', sa.Unicode(), server_default='', nullable=False))
157-
batch_op.add_column(sa.Column('automated_email_id', residue.UUID(), nullable=True))
156+
batch_op.add_column(sa.Column('automated_email_id', sa.Uuid(as_uuid=False), nullable=True))
158157
batch_op.add_column(sa.Column('sender', sa.Unicode(), server_default='', nullable=False))
159158
batch_op.create_foreign_key(op.f('fk_email_automated_email_id_automated_email'), 'automated_email', ['automated_email_id'], ['id'], ondelete='set null')
160159
else:
161160
op.alter_column('email', 'dest', new_column_name='to')
162161
op.add_column('email', sa.Column('bcc', sa.Unicode(), server_default='', nullable=False))
163162
op.add_column('email', sa.Column('cc', sa.Unicode(), server_default='', nullable=False))
164-
op.add_column('email', sa.Column('automated_email_id', residue.UUID(), nullable=True))
163+
op.add_column('email', sa.Column('automated_email_id', sa.Uuid(as_uuid=False), nullable=True))
165164
op.add_column('email', sa.Column('sender', sa.Unicode(), server_default='', nullable=False))
166165
op.create_foreign_key(op.f('fk_email_automated_email_id_automated_email'), 'email', 'automated_email', ['automated_email_id'], ['id'], ondelete='set null')
167166

alembic/versions/116e5aad3a5c_adds_attendee_hotel_pin_unique_.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
depends_on = None
1515

1616
from alembic import op
17-
import residue
1817
import sqlalchemy as sa
1918
from sqlalchemy import func
2019
from sqlalchemy.sql import and_, table, select
@@ -55,19 +54,19 @@ def sqlite_column_reflect_listener(inspector, table, column_info):
5554

5655
attendee_table = table(
5756
'attendee',
58-
sa.Column('id', residue.UUID()),
57+
sa.Column('id', sa.Uuid(as_uuid=False)),
5958
sa.Column('hotel_pin', sa.Unicode()),
6059
)
6160

6261

6362
def upgrade():
6463
if not is_sqlite:
6564
connection = op.get_bind()
66-
attendees = connection.execute(select([
65+
attendees = connection.execute(select(
6766
attendee_table.c.hotel_pin,
6867
func.count(attendee_table.c.id),
6968
func.array_agg(attendee_table.c.id),
70-
]).where(and_(
69+
).where(and_(
7170
attendee_table.c.hotel_pin != None,
7271
attendee_table.c.hotel_pin != '',
7372
)).group_by(

alembic/versions/181ceea98b62_add_art_show_sales_tables.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
from alembic import op
1717
import sqlalchemy as sa
18-
import residue
1918

2019

2120
try:
@@ -53,23 +52,23 @@ def sqlite_column_reflect_listener(inspector, table, column_info):
5352

5453
def upgrade():
5554
op.create_table('art_show_receipt',
56-
sa.Column('id', residue.UUID(), nullable=False),
55+
sa.Column('id', sa.Uuid(as_uuid=False), nullable=False),
5756
sa.Column('invoice_num', sa.Integer(), server_default='0', nullable=False),
58-
sa.Column('attendee_id', residue.UUID(), nullable=True),
59-
sa.Column('closed', residue.UTCDateTime(), nullable=True),
57+
sa.Column('attendee_id', sa.Uuid(as_uuid=False), nullable=True),
58+
sa.Column('closed', sa.DateTime(timezone=True), nullable=True),
6059
sa.ForeignKeyConstraint(['attendee_id'], ['attendee.id'], name=op.f('fk_art_show_receipt_attendee_id_attendee'), ondelete='SET NULL'),
6160
sa.PrimaryKeyConstraint('id', name=op.f('pk_art_show_receipt'))
6261
)
6362
op.create_table('art_show_payment',
64-
sa.Column('id', residue.UUID(), nullable=False),
65-
sa.Column('receipt_id', residue.UUID(), nullable=True),
63+
sa.Column('id', sa.Uuid(as_uuid=False), nullable=False),
64+
sa.Column('receipt_id', sa.Uuid(as_uuid=False), nullable=True),
6665
sa.Column('amount', sa.Integer(), server_default='0', nullable=False),
6766
sa.Column('type', sa.Integer(), server_default='180350097', nullable=False),
68-
sa.Column('when', residue.UTCDateTime(), nullable=False),
67+
sa.Column('when', sa.DateTime(timezone=True), nullable=False),
6968
sa.ForeignKeyConstraint(['receipt_id'], ['art_show_receipt.id'], name=op.f('fk_art_show_payment_receipt_id_art_show_receipt'), ondelete='SET NULL'),
7069
sa.PrimaryKeyConstraint('id', name=op.f('pk_art_show_payment'))
7170
)
72-
op.add_column('art_show_piece', sa.Column('receipt_id', residue.UUID(), nullable=True))
71+
op.add_column('art_show_piece', sa.Column('receipt_id', sa.Uuid(as_uuid=False), nullable=True))
7372
op.add_column('art_show_piece', sa.Column('winning_bid', sa.Integer(), server_default='0', nullable=True))
7473
op.create_foreign_key(op.f('fk_art_show_piece_receipt_id_art_show_receipt'), 'art_show_piece', 'art_show_receipt', ['receipt_id'], ['id'], ondelete='SET NULL')
7574

alembic/versions/1ad8716bfc74_add_start_and_end_time_to_access_groups.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
from alembic import op
1717
import sqlalchemy as sa
18-
import residue
1918

2019

2120
try:
@@ -52,8 +51,8 @@ def sqlite_column_reflect_listener(inspector, table, column_info):
5251

5352

5453
def upgrade():
55-
op.add_column('access_group', sa.Column('start_time', residue.UTCDateTime(), nullable=True))
56-
op.add_column('access_group', sa.Column('end_time', residue.UTCDateTime(), nullable=True))
54+
op.add_column('access_group', sa.Column('start_time', sa.DateTime(timezone=True), nullable=True))
55+
op.add_column('access_group', sa.Column('end_time', sa.DateTime(timezone=True), nullable=True))
5756

5857

5958
def downgrade():

alembic/versions/1c87fd8da02e_adds_job_visibility_column.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from alembic import op
1717
import sqlalchemy as sa
1818
from sqlalchemy.sql import table
19-
import residue
2019

2120

2221

@@ -55,9 +54,9 @@ def sqlite_column_reflect_listener(inspector, table, column_info):
5554

5655
dept_membership_request_table = table(
5756
'dept_membership_request',
58-
sa.Column('id', residue.UUID()),
59-
sa.Column('attendee_id', residue.UUID()),
60-
sa.Column('department_id', residue.UUID()),
57+
sa.Column('id', sa.Uuid(as_uuid=False)),
58+
sa.Column('attendee_id', sa.Uuid(as_uuid=False)),
59+
sa.Column('department_id', sa.Uuid(as_uuid=False)),
6160
)
6261

6362

alembic/versions/1d2599479473_add_attendee_accounts.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
from alembic import op
1717
import sqlalchemy as sa
18-
import residue
1918

2019

2120
try:
@@ -53,14 +52,14 @@ def sqlite_column_reflect_listener(inspector, table, column_info):
5352

5453
def upgrade():
5554
op.create_table('attendee_account',
56-
sa.Column('id', residue.UUID(), nullable=False),
55+
sa.Column('id', sa.Uuid(as_uuid=False), nullable=False),
5756
sa.Column('email', sa.Unicode(), server_default='', nullable=False),
5857
sa.Column('hashed', sa.Unicode(), server_default='', nullable=False),
5958
sa.PrimaryKeyConstraint('id', name=op.f('pk_attendee_account'))
6059
)
6160
op.create_table('attendee_attendee_account',
62-
sa.Column('attendee_id', residue.UUID(), nullable=False),
63-
sa.Column('attendee_account_id', residue.UUID(), nullable=False),
61+
sa.Column('attendee_id', sa.Uuid(as_uuid=False), nullable=False),
62+
sa.Column('attendee_account_id', sa.Uuid(as_uuid=False), nullable=False),
6463
sa.ForeignKeyConstraint(['attendee_account_id'], ['attendee_account.id'], name=op.f('fk_attendee_attendee_account_attendee_account_id_attendee_account')),
6564
sa.ForeignKeyConstraint(['attendee_id'], ['attendee.id'], name=op.f('fk_attendee_attendee_account_attendee_id_attendee')),
6665
sa.UniqueConstraint('attendee_id', 'attendee_account_id', name=op.f('uq_attendee_attendee_account_attendee_id'))

alembic/versions/1dc129c4c4f0_add_guest_hospitality_checklist_step.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
from alembic import op
1717
import sqlalchemy as sa
18-
import residue
1918

2019

2120
try:
@@ -53,8 +52,8 @@ def sqlite_column_reflect_listener(inspector, table, column_info):
5352

5453
def upgrade():
5554
op.create_table('guest_hospitality',
56-
sa.Column('id', residue.UUID(), nullable=False),
57-
sa.Column('guest_id', residue.UUID(), nullable=False),
55+
sa.Column('id', sa.Uuid(as_uuid=False), nullable=False),
56+
sa.Column('guest_id', sa.Uuid(as_uuid=False), nullable=False),
5857
sa.Column('completed', sa.Boolean(), server_default='False', nullable=False),
5958
sa.ForeignKeyConstraint(['guest_id'], ['guest_group.id'], name=op.f('fk_guest_hospitality_guest_id_guest_group')),
6059
sa.PrimaryKeyConstraint('id', name=op.f('pk_guest_hospitality')),

alembic/versions/1f862611ba04_make_sure_agents_are_attendees.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
from alembic import op
1717
import sqlalchemy as sa
18-
import residue
1918

2019

2120
try:
@@ -53,7 +52,7 @@ def sqlite_column_reflect_listener(inspector, table, column_info):
5352

5453
def upgrade():
5554
op.add_column('art_show_application', sa.Column('agent_code', sa.Unicode(), server_default='', nullable=False))
56-
op.add_column('art_show_application', sa.Column('agent_id', residue.UUID(), nullable=True))
55+
op.add_column('art_show_application', sa.Column('agent_id', sa.Uuid(as_uuid=False), nullable=True))
5756
op.create_foreign_key(op.f('fk_art_show_application_agent_id_attendee'), 'art_show_application', 'attendee', ['agent_id'], ['id'], ondelete='SET NULL')
5857
op.drop_column('art_show_application', 'agent_name')
5958

0 commit comments

Comments
 (0)