-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify `POST` and `PUT` tests to have less indirection. Data is built and `POST`ed or `PUT` directly in the test, and assertions are clearly made in the test. The `post_contact` / `put_contact` fixtures are now only used in one final test, but it is complex enough that it deserves its own PR. Some drive-by fixes in this commit include: * Run `lint --fix` in `format` Make target * Generate `UUID`s on database insert This is achieved by enabling the [uuid-ossp](https://www.postgresql.org/docs/current/uuid-ossp.html) extension, which happens in the migration present in this commit
- Loading branch information
1 parent
9890fd6
commit b44a5d5
Showing
6 changed files
with
264 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
migrations/versions/20240807_3689b813fe22_default_email_id_on_insert.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
"""default email_id on insert | ||
Revision ID: 3689b813fe22 | ||
Revises: f2041a868dca | ||
Create Date: 2024-08-07 12:19:09.966182 | ||
""" | ||
# pylint: disable=no-member invalid-name | ||
# no-member is triggered by alembic.op, which has dynamically added functions | ||
# invalid-name is triggered by migration file names with a date prefix | ||
# invalid-name is triggered by top-level alembic constants like revision instead of REVISION | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "3689b813fe22" # pragma: allowlist secret | ||
down_revision = "f2041a868dca" # pragma: allowlist secret | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.execute('CREATE EXTENSION IF NOT EXISTS "uuid-ossp";') | ||
op.alter_column( | ||
"emails", | ||
"email_id", | ||
existing_type=sa.UUID(), | ||
server_default=sa.func.uuid_generate_v4(), | ||
existing_nullable=False, | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.execute('DROP EXTENSION IF EXISTS "uuid-ossp";') | ||
op.alter_column( | ||
"emails", | ||
"email_id", | ||
existing_type=sa.UUID(), | ||
server_default=None, | ||
existing_nullable=False, | ||
) | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.