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?
I don't understand what syntax you are trying to produce -- please show an example of the SQL you want.
CREATE INDEX my_idx ON fruit USING HASH (appearance);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.
i’m not sure i follow.
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.
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.
thanks so much. Right now i’m doing POC but if i decide to do the migration i’ll definitely consider something like migratus
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.