Add unique constraint to sources table - label column

This commit is contained in:
Curtis Castrapel 2018-10-19 15:34:34 -07:00
parent c6b679bb19
commit e83699b6ae
6 changed files with 57 additions and 35 deletions

View File

@ -0,0 +1,21 @@
"""Add unique constraint to label column on sources table
Revision ID: 6006c79b6011
Revises: 984178255c83
Create Date: 2018-10-19 15:23:06.750510
"""
# revision identifiers, used by Alembic.
revision = '6006c79b6011'
down_revision = '984178255c83'
from alembic import op
def upgrade():
op.create_unique_constraint("uq_label", 'sources', ['label'])
def downgrade():
op.drop_constraint("uq_label", 'sources', type_='unique')

View File

@ -17,7 +17,7 @@ from sqlalchemy_utils import ArrowType
class Source(db.Model):
__tablename__ = 'sources'
id = Column(Integer, primary_key=True)
label = Column(String(32))
label = Column(String(32), unique=True)
options = Column(JSONType)
description = Column(Text())
plugin_name = Column(String(32))

View File

@ -7,7 +7,7 @@
aspy.yaml==1.1.1 # via pre-commit
bleach==3.0.2 # via readme-renderer
cached-property==1.5.1 # via pre-commit
certifi==2018.8.24 # via requests
certifi==2018.10.15 # via requests
cffi==1.11.5 # via cmarkgfm
cfgv==1.1.0 # via pre-commit
chardet==3.0.4 # via requests
@ -29,11 +29,11 @@ pygments==2.2.0 # via readme-renderer
pyyaml==3.13 # via aspy.yaml, pre-commit
readme-renderer==22.0 # via twine
requests-toolbelt==0.8.0 # via twine
requests==2.19.1 # via requests-toolbelt, twine
requests==2.20.0 # via requests-toolbelt, twine
six==1.11.0 # via bleach, cfgv, pre-commit, readme-renderer
toml==0.10.0 # via pre-commit
tqdm==4.26.0 # via twine
tqdm==4.27.0 # via twine
twine==1.12.1
urllib3==1.23 # via requests
urllib3==1.24 # via requests
virtualenv==16.0.0 # via pre-commit
webencodings==0.5.1 # via bleach

View File

@ -23,7 +23,7 @@ celery[redis]==4.2.1
certifi==2018.8.24
cffi==1.11.5
chardet==3.0.4
click==6.7
click==7.0
cloudflare==2.1.0
cryptography==2.3.1
dnspython3==1.15.0
@ -54,20 +54,20 @@ lockfile==0.12.2
mako==1.0.7
markupsafe==1.0
marshmallow-sqlalchemy==0.14.1
marshmallow==2.15.5
marshmallow==2.16.0
mock==2.0.0
ndg-httpsclient==0.5.1
packaging==18.0 # via sphinx
paramiko==2.4.1
pbr==4.2.0
pem==18.1.0
paramiko==2.4.2
pbr==4.3.0
pem==18.2.0
psycopg2==2.7.5
pyasn1-modules==0.2.2
pyasn1==0.4.4
pycparser==2.18
pycparser==2.19
pygments==2.2.0 # via sphinx
pyjwt==1.6.4
pynacl==1.2.1
pynacl==1.3.0
pyopenssl==18.0.0
pyparsing==2.2.2 # via packaging
pyrfc3339==1.1
@ -87,8 +87,8 @@ sphinx-rtd-theme==0.4.2
sphinx==1.8.1
sphinxcontrib-httpdomain==1.7.0
sphinxcontrib-websupport==1.1.0 # via sphinx
sqlalchemy-utils==0.33.4
sqlalchemy==1.2.11
sqlalchemy-utils==0.33.5
sqlalchemy==1.2.12
tabulate==0.8.2
urllib3==1.23
vine==1.1.4

View File

@ -8,27 +8,28 @@ asn1crypto==0.24.0 # via cryptography
atomicwrites==1.2.1 # via pytest
attrs==18.2.0 # via pytest
aws-xray-sdk==0.95 # via moto
boto3==1.9.21 # via moto
biscuits==0.1.1 # via responses
boto3==1.9.28 # via moto
boto==2.49.0 # via moto
botocore==1.12.21 # via boto3, moto, s3transfer
certifi==2018.8.24 # via requests
botocore==1.12.28 # via boto3, moto, s3transfer
certifi==2018.10.15 # via requests
cffi==1.11.5 # via cryptography
chardet==3.0.4 # via requests
click==7.0 # via flask
cookies==2.2.1 # via moto, responses
cookies==2.2.1 # via moto
coverage==4.5.1
cryptography==2.3.1 # via moto
docker-pycreds==0.3.0 # via docker
docker==3.5.0 # via moto
docker==3.5.1 # via moto
docutils==0.14 # via botocore
ecdsa==0.13 # via python-jose
factory-boy==2.11.1
faker==0.9.1
faker==0.9.2
flask==1.0.2 # via pytest-flask
freezegun==0.3.10
freezegun==0.3.11
future==0.16.0 # via python-jose
idna==2.7 # via cryptography, requests
itsdangerous==0.24 # via flask
itsdangerous==1.0.0 # via flask
jinja2==2.10 # via flask, moto
jmespath==0.9.3 # via boto3, botocore
jsondiff==1.1.1 # via moto
@ -38,23 +39,23 @@ mock==2.0.0 # via moto
more-itertools==4.3.0 # via pytest
moto==1.3.4
nose==1.3.7
pbr==4.3.0 # via mock
pluggy==0.7.1 # via pytest
py==1.6.0 # via pytest
pbr==5.0.0 # via mock
pluggy==0.8.0 # via pytest
py==1.7.0 # via pytest
pyaml==17.12.1 # via moto
pycparser==2.19 # via cffi
pycryptodome==3.6.6 # via python-jose
pyflakes==2.0.0
pytest-flask==0.13.0
pytest-mock==1.10.0
pytest==3.8.2
pytest==3.9.1
python-dateutil==2.7.3 # via botocore, faker, freezegun, moto
python-jose==2.0.2 # via moto
pytz==2018.5 # via moto
pyyaml==3.13 # via pyaml
requests-mock==1.5.2
requests==2.19.1 # via aws-xray-sdk, docker, moto, requests-mock, responses
responses==0.9.0 # via moto
requests==2.20.0 # via aws-xray-sdk, docker, moto, requests-mock, responses
responses==0.10.1 # via moto
s3transfer==0.1.13 # via boto3
six==1.11.0 # via cryptography, docker, docker-pycreds, faker, freezegun, mock, more-itertools, moto, pytest, python-dateutil, python-jose, requests-mock, responses, websocket-client
text-unidecode==1.2 # via faker

View File

@ -6,7 +6,7 @@
#
acme==0.27.1
alembic-autogenerate-enums==0.0.2
alembic==1.0.0 # via flask-migrate
alembic==1.0.1 # via flask-migrate
amqp==2.3.2 # via kombu
aniso8601==3.0.2 # via flask-restful
arrow==0.12.1
@ -18,7 +18,7 @@ blinker==1.4 # via flask-mail, flask-principal, raven
boto3==1.7.79
botocore==1.10.84
celery[redis]==4.2.1
certifi==2018.8.24
certifi==2018.10.15
cffi==1.11.5 # via bcrypt, cryptography, pynacl
chardet==3.0.4 # via requests
click==7.0 # via flask
@ -41,7 +41,7 @@ future==0.16.0
gunicorn==19.9.0
idna==2.7 # via cryptography, requests
inflection==0.3.1
itsdangerous==0.24 # via flask
itsdangerous==1.0.0 # via flask
jinja2==2.10
jmespath==0.9.3 # via boto3, botocore
josepy==1.1.0 # via acme
@ -55,7 +55,7 @@ marshmallow==2.16.0
mock==2.0.0 # via acme
ndg-httpsclient==0.5.1
paramiko==2.4.2
pbr==4.3.0 # via mock
pbr==5.0.0 # via mock
pem==18.2.0
psycopg2==2.7.5
pyasn1-modules==0.2.2 # via python-ldap
@ -73,14 +73,14 @@ pyyaml==3.13 # via cloudflare
raven[flask]==6.9.0
redis==2.10.6 # via celery
requests-toolbelt==0.8.0 # via acme
requests[security]==2.19.1
requests[security]==2.20.0
retrying==1.3.3
s3transfer==0.1.13 # via boto3
six==1.11.0
sqlalchemy-utils==0.33.5
sqlalchemy-utils==0.33.6
sqlalchemy==1.2.12 # via alembic, flask-sqlalchemy, marshmallow-sqlalchemy, sqlalchemy-utils
tabulate==0.8.2
urllib3==1.23 # via requests
urllib3==1.24 # via requests
vine==1.1.4 # via amqp
werkzeug==0.14.1 # via flask
xmltodict==0.11.0