summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2012-08-21 00:43:52 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2012-08-21 00:43:52 +0200
commit6773f8949521744fba0c7fe1cc4bbe3016f7888f (patch)
treed6c550dd89f30400ba441c296bf42a2b9b38cad2 /Bugzilla/DB
parent36ffbcd533ca1a98224e7240a039c59786a24bbd (diff)
downloadbugzilla-6773f8949521744fba0c7fe1cc4bbe3016f7888f.tar.gz
bugzilla-6773f8949521744fba0c7fe1cc4bbe3016f7888f.tar.xz
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 ef6e5671d..d21f5099c 100644
--- a/Bugzilla/DB/Schema/Pg.pm
+++ b/Bugzilla/DB/Schema/Pg.pm
@@ -90,6 +90,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)) {