2
0
mirror of https://github.com/openkmip/pykmip synced 2026-01-04 01:23:25 +00:00

Merge pull request #161 from OpenKMIP/bug/fix-table-increments

Fixing bug with primary key reuse by SQLAlchemy
This commit is contained in:
Peter Hamilton
2016-04-07 11:05:31 -04:00

View File

@@ -57,6 +57,9 @@ class ManagedObject(sql.Base):
'polymorphic_identity': 'ManagedObject',
'polymorphic_on': _class_type
}
__table_args__ = {
'sqlite_autoincrement': True
}
@abstractmethod
def __init__(self):
@@ -152,6 +155,9 @@ class CryptographicObject(ManagedObject):
__mapper_args__ = {
'polymorphic_identity': 'CryptographicObject'
}
__table_args__ = {
'sqlite_autoincrement': True
}
@abstractmethod
def __init__(self):
@@ -212,6 +218,9 @@ class Key(CryptographicObject):
__mapper_args__ = {
'polymorphic_identity': 'Key'
}
__table_args__ = {
'sqlite_autoincrement': True
}
@abstractmethod
def __init__(self):
@@ -259,6 +268,9 @@ class SymmetricKey(Key):
__mapper_args__ = {
'polymorphic_identity': 'SymmetricKey'
}
__table_args__ = {
'sqlite_autoincrement': True
}
def __init__(self, algorithm, length, value, masks=None,
name='Symmetric Key'):
@@ -397,6 +409,9 @@ class PublicKey(Key):
__mapper_args__ = {
'polymorphic_identity': 'PublicKey'
}
__table_args__ = {
'sqlite_autoincrement': True
}
def __init__(self, algorithm, length, value,
format_type=enums.KeyFormatType.X_509, masks=None,
@@ -548,6 +563,9 @@ class PrivateKey(Key):
__mapper_args__ = {
'polymorphic_identity': 'PrivateKey'
}
__table_args__ = {
'sqlite_autoincrement': True
}
def __init__(self, algorithm, length, value, format_type, masks=None,
name='Private Key'):
@@ -696,6 +714,9 @@ class Certificate(CryptographicObject):
__mapper_args__ = {
'polymorphic_identity': 'Certificate'
}
__table_args__ = {
'sqlite_autoincrement': True
}
@abstractmethod
def __init__(self, certificate_type, value, masks=None,
@@ -793,6 +814,9 @@ class X509Certificate(Certificate):
__mapper_args__ = {
'polymorphic_identity': 'Certificate'
}
__table_args__ = {
'sqlite_autoincrement': True
}
def __init__(self, value, masks=None, name='X.509 Certificate'):
"""
@@ -866,6 +890,9 @@ class SecretData(CryptographicObject):
__mapper_args__ = {
'polymorphic_identity': 'SecretData'
}
__table_args__ = {
'sqlite_autoincrement': True
}
def __init__(self, value, data_type, masks=None, name='Secret Data'):
"""
@@ -979,6 +1006,9 @@ class OpaqueObject(ManagedObject):
__mapper_args__ = {
'polymorphic_identity': 'OpaqueData'
}
__table_args__ = {
'sqlite_autoincrement': True
}
def __init__(self, value, opaque_type, name='Opaque Object'):
"""