summaryrefslogtreecommitdiffstats
path: root/nova/db/sqlalchemy/models.py
diff options
context:
space:
mode:
authorSvetlana Shturm <sshturm@mirantis.com>2013-06-19 08:39:38 +0100
committerSvetlana Shturm <sshturm@mirantis.com>2013-06-20 08:25:59 +0100
commit344849f560c19d0a69ce4627f600f1905bb8f91c (patch)
tree1f77b8b3fad375197d1fe2ef4a24f444d9a1c644 /nova/db/sqlalchemy/models.py
parent2bcd6b59a6d6848144ff9fb4f7b4c2241b907515 (diff)
downloadnova-344849f560c19d0a69ce4627f600f1905bb8f91c.tar.gz
nova-344849f560c19d0a69ce4627f600f1905bb8f91c.tar.xz
nova-344849f560c19d0a69ce4627f600f1905bb8f91c.zip
Sync db.models.Quota* with migrations.
Blueprint: db-sync-models-with-migrations Change-Id: Ic97690b650151eb7086cbd40093c0f3c373133e2
Diffstat (limited to 'nova/db/sqlalchemy/models.py')
-rw-r--r--nova/db/sqlalchemy/models.py23
1 files 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):