From 57290516365e2d786c50b1e99ddbefa75997ad6d Mon Sep 17 00:00:00 2001 From: Boris Pavlovic Date: Sat, 8 Jun 2013 12:41:04 +0400 Subject: Fix db.models.Service 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 There is no indexes and no unique constraints in this table at this moment. blueprint db-sync-models-with-migrations Change-Id: I9b31e8976f514e370d6b46076b469fe5e5c8e0f1 --- nova/db/sqlalchemy/models.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py index c4660226f..418e05cfa 100644 --- a/nova/db/sqlalchemy/models.py +++ b/nova/db/sqlalchemy/models.py @@ -45,10 +45,12 @@ class Service(BASE, NovaBase): """Represents a running service on a host.""" __tablename__ = 'services' + __table_args__ = () + id = Column(Integer, primary_key=True) - host = Column(String(255)) # , ForeignKey('hosts.id')) - binary = Column(String(255)) - topic = Column(String(255)) + host = Column(String(255), nullable=True) # , ForeignKey('hosts.id')) + binary = Column(String(255), nullable=True) + topic = Column(String(255), nullable=True) report_count = Column(Integer, nullable=False, default=0) disabled = Column(Boolean, default=False) -- cgit