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.
 
#
 
#  Rattail is free software: you can redistribute it and/or modify it under the
 
#  terms of the GNU General Public License as published by the Free Software
 
#  Foundation, either version 3 of the License, or (at your option) any later
 
@@ -143,17 +143,19 @@ def drop_db(name, checkfirst=True):
 

	
 
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):
 
    """
 
    Clone a database from a (presumably live) server
 

	
0 comments (0 inline, 0 general)