Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't try to create a table if it already exists #20

Open
zmitchell opened this issue Dec 24, 2017 · 4 comments
Open

Don't try to create a table if it already exists #20

zmitchell opened this issue Dec 24, 2017 · 4 comments

Comments

@zmitchell
Copy link

I think a nice quality of life improvement would be to add an option to change the behavior of MyTable.create() from

CREATE TABLE MyTable

to

CREATE TABLE MyTable IF NOT EXISTS

I looked at the source and I couldn't actually find where MyTable.create() is defined. Maybe it's because I'm not well-versed in macros yet.

@Ygg01
Copy link

Ygg01 commented Dec 28, 2017

Yeah, as far as I saw, all tables support this code.

The MyTable.create is created by a macro so I believe this is the part that's creating the table.

@antoyo
Copy link
Owner

antoyo commented Dec 30, 2017

As far as I remember (it's been two years :) ), I first chose the IF NOT EXISTS behaviour but then switched to removing it because you can simply choose to ignore the error instead of using ? or unwrap().
Of course, other errors can happen, so maybe you still find more convenient to have IF NOT EXISTS.
Please tell me your thoughts on this.

@michaeldoubek
Copy link

@antoyo I would like to help, but this would be my first experience in open source. Do you have some guidelines or can you advice me via some fast channel if you struggle? Thx.

@antoyo
Copy link
Owner

antoyo commented Jun 14, 2020

So, codegen generation happens here.
There's a file for the postgres codegen and another for the sqlite codegen.
The CREATE TABLE is generated here.

I'm often on #rust on irc.gnome.org if you want to talk.

Thanks for proposing your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants