Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do a much better job of parsing defaults from the database
Parsing defaults from the database is an ugly job, but somebody's got to do it. I can't say I'm happy with this commit, but it's a big improvement and should fix most of the issues people have. I'm sure there are still corner cases that I didn't handle, but I'll gladly take patches to improve support. The default parsing works by looking at both the default string value provided by the database as well as the type of value that Sequel has already parsed (the symbol value used for typecasting, not the class value parsed in the schema dumper). It runs the string through some regexps and gsubs depending on the database type, and then converts values to an appropriate class. For implementation reasons, the DateTime class is always used default values for datetime types even if it isn't the Sequel.datetime_class. In Schema::Generator, recognize default values that can't be represented correctly by inspect, and make sure to generate a useable string.
- Loading branch information
1 parent
d89c15f
commit ac87ba7
Showing
3 changed files
with
164 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters