Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MYSQL: Database error on installation #1283

Closed
2 of 7 tasks
pree opened this issue Mar 16, 2017 · 16 comments · Fixed by #1303
Closed
2 of 7 tasks

MYSQL: Database error on installation #1283

pree opened this issue Mar 16, 2017 · 16 comments · Fixed by #1303
Assignees
Labels
Milestone

Comments

@pree
Copy link

pree commented Mar 16, 2017

Description

Getting the following Database Error when installing on a empty Database.
Database setting is not correct: Error 1170: BLOB/TEXT column 'key_id' used in key specification without a key length

MySQL-Server Version: 10.0.30-MariaDB-0+deb8u1

Screenshots

image

@lunny
Copy link
Member

lunny commented Mar 16, 2017

We haven't tested on Mariadb although it should be the same as MySQL.

@lunny lunny added the type/question Issue needs no code to be fixed, only a description on how to fix it yourself. label Mar 16, 2017
@cez81
Copy link
Contributor

cez81 commented Mar 16, 2017

Just tested this on a fresh install of prebuilt 1.1.0 with 10.0.29-MariaDB-0ubuntu0.16.04.1 on Ubuntu 16.04. InnoDB as engine.
It installs without any errors for me. Been using MariaDB on my production setup without any problems.

Edit:: But 1.1.0+38-gf1d2f16 fails...

@Diablofan
Copy link

I can confirm this happening with MariaDB as well. Tried using the docker image 81f5b797cd07 (latest as of March 16 at 5:41 PM EST), and I was getting this error when trying a fresh install of gitea. Trying with the image tagged 1.1.0 works just fine.

@lunny
Copy link
Member

lunny commented Mar 17, 2017

Oh, maybe it's effected by GPG PR. Let me check.

@lunny lunny added type/bug and removed type/question Issue needs no code to be fixed, only a description on how to fix it yourself. labels Mar 17, 2017
@lunny lunny added this to the 1.2.0 milestone Mar 17, 2017
@lunny
Copy link
Member

lunny commented Mar 17, 2017

This is the bug here. A text column should not be a index. https://github.com/go-gitea/gitea/blob/master/models/gpg_key.go#L23 @sapk what's the max length of a key_id?

@sapk
Copy link
Member

sapk commented Mar 17, 2017

From https://tools.ietf.org/html/rfc4880#section-12.2 "The Key ID is the
low-order 64 bits of the fingerprint." So in hex 64/4 = 16 char

@sapk
Copy link
Member

sapk commented Mar 17, 2017

and in fact it's not even usefull to be a index since. I don't use the keyid to find key.

@gzsombor
Copy link
Contributor

Changing from "INDEX TEXT NOT NULL" to "TEXT NOT NULL" solves the problem - at least for me.

@lunny
Copy link
Member

lunny commented Mar 17, 2017

@sapk so maybe we change the tag from INDEX TEXT NOT NULL to CHAR(16) NOT NULL to resolve this?

@sapk
Copy link
Member

sapk commented Mar 17, 2017

it should but I can't test right now.

@lunny
Copy link
Member

lunny commented Mar 17, 2017

I will send a PR to fix this.

@lunny lunny self-assigned this Mar 17, 2017
@sapk
Copy link
Member

sapk commented Mar 17, 2017

In fact we could even use a uint64 ?

@sapk
Copy link
Member

sapk commented Mar 17, 2017

I have found maybe a optimization for validating more "quickly" since keyid is in signature but not I will have to test it a lot. So repassing #1150 in WIP

@sapk
Copy link
Member

sapk commented Mar 17, 2017

I use string because I use it as a string but the value is a uint64 even for primaryId. @lunny you can PR the change proposed CHAR(16) NOT NULL I will test it more of we can optimize DB for validation in #1150

@lunny
Copy link
Member

lunny commented Mar 17, 2017

OK

@sapk
Copy link
Member

sapk commented Mar 17, 2017

To be more simple it will stay in string format for DB since it will limit format at display but I will use https://github.com/golang/crypto/blob/master/openpgp/packet/public_key.go#L705 the same func to transform uint64 of the keyid store in sign to search only for the good key and not pass over each key of user.

@lunny lunny mentioned this issue Mar 20, 2017
12 tasks
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants