Merge pull request #1884 from castrapel/unq_sources_label

Add unique constraint to sources table - label column
This commit is contained in:
Curtis 2018-10-19 15:46:44 -07:00 committed by GitHub
commit f263be96b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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): class Source(db.Model):
__tablename__ = 'sources' __tablename__ = 'sources'
id = Column(Integer, primary_key=True) id = Column(Integer, primary_key=True)
label = Column(String(32)) label = Column(String(32), unique=True)
options = Column(JSONType) options = Column(JSONType)
description = Column(Text()) description = Column(Text())
plugin_name = Column(String(32)) plugin_name = Column(String(32))

View File

@ -7,7 +7,7 @@
aspy.yaml==1.1.1 # via pre-commit aspy.yaml==1.1.1 # via pre-commit
bleach==3.0.2 # via readme-renderer bleach==3.0.2 # via readme-renderer
cached-property==1.5.1 # via pre-commit 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 cffi==1.11.5 # via cmarkgfm
cfgv==1.1.0 # via pre-commit cfgv==1.1.0 # via pre-commit
chardet==3.0.4 # via requests 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 pyyaml==3.13 # via aspy.yaml, pre-commit
readme-renderer==22.0 # via twine readme-renderer==22.0 # via twine
requests-toolbelt==0.8.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 six==1.11.0 # via bleach, cfgv, pre-commit, readme-renderer
toml==0.10.0 # via pre-commit toml==0.10.0 # via pre-commit
tqdm==4.26.0 # via twine tqdm==4.27.0 # via twine
twine==1.12.1 twine==1.12.1
urllib3==1.23 # via requests urllib3==1.24 # via requests
virtualenv==16.0.0 # via pre-commit virtualenv==16.0.0 # via pre-commit
webencodings==0.5.1 # via bleach webencodings==0.5.1 # via bleach

View File

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

View File

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

View File

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