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
Add schema feature createIfNotExists and dropIfExists #1704
Add schema feature createIfNotExists and dropIfExists #1704
Conversation
99a5e81
to
07dd153
Compare
_ <- (as += (1, 1, "a11-conflict")).failed | ||
_ <- as.schema.drop | ||
} yield () | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trevorsibanda maybe you can split this test into multiple smaller ones, so it will be easier to narrow down where stuff goes wrong? Unfortunately both future and DBIO kill the usefulness of stacktraces
ab37065
to
ed69a2f
Compare
891d929
to
4a45bae
Compare
@@ -61,6 +67,8 @@ trait OracleProfile extends JdbcProfile { | |||
|
|||
override protected def computeCapabilities: Set[Capability] = (super.computeCapabilities | |||
- RelationalCapabilities.foreignKeyActions | |||
- RelationalCapabilities.createIfNotExists | |||
- RelationalCapabilities.dropIfExists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confused. It looks like you added this feature to Oracle, but this says Oracle doesn't support this. Is this a mistake?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The -
here means you are removing these capabilities from the set of supported capabilities for this driver, which seems to be inaccurate. (Same for the other drivers, where you implemented the feature).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cvogt Thanks... I should change that and also update the others, only DerbyProfile should have these removed since it uses a client side implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think client side implementation is fine. The flags just identify if Slick is able to do this using whatever method. So I don't think we need to remove them. In fact it sounds like we can get rid of them. Back then I only suggested them as an alternative in case it was impossible to do with one of the drivers.
really cool stuff :)! |
6256e46
to
a5f500b
Compare
@@ -89,6 +97,8 @@ trait DerbyProfile extends JdbcProfile { | |||
- JdbcCapabilities.booleanMetaData | |||
- JdbcCapabilities.supportsByte | |||
- RelationalCapabilities.repeat | |||
- RelationalCapabilities.createIfNotExists | |||
- RelationalCapabilities.dropIfExists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does removing the capabilities here make sense? Looks like you added support below, so now the driver actually has this capability. No?
a5f500b
to
93e1507
Compare
93e1507
to
a67a880
Compare
a67a880
to
327e81c
Compare
Added IF (NOT) EXISTS support for SQLServer Added IF (NOT) EXISTS support for IBM DB2 Added IF (NOT) EXISTS support for Oracle Added IF (NOT) EXISTS emulation for Derby Added test cases for createIfNotExists and dropIfExists
@trevorsibanda is this ready for merge? |
@hvesalai Yes it is. |
I think this is great. It resolves my feature request from 2013 #93 |
Addresses points discussed in #93
Adds methods createIfNotExists and dropIfExists
Issues now
IF NOT EXISTS
either in create, drop or both statements. (DB2, Derby, Sqlserver - cause of failing tests).createIfNotExists
fail if the table definition has a foreign key.