Skip to content
This repository has been archived by the owner on Mar 18, 2021. It is now read-only.

Fix non ssl connection in aqueduct db upgrade even if --use-ssl is used. #894

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aqueduct/lib/src/cli/commands/db_upgrade.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class CLIDatabaseUpgrade extends CLICommand
var s = persistentStore;
if (s is PostgreSQLPersistentStore) {
return DBInfo("postgres", s.username, s.password, s.host, s.port,
s.databaseName, s.timeZone);
s.databaseName, s.timeZone, useSSL: s.isSSLConnection);
}

return null;
Expand Down
11 changes: 7 additions & 4 deletions aqueduct/lib/src/cli/scripts/run_upgrade.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class RunUpgradeExecutable extends Executable<Map<String, dynamic>> {
if (dbInfo != null && dbInfo.flavor == "postgres") {
store = PostgreSQLPersistentStore(dbInfo.username, dbInfo.password,
dbInfo.host, dbInfo.port, dbInfo.databaseName,
timeZone: dbInfo.timeZone);
timeZone: dbInfo.timeZone, useSSL: dbInfo.useSSL);
}

var migrationTypes = currentMirrorSystem()
Expand Down Expand Up @@ -101,7 +101,7 @@ class RunUpgradeExecutable extends Executable<Map<String, dynamic>> {

class DBInfo {
DBInfo(this.flavor, this.username, this.password, this.host, this.port,
this.databaseName, this.timeZone);
this.databaseName, this.timeZone, {this.useSSL = false});

DBInfo.fromMap(Map<String, dynamic> map)
: flavor = map["flavor"] as String,
Expand All @@ -110,7 +110,8 @@ class DBInfo {
host = map["host"] as String,
port = map["port"] as int,
databaseName = map["databaseName"] as String,
timeZone = map["timeZone"] as String;
timeZone = map["timeZone"] as String,
useSSL = map["useSSL"] as bool;

final String flavor;
final String username;
Expand All @@ -119,6 +120,7 @@ class DBInfo {
final int port;
final String databaseName;
final String timeZone;
final bool useSSL;

Map<String, dynamic> asMap() {
return {
Expand All @@ -128,7 +130,8 @@ class DBInfo {
"host": host,
"port": port,
"databaseName": databaseName,
"timeZone": timeZone
"timeZone": timeZone,
"useSSL": useSSL
};
}
}