Changeset - 93ac95d58972
[Not reviewed]
0 1 0
Lance Edgar (lance) - 7 years ago 2018-01-15 16:57:47
lance@edbob.org
Revert "Remove a couple steps when cloning Postgres database"

This reverts commit 3cfed219b44d1ce66068001304f2c51565676ba7.
1 file changed with 9 insertions and 7 deletions:
0 comments (0 inline, 0 general)
rattail/fablib/postgresql.py
Show inline comments
 
# -*- coding: utf-8; -*-
 
# -*- coding: utf-8 -*-
 
################################################################################
 
#
 
#  Rattail -- Retail Software Framework
 
#  Copyright © 2010-2018 Lance Edgar
 
#  Copyright © 2010-2017 Lance Edgar
 
#
 
#  This file is part of Rattail.
 
#
 
@@ -146,11 +146,13 @@ def download_db(name, destination=None):
 
    Download a database from the "current" server.
 
    """
 
    if destination is None:
 
        destination = './{}.sql.gz'.format(name)
 
    sudo('sudo -u postgres pg_dump {0} > {0}.sql'.format(name))
 
    run('gzip --force {}.sql'.format(name))
 
    get('{}.sql.gz'.format(name), destination)
 
    run('rm {}.sql.gz'.format(name))
 
        destination = './{0}.sql.gz'.format(name)
 
    run('touch {0}.sql'.format(name))
 
    run('chmod 0666 {0}.sql'.format(name))
 
    sudo('sudo -u postgres pg_dump --file={0}.sql {0}'.format(name), shell=False)
 
    run('gzip --force {0}.sql'.format(name))
 
    get('{0}.sql.gz'.format(name), destination)
 
    run('rm {0}.sql.gz'.format(name))
 

	
 

	
 
def clone_db(name, owner, download, user='rattail', force=False, workdir=None):
0 comments (0 inline, 0 general)