aboutsummaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2012-08-21 00:42:22 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2012-08-21 00:42:22 +0200
commit5a68f0998ca5015c621787b2c8982f2cea03c26d (patch)
tree529811285a877c15f0a5b9a3ed81bf456ae34965 /Bugzilla/DB
parentd2c7ad1823fc93fb28d4ad4270bccbd0a186e0ac (diff)
downloadbugs-5a68f0998ca5015c621787b2c8982f2cea03c26d.tar
bugs-5a68f0998ca5015c621787b2c8982f2cea03c26d.tar.gz
bugs-5a68f0998ca5015c621787b2c8982f2cea03c26d.tar.bz2
bugs-5a68f0998ca5015c621787b2c8982f2cea03c26d.tar.xz
bugs-5a68f0998ca5015c621787b2c8982f2cea03c26d.zip
Bug 783786: PostgreSQL databases can be created with the wrong encoding
r=dkl a=LpSolit
Diffstat (limited to 'Bugzilla/DB')
-rw-r--r--Bugzilla/DB/Schema/Pg.pm10
1 files changed, 10 insertions, 0 deletions
diff --git a/Bugzilla/DB/Schema/Pg.pm b/Bugzilla/DB/Schema/Pg.pm
index ffe97e109..3dc0fe85e 100644
--- a/Bugzilla/DB/Schema/Pg.pm
+++ b/Bugzilla/DB/Schema/Pg.pm
@@ -74,6 +74,16 @@ sub _initialize {
} #eosub--_initialize
#--------------------------------------------------------------------
+sub get_create_database_sql {
+ my ($self, $name) = @_;
+ # We only create as utf8 if we have no params (meaning we're doing
+ # a new installation) or if the utf8 param is on.
+ my $create_utf8 = Bugzilla->params->{'utf8'}
+ || !defined Bugzilla->params->{'utf8'};
+ my $charset = $create_utf8 ? "ENCODING 'UTF8' TEMPLATE template0" : '';
+ return ("CREATE DATABASE $name $charset");
+}
+
sub get_rename_column_ddl {
my ($self, $table, $old_name, $new_name) = @_;
if (lc($old_name) eq lc($new_name)) {