summaryrefslogtreecommitdiffstats
path: root/nova/db/sqlalchemy/models.py
diff options
context:
space:
mode:
authorBoris Pavlovic <boris@pavlovic.me>2013-06-08 12:45:16 +0400
committerBoris Pavlovic <boris@pavlovic.me>2013-06-08 19:38:00 +0400
commiteb49f3eb04b798a531f3a0a773cee7c30289a62b (patch)
treeadcdf3c6d2e5ff4fba060154db107ef0d27da4b1 /nova/db/sqlalchemy/models.py
parent8b47458193d124d718afc2b615b9260df7445432 (diff)
downloadnova-eb49f3eb04b798a531f3a0a773cee7c30289a62b.tar.gz
nova-eb49f3eb04b798a531f3a0a773cee7c30289a62b.tar.xz
nova-eb49f3eb04b798a531f3a0a773cee7c30289a62b.zip
Fix db.models.Certificate description
DB models definition should be up-to-date with DB schema obtained after applying of migrations. Currently, there are no tests enforcing this and it's really hard to analyze what indexes should be added, and what indexes we have at the moment. So the first step is it to fix all models, and add missing descriptions about Indexes and UniqueConstraints in __table_args__ and use explicit 'nullable' parameter in columns description. Add missing 'nullable' parameters to all Columns Add empty __table_args__ parameter to Table Add 2 missing indexes in Certificate model definition. blueprint db-sync-models-with-migrations Change-Id: Ida607c2b8899e145116d46cffdc49b7176b05550
Diffstat (limited to 'nova/db/sqlalchemy/models.py')
-rw-r--r--nova/db/sqlalchemy/models.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py
index 647c548c1..f5cda04cc 100644
--- a/nova/db/sqlalchemy/models.py
+++ b/nova/db/sqlalchemy/models.py
@@ -129,11 +129,15 @@ class ComputeNodeStat(BASE, NovaBase):
class Certificate(BASE, NovaBase):
"""Represents a x509 certificate."""
__tablename__ = 'certificates'
+ __table_args__ = (
+ Index('certificates_project_id_deleted_idx', 'project_id', 'deleted'),
+ Index('certificates_user_id_deleted_idx', 'user_id', 'deleted')
+ )
id = Column(Integer, primary_key=True)
- user_id = Column(String(255))
- project_id = Column(String(255))
- file_name = Column(String(255))
+ user_id = Column(String(255), nullable=True)
+ project_id = Column(String(255), nullable=True)
+ file_name = Column(String(255), nullable=True)
class Instance(BASE, NovaBase):