From b11d24afe7969c41ad4d4b72a3d2da97db88a7bd Mon Sep 17 00:00:00 2001 From: Rohit Jaiswal Date: Tue, 28 Apr 2015 16:03:43 -0700 Subject: [PATCH] Trait_* models have incorrect type for key Each of the TraitText, TraintInt, TraitFloat and TraitDatetime have key column which has its type defined incorrectly as Integer. The migrate script correctly defines the type as String(255). This fix updates the sqlalchemy Trait* models to define key as String(255). Closes-Bug: 1449752 Change-Id: I5ac2e9b811e3baa53e329732233cd0011a4d25b9 --- ceilometer/event/storage/impl_sqlalchemy.py | 14 +++++++------- ceilometer/storage/sqlalchemy/models.py | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ceilometer/event/storage/impl_sqlalchemy.py b/ceilometer/event/storage/impl_sqlalchemy.py index 70bf3a53..f01cf42c 100644 --- a/ceilometer/event/storage/impl_sqlalchemy.py +++ b/ceilometer/event/storage/impl_sqlalchemy.py @@ -93,25 +93,25 @@ class Connection(base.Connection): - TraitInt - int trait value - { event_id: event -> event.id - key: trait type + key: trait name value: integer value } - TraitDatetime - - int trait value + - datetime trait value - { event_id: event -> event.id - key: trait type + key: trait name value: datetime value } - TraitText - - int trait value + - text trait value - { event_id: event -> event.id - key: trait type + key: trait name value: text value } - TraitFloat - - int trait value + - float trait value - { event_id: event -> event.id - key: trait type + key: trait name value: float value } diff --git a/ceilometer/storage/sqlalchemy/models.py b/ceilometer/storage/sqlalchemy/models.py index 7051edf6..f251f97b 100644 --- a/ceilometer/storage/sqlalchemy/models.py +++ b/ceilometer/storage/sqlalchemy/models.py @@ -343,7 +343,7 @@ class TraitText(Base): Index('ix_trait_text_event_id_key', 'event_id', 'key'), ) event_id = Column(Integer, ForeignKey('event.id'), primary_key=True) - key = Column(Integer, primary_key=True) + key = Column(String(255), primary_key=True) value = Column(Text) @@ -355,7 +355,7 @@ class TraitInt(Base): Index('ix_trait_int_event_id_key', 'event_id', 'key'), ) event_id = Column(Integer, ForeignKey('event.id'), primary_key=True) - key = Column(Integer, primary_key=True) + key = Column(String(255), primary_key=True) value = Column(Integer) @@ -367,7 +367,7 @@ class TraitFloat(Base): Index('ix_trait_float_event_id_key', 'event_id', 'key'), ) event_id = Column(Integer, ForeignKey('event.id'), primary_key=True) - key = Column(Integer, primary_key=True) + key = Column(String(255), primary_key=True) value = Column(Float(53)) @@ -379,5 +379,5 @@ class TraitDatetime(Base): Index('ix_trait_datetime_event_id_key', 'event_id', 'key'), ) event_id = Column(Integer, ForeignKey('event.id'), primary_key=True) - key = Column(Integer, primary_key=True) + key = Column(String(255), primary_key=True) value = Column(PreciseTimestamp())