maragudk / goqite

Go queue library built on SQLite and inspired by AWS SQS.
https://maragudk.github.io/goqite/
MIT License
435 stars 13 forks source link

Suggestion: Update Create Table to be Create Table If Not Exists #52

Closed immannino closed 4 months ago

immannino commented 4 months ago

Hi!

I've been using this library all morning and it is fantastic. I just wanted to pose this more as a question or usability suggestion. For most of my sqlite projects I initialize all my tables as CREATE TABLE IF NOT EXISTS and run my ddl on setup for my apps.

Currently using the library I have to comment out goqite.Setup() after the first run otherwise it fails since the table already exists. Would you be open to changing the default schema to CREATE TABLE IF NOT EXISTS or is there a preferred pattern / just catching and checking the error is for the 'table already exists' error and moving on?

Thanks!

markuswustenberg commented 4 months ago

I've kinda regretted adding the Setup function. Usually it just makes more sense to run the schema code in whatever schema migration people are already using, so I think I'll remove it soon. In the meantime, I would suggest not calling Setup but copying the schema from the repo. 🙂

immannino commented 4 months ago

Thanks for the reply! I think the utility is great for getting up and running, but I agree as migrating into an existing project / group that makes sense as an ongoing process.