kennygrant / gohackernews

Golang News - curated links about the Go programming language
https://golangnews.com
MIT License
283 stars 42 forks source link

Mysql #38

Closed pjebs closed 4 years ago

pjebs commented 4 years ago

What changes would I need to do to make it work with MySQL?

kennygrant commented 4 years ago

You change the adapter for the db to be mysql when calling OpenDatabase (so change the db_adapter in secrets/fragmenta.json). I haven't documented stuff like that though as I haven't used mysql in quite a while, I tend to use postgresql nowadays.

pjebs commented 4 years ago

Do you think any of the queries may be problematic if run on mysql?

kennygrant commented 4 years ago

They shouldn't be no, they're pretty standard sql. The migration is the only area where I think I haven't supported mysql.

pjebs commented 4 years ago

It turns out that rank column must be wrapped in backticks with mysql8+ There is also a few places where $1,$2,$3 is used in query.