how to check whether database supports column type #2221
HoneyryderChuck
started this conversation in
General
Replies: 1 comment
-
There currently isn't a database-independent method to use to check whether a type is supported. I'm guessing the only generic approach that would work would be attempting to create a single-column table with the type, and see if it fails, and removing the table afterward. Even that is not 100%, because there are other reasons table creation could fail, such as lack of permissions. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm expanding the test suite of one of my gems to support sqlserver, via the tinytds adapter. I've seen that my tests rely on on the database supporting a JSON type, which tinyds adapter does not support (although recent versions of sqlserver seem to support it?).
In order to fallback to
TEXT
column in such cases, I'd need a way to verify support for a given datatype in the migration:but I didn't find a function I could use for that effect. Is there one?
Beta Was this translation helpful? Give feedback.
All reactions