]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 783786: PostgreSQL databases can be created with the wrong encoding
authorFrédéric Buclin <LpSolit@gmail.com>
Mon, 20 Aug 2012 22:43:52 +0000 (00:43 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Mon, 20 Aug 2012 22:43:52 +0000 (00:43 +0200)
r=dkl a=LpSolit

Bugzilla/DB/Schema/Pg.pm

index ef6e5671d46f3a7b7800d67799d5934255deb225..d21f5099ca7094aef8d2915d51d3c218e580a35b 100644 (file)
@@ -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)) {