sqlite_orm
sqlite_orm copied to clipboard
IF EXISTS: Is it possible?
How would I write the following using sqlite_orm?
DROP TRIGGER IF EXISTS trigger
DROP TABLE IF EXISTS table
More specifically the IF EXISTS / IF NOT EXISTS part as I see drop_table / drop_trigger are part of the library. I see there is a table_exists(...) method, but nothing equivalent for triggers.
I see it can be implemented in several ways:
storage.drop_table_if_exists(...);- one more funcstorage.drop_table(if_exists(...));- one more overload- your option
@trevornagy do you have any API preference for this?
BTW IF NOT EXISTS makes no sense cause DROP TABLE my_table IF NOT EXISTS is ridiculous =)
I prefer option 2 as the api would be more consistent for triggers/tables.
I was thinking a lot about which option to pick. So I'd like to stick with option 1 cause it is easier for newbies cause once you type storage.drop you see all the options. In the case of option 2 you will type storage.drop but how to specify if_exists may be not clear from the first sight. I hope you agree
I like the overload better Juan Dent Sent from my iPhoneOn 23 Jun 2024, at 1:36 AM, Yevgeniy Zakharov @.***> wrote: I was thinking a lot about which option to pick. So I'd like to stick with option 1 cause it is easier for newbies cause once you type storage.drop you see all the options. In the case of option 2 you will type storage.drop but how to specify if_exists may be not clear from the first sight. I hope you agree
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>
Hey @fnc12, just wondering if there was any progress on this issue?
@trevornagy in progress
PR https://github.com/fnc12/sqlite_orm/pull/1333
@trevornagy done. Please check dev branch
Much appreciated, testing now!