honeysql

MegaMatt 2025-03-26T17:10:14.829539Z

I’m now having trouble figuring out how to get my index to use hash. I see :using-gin but no documentation on generic using. Any examples of using other than gin?

seancorfield 2025-03-26T17:12:49.103329Z

I don't understand what syntax you are trying to produce -- please show an example of the SQL you want.

MegaMatt 2025-03-26T17:21:07.574889Z

CREATE INDEX my_idx ON fruit USING HASH (appearance);

p-himik 2025-03-26T17:25:50.653019Z

FWIW my personal preference is to move as much of the schema manipulation to migration files as possible, which end up being plain SQL files.

MegaMatt 2025-03-26T17:26:25.126709Z

i’m not sure i follow.

p-himik 2025-03-26T17:28:22.346449Z

Unless you need indexes that change at run time, there's no point in generating them at run time. There are two steps when running an app - a migration step and a run step. The migration step runs a bunch of SQL files that bring the DB up to date with whatever is specified in the repo. There are different libraries for that, I myself use Migratus.

👌 1
seancorfield 2025-03-26T17:31:41.696689Z

I agree that migrations are most likely best handled as SQL files and using something like Migratus. That said, I've added support for :using-<id> in general, so :using-hash, :using-gin, etc. You can try it via git deps, or the brand new 2.7.9999-SNAPSHOT that just got deployed.

🙏 1
MegaMatt 2025-03-26T17:34:06.162199Z

thanks so much. Right now i’m doing POC but if i decide to do the migration i’ll definitely consider something like migratus

p-himik 2025-03-26T17:36:22.236209Z

IMO it's actually easier with using migrations right away. Otherwise, you'll have to check whether something exists at every app startup, or use CREATE OR REPLACE - and some DDL parts don't support it so different bits of your app will have different ways of managing DDL, which becomes a mess after you have more than 2 DDL statements.

👍 1
💯 1