From 344849f560c19d0a69ce4627f600f1905bb8f91c Mon Sep 17 00:00:00 2001 From: Svetlana Shturm Date: Wed, 19 Jun 2013 08:39:38 +0100 Subject: Sync db.models.Quota* with migrations. Blueprint: db-sync-models-with-migrations Change-Id: Ic97690b650151eb7086cbd40093c0f3c373133e2 --- nova/db/sqlalchemy/models.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py index 9b6d849d3..183a42f60 100644 --- a/nova/db/sqlalchemy/models.py +++ b/nova/db/sqlalchemy/models.py @@ -367,11 +367,12 @@ class Quota(BASE, NovaBase): """ __tablename__ = 'quotas' + __table_args__ = () id = Column(Integer, primary_key=True) - project_id = Column(String(255), index=True) + project_id = Column(String(255), nullable=True) - resource = Column(String(255)) + resource = Column(String(255), nullable=False) hard_limit = Column(Integer, nullable=True) @@ -384,11 +385,14 @@ class QuotaClass(BASE, NovaBase): """ __tablename__ = 'quota_classes' + __table_args__ = ( + Index('ix_quota_classes_class_name', 'class_name'), + ) id = Column(Integer, primary_key=True) - class_name = Column(String(255), index=True) + class_name = Column(String(255), nullable=True) - resource = Column(String(255)) + resource = Column(String(255), nullable=True) hard_limit = Column(Integer, nullable=True) @@ -396,13 +400,16 @@ class QuotaUsage(BASE, NovaBase): """Represents the current usage for a given resource.""" __tablename__ = 'quota_usages' + __table_args__ = ( + Index('ix_quota_usages_project_id', 'project_id'), + ) id = Column(Integer, primary_key=True) - project_id = Column(String(255), index=True) - resource = Column(String(255)) + project_id = Column(String(255), nullable=True) + resource = Column(String(255), nullable=True) - in_use = Column(Integer) - reserved = Column(Integer) + in_use = Column(Integer, nullable=False) + reserved = Column(Integer, nullable=False) @property def total(self): -- cgit