Longer string columns for Trait and UniqueNames
UUID's are larger than the 32 columns previously allocated. Bumped to 255. Arguably could have gone larger but we should be aware of long strings since we're going to have so many Events. Change-Id: Ib3785e3546ee77937d5a63691a9ae1dc16147c37
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
#
|
||||
# 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 *
|
||||
|
||||
meta = MetaData()
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
meta.bind = migrate_engine
|
||||
name = Table('unique_name', meta, autoload=True)
|
||||
name.c.key.alter(type=VARCHAR(length=255))
|
||||
trait = Table('trait', meta, autoload=True)
|
||||
trait.c.t_string.alter(type=VARCHAR(length=255))
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
meta.bind = migrate_engine
|
||||
name = Table('unique_name', meta, autoload=True)
|
||||
name.c.key.alter(type=VARCHAR(length=32))
|
||||
trait = Table('trait', meta, autoload=True)
|
||||
trait.c.t_string.alter(type=VARCHAR(length=32))
|
||||
@@ -183,7 +183,7 @@ class UniqueName(Base):
|
||||
"""
|
||||
__tablename__ = 'unique_name'
|
||||
id = Column(Integer, primary_key=True)
|
||||
key = Column(String(32), index=True, unique=True)
|
||||
key = Column(String(255), index=True, unique=True)
|
||||
|
||||
def __init__(self, key):
|
||||
self.key = key
|
||||
@@ -218,7 +218,7 @@ class Trait(Base):
|
||||
name = relationship("UniqueName", backref=backref('name', order_by=id))
|
||||
|
||||
t_type = Column(Integer, index=True)
|
||||
t_string = Column(String(32), nullable=True, default=None, index=True)
|
||||
t_string = Column(String(255), nullable=True, default=None, index=True)
|
||||
t_float = Column(Float, nullable=True, default=None, index=True)
|
||||
t_int = Column(Integer, nullable=True, default=None, index=True)
|
||||
t_datetime = Column(Float(asdecimal=True), nullable=True, default=None,
|
||||
|
||||
Reference in New Issue
Block a user