Write the current schema level out to the database when doing deploydb or setup-databases

This commit is contained in:
Manuel Amador (Rudd-O) 2010-09-01 11:30:32 -07:00
parent 8c5268d72d
commit a0d724cc33
3 changed files with 14 additions and 0 deletions

View File

@ -352,3 +352,10 @@ if rootuser:
print "Applying file %s to the database on server %s:%s"%(p,host,port)
try: run_mysql(text,rootuser,rootpassword,host,port)
except CalledProcessError: sys.exit(22)
p = os.path.join(dbfilepath,"schema-level.sql")
if os.path.isfile(p):
text = file(p).read()
print "Applying file %s to the database on server %s:%s"%(p,host,port)
try: run_mysql(text,rootuser,rootpassword,host,port)
except CalledProcessError: sys.exit(22)

View File

@ -0,0 +1 @@
INSERT INTO `cloud`.`configuration` (category, instance, component, name, value, description) VALUES ('Hidden', 'DEFAULT', 'database', 'schema.level', '2.1.3', 'The schema level of this database');

View File

@ -735,6 +735,12 @@ def deploydb(ctx,virttech=None):
after = after + file(p).read()
Utils.pprint("GREEN","Reading database code from %s"%p)
p = _join("setup","db","schema-level.sql")
if _exists(p):
p = dev_override(p)
after = after + file(p).read()
Utils.pprint("GREEN","Reading database code from %s"%p)
cmd = ["mysql","--user=%s"%dbuser,"-h",dbhost,"--password=%s"%dbpw]
Utils.pprint("GREEN","Deploying post-configuration database scripts to %s (user %s)"%(dbhost,dbuser))
Utils.pprint("BLUE"," ".join(cmd))