mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-20 14:29:25 -04:00
Fix merge conflict with db upgrade
This commit is contained in:
19
migrations/versions/0309_add_uq_key_row_number.py
Normal file
19
migrations/versions/0309_add_uq_key_row_number.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
"""
|
||||||
|
|
||||||
|
Revision ID: 0309_add_uq_key_row_number
|
||||||
|
Revises: 0308_delete_loadtesting_provider
|
||||||
|
Create Date: 2019-11-05 10:12:03.627850
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
|
||||||
|
revision = '0309_add_uq_key_row_number'
|
||||||
|
down_revision = '0308_delete_loadtesting_provider'
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.create_unique_constraint('uq_notifications_job_row_number', 'notifications', ['job_id', 'job_row_number'])
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
op.drop_constraint('uq_notifications_job_row_number')
|
||||||
@@ -498,7 +498,6 @@ def test_find_missing_row_for_job_return_none_when_row_isnt_missing(sample_email
|
|||||||
create_notification(job=job, job_row_number=i)
|
create_notification(job=job, job_row_number=i)
|
||||||
|
|
||||||
results = find_missing_row_for_job(job.id, 5)
|
results = find_missing_row_for_job(job.id, 5)
|
||||||
print(results)
|
|
||||||
assert len(results) == 0
|
assert len(results) == 0
|
||||||
|
|
||||||
|
|
||||||
@@ -507,3 +506,12 @@ def test_unique_key_on_job_id_and_job_row_number(sample_email_template):
|
|||||||
create_notification(job=job, job_row_number=0)
|
create_notification(job=job, job_row_number=0)
|
||||||
with pytest.raises(expected_exception=IntegrityError):
|
with pytest.raises(expected_exception=IntegrityError):
|
||||||
create_notification(job=job, job_row_number=0)
|
create_notification(job=job, job_row_number=0)
|
||||||
|
|
||||||
|
|
||||||
|
def test_unique_key_on_job_id_and_job_row_number_no_error_if_row_number_for_different_job(
|
||||||
|
sample_email_template
|
||||||
|
):
|
||||||
|
job_1 = create_job(template=sample_email_template)
|
||||||
|
job_2 = create_job(template=sample_email_template)
|
||||||
|
create_notification(job=job_1, job_row_number=0)
|
||||||
|
create_notification(job=job_2, job_row_number=0)
|
||||||
|
|||||||
Reference in New Issue
Block a user