Record TTL should default to, and accept, NULL values
Change-Id: Ib7be1f3669e012c28b95cd77f297a635b40a1a10
This commit is contained in:
parent
ba5dfd5402
commit
eff4753822
@ -0,0 +1,32 @@
|
||||
# Copyright 2012 Managed I.T.
|
||||
#
|
||||
# Author: Kiall Mac Innes <kiall@managedit.ie>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from sqlalchemy import MetaData, Table
|
||||
|
||||
meta = MetaData()
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
meta.bind = migrate_engine
|
||||
|
||||
records_table = Table('records', meta, autoload=True)
|
||||
records_table.c.ttl.alter(nullable=True, default=None)
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
meta.bind = migrate_engine
|
||||
|
||||
records_table = Table('records', meta, autoload=True)
|
||||
records_table.c.ttl.alter(nullable=False, default=3600)
|
@ -163,8 +163,8 @@ class Record(Base):
|
||||
type = Column(Enum(name='record_types', *RECORD_TYPES), nullable=False)
|
||||
name = Column(String(255), nullable=False)
|
||||
data = Column(Text, nullable=False)
|
||||
priority = Column(Integer, default=None)
|
||||
ttl = Column(Integer, default=3600, nullable=False)
|
||||
priority = Column(Integer, default=None, nullable=True)
|
||||
ttl = Column(Integer, default=None, nullable=True)
|
||||
|
||||
managed = Column(Boolean, default=False)
|
||||
managed_plugin_type = Column(Unicode(50), default=None, nullable=True)
|
||||
|
@ -221,7 +221,7 @@ class CentralServiceTest(CentralTestCase):
|
||||
|
||||
# Ensure all values have been set correctly
|
||||
self.assertIsNotNone(record['id'])
|
||||
self.assertIsNotNone(record['ttl'])
|
||||
self.assertIsNone(record['ttl'])
|
||||
self.assertEqual(record['name'], values['name'])
|
||||
self.assertEqual(record['type'], values['type'])
|
||||
self.assertEqual(record['data'], values['data'])
|
||||
|
Loading…
Reference in New Issue
Block a user