Revision 3a4a6892
b/pithos/backends/lib/sqlalchemy/node.py | ||
---|---|---|
117 | 117 |
onupdate='CASCADE'), |
118 | 118 |
autoincrement=False)) |
119 | 119 |
path_length = 2048 |
120 |
path_length_in_bytes = path_length * 4 |
|
121 |
columns.append(Column('path', Text(path_length_in_bytes), default='', nullable=False)) |
|
120 |
columns.append(Column('path', String(path_length), default='', nullable=False)) |
|
122 | 121 |
self.nodes = Table('nodes', metadata, *columns, mysql_engine='InnoDB') |
123 |
# place an index on path |
|
124 |
#Index('idx_nodes_path', self.nodes.c.path) |
|
125 | 122 |
|
126 | 123 |
#create policy table |
127 | 124 |
columns=[] |
... | ... | |
184 | 181 |
insp = Inspector.from_engine(self.engine) |
185 | 182 |
indexes = [elem['name'] for elem in insp.get_indexes('nodes')] |
186 | 183 |
if 'idx_nodes_path' not in indexes: |
187 |
explicit_length = '(%s)' %path_length_in_bytes if self.engine.name == 'mysql' else ''
|
|
184 |
explicit_length = '(%s)' %path_length if self.engine.name == 'mysql' else '' |
|
188 | 185 |
s = text('CREATE INDEX idx_nodes_path ON nodes (path%s)' %explicit_length) |
189 | 186 |
self.conn.execute(s).close() |
190 | 187 |
|
Also available in: Unified diff