diff options
author | Marc Bonnici <marc.bonnici@arm.com> | 2018-09-20 17:01:12 +0100 |
---|---|---|
committer | Marc Bonnici <marc.bonnici@arm.com> | 2018-09-21 15:06:30 +0100 |
commit | 9a9a2c0742434872534fcd570de923bab0b145ba (patch) | |
tree | 0f6e8b4ffec580e7554a9af56c17ec4ab015235c | |
parent | 57aa5ca5882b963c0797a99798f867440f28d288 (diff) |
commands/create: Add version check for Postgres Server
The 'jsonB' datatype was only added in v9.4 so ensure that the Postgres
server to is running this or later and inform the user if this is not
the case.
-rw-r--r-- | wa/commands/create.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/wa/commands/create.py b/wa/commands/create.py index 306cb35a..24931cfa 100644 --- a/wa/commands/create.py +++ b/wa/commands/create.py @@ -159,6 +159,8 @@ class CreateDatabaseSubcommand(SubCommand): _update_configuration_file(args, config) def create_database(self, args): + _validate_version(args) + _check_database_existence(args) _create_database_postgres(args) @@ -429,6 +431,14 @@ def touch(path): pass +def _validate_version(args): + conn = connect(user=args.username, + password=args.password, host=args.postgres_host, port=args.postgres_port) + if conn.server_version < 90400: + msg = 'Postgres version too low. Please ensure that you are using atleast v9.4' + raise CommandError(msg) + + def _check_database_existence(args): try: connect(dbname=args.dbname, user=args.username, |