mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
runbot createdb locally using commandline
This commit is contained in:
parent
85039d0660
commit
ff3cd203c7
@ -641,24 +641,12 @@ class runbot_build(osv.osv):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def pg_dropdb(self, cr, uid, dbname):
|
def pg_dropdb(self, cr, uid, dbname):
|
||||||
try:
|
run(['dropdb', dbname])
|
||||||
openerp.service.db.exp_drop(dbname)
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def pg_createdb(self, cr, uid, dbname):
|
def pg_createdb(self, cr, uid, dbname):
|
||||||
self.pg_dropdb(cr, uid, dbname)
|
self.pg_dropdb(cr, uid, dbname)
|
||||||
_logger.debug("createdb %s", dbname)
|
_logger.debug("createdb %s", dbname)
|
||||||
|
run(['createdb', '--encoding=unicode', '--lc-collate=C', '--template=template0', dbname])
|
||||||
# we don't use _create_empty_database because we need to enforce database collate to "C"
|
|
||||||
db = openerp.sql_db.db_connect('postgres')
|
|
||||||
with db.cursor() as cr:
|
|
||||||
cr.autocommit(True) # avoid transaction block
|
|
||||||
cr.execute("""CREATE DATABASE "%s"
|
|
||||||
ENCODING 'unicode'
|
|
||||||
LC_COLLATE = 'C'
|
|
||||||
TEMPLATE template0
|
|
||||||
""" % (dbname,))
|
|
||||||
|
|
||||||
def cmd(self, cr, uid, ids, context=None):
|
def cmd(self, cr, uid, ids, context=None):
|
||||||
"""Return a list describing the command to start the build"""
|
"""Return a list describing the command to start the build"""
|
||||||
|
Loading…
Reference in New Issue
Block a user