Open
Bug 505362
Opened 17 years ago
Updated 13 years ago
Bugzilla::DB::Schema->_adjust_schema should support overriding the use of varchar
Categories
(Bugzilla :: Database, defect)
Tracking
()
ASSIGNED
People
(Reporter: mockodin, Assigned: mockodin)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
|
1.37 KB,
patch
|
mkanat
:
review-
|
Details | Diff | Splinter Review |
Issue:
Bugzilla::DB::Schema->_adjust_schema should allow varchar data types to be overwritten by DB specific data types when added to the db_specific hash.
Such as:
varchar => 'nvarchar'
Result:
All 'varchar' db fields still create as varchar datatype
expected:
fields created with nvarchar data type
For those wondering, nvarchar was improved as of ms sql 2005
http://msdn.microsoft.com/en-us/library/ms186939.aspx
| Assignee | ||
Comment 1•17 years ago
|
||
This request is to support porting of Bugzilla to MSSQL.
MSSQL does not natively support UTF8/UTF-8 but will however support it perfectly fine when using a nvarchar data type to store it.
Within my environment this is how I make it work, I can and will put this within Bugzilla::DB::Schema::Mssql but would like it to be in the base class where it belongs.
sub _adjust_schema {
my $self = shift;
my $db_specific = $self->{db_specific};
# Loop over each table in the abstract database schema.
foreach my $table (keys %{ $self->{schema} }) {
my %fields = (@{ $self->{schema}{$table}{FIELDS} });
# Loop over the field definitions in each table.
foreach my $field_def (values %fields) {
# Find the data type, allows for (xyz) in {TYPE}
# making sure to match from the beginning of the string
$field_def->{TYPE} =~ m/^(\w*)/;
my $datatype = $1 if $1;
# If the field type is an abstract data type defined in the
# $db_specific hash, replace it with the DBMS-specific data type
# that implements it.
if (exists($db_specific->{$datatype})) {
$field_def->{TYPE} =~ s/^$datatype/$db_specific->{$datatype}/;
}
# Replace abstract default values (such as 'TRUE' and 'FALSE')
# with their database-specific implementations.
if (exists($field_def->{DEFAULT})
&& exists($db_specific->{$field_def->{DEFAULT}})) {
$field_def->{DEFAULT} = $db_specific->{$field_def->{DEFAULT}};
}
}
}
return $self;
}
| Assignee | ||
Comment 2•17 years ago
|
||
Attachment #390538 -
Flags: review?(mkanat)
| Assignee | ||
Updated•17 years ago
|
Assignee: database → mockodin
Status: NEW → ASSIGNED
Comment 3•16 years ago
|
||
Comment on attachment 390538 [details] [diff] [review]
Patch v1
Instead of this, it might be good to make VARCHAR one of our standard abstract types. This would require incrementing DB::Schema::VERSION I believe.
We could have a separate SIZE => element, perhaps, for columns.
Attachment #390538 -
Flags: review?(mkanat) → review-
You need to log in
before you can comment on or make changes to this bug.
Description
•