upgrading 0.4.x to 0.5 database error.
Mads Kiilerich
mads at kiilerich.com
Mon Dec 23 16:24:13 UTC 2019
On 12/23/19 4:46 PM, Ed Wong wrote:
> Hi,
>
> I'm running Kallithea 0.4.0 and tried to upgrade to 0.5.0; but at the
> point of running "alembic -c my_new.ini upgrade", I got the following
> error:
>
> 2019-12-23 15:42:42.575 INFO [alembic.runtime.migration] Running
> upgrade 151b4a4e8c48 -> 4851d15bc437, db: migration step after
> 95c01895c006 failed to add usk_public_key_idx in alembic step b74907136bc1
> sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError)
> (1170, "BLOB/TEXT column 'public_key' used in key specification without
> a key length") [SQL: u'CREATE INDEX usk_public_key_idx ON user_ssh_keys
> (public_key)'] (Background on this error at: http://sqlalche.me/e/e3q8)
Hmm.
One solution could perhaps be to change db.py to something like
_public_key = Column('public_key', Unicode(512), nullable=False)
... but I'm not sure if 512 (or anything else) is reasonable - that
depends on how long public keys ever can be, and what the lowest key
constraints among databases is these days.
But it seems like we only use the public_key index for deleting ssh keys.
Most likely, it will work just fine without that index. As a quick
temporary workaround, I suggest skipping that upgrade step: edit
kallithea/alembic/versions/4851d15bc437_db_migration_step_after_95c01895c006_.py
and disable the checkings.
It now seems like the right solution would be to change the code to use
the fingerprint when deleting keys. I will work on that.
/Mads
More information about the kallithea-general
mailing list