1"""add dtls_fingerprint to ps_endpoints
3Revision ID: b83645976fdd
5Create Date: 2017-08-03 09:01:49.558111
10revision =
'b83645976fdd'
11down_revision =
'f3d1c5d38b56'
14import sqlalchemy
as sa
15from sqlalchemy.dialects.postgresql
import ENUM
17SHA_HASH_NAME =
'sha_hash_values'
18SHA_HASH_VALUES = [
'SHA-1',
'SHA-256']
21 context = op.get_context()
23 if context.bind.dialect.name ==
'postgresql':
24 enum = ENUM(*SHA_HASH_VALUES, name=SHA_HASH_NAME)
25 enum.create(op.get_bind(), checkfirst=
False)
27 op.add_column(
'ps_endpoints',
28 sa.Column(
'dtls_fingerprint', ENUM(*SHA_HASH_VALUES,
29 name=SHA_HASH_NAME, create_type=
False)))
32 context = op.get_context()
34 if context.bind.dialect.name ==
'mssql':
35 op.drop_constraint(
'ck_ps_endpoints_dtls_fingerprint_sha_hash_values',
'ps_endpoints')
36 op.drop_column(
'ps_endpoints',
'dtls_fingerprint')
38 if context.bind.dialect.name ==
'postgresql':
39 enum = ENUM(*SHA_HASH_VALUES, name=SHA_HASH_NAME)
40 enum.drop(op.get_bind(), checkfirst=
False)