Merge "Specify text-length for MySQL only"
This commit is contained in:
commit
89cf265900
|
@ -31,7 +31,7 @@ class DSTableData(model_base.BASE):
|
|||
ds_id = sa.Column(sa.String(36), nullable=False, primary_key=True)
|
||||
tablename = sa.Column(sa.String(255), nullable=False, primary_key=True)
|
||||
# choose long length compatible with MySQL, SQLite, Postgres
|
||||
tabledata = sa.Column(sa.Text(1000000000), nullable=False)
|
||||
tabledata = sa.Column(sa.Text(), nullable=False)
|
||||
|
||||
|
||||
def store_ds_table_data(ds_id, tablename, tabledata, session=None):
|
||||
|
|
|
@ -30,11 +30,18 @@ import sqlalchemy as sa
|
|||
|
||||
|
||||
def upgrade():
|
||||
if op.get_bind().engine.dialect.name == 'mysql':
|
||||
# NOTE: Specify a length long enough to choose MySQL
|
||||
# LONGTEXT
|
||||
text_type = sa.Text(length=1000000000)
|
||||
else:
|
||||
text_type = sa.Text()
|
||||
|
||||
op.create_table(
|
||||
'dstabledata',
|
||||
sa.Column('ds_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('tablename', sa.String(length=255), nullable=False),
|
||||
sa.Column('tabledata', sa.Text(length=1000000000), nullable=False),
|
||||
sa.Column('tabledata', text_type, nullable=False),
|
||||
sa.PrimaryKeyConstraint('ds_id', 'tablename'),
|
||||
mysql_engine='InnoDB')
|
||||
|
||||
|
|
Loading…
Reference in New Issue