[IMP] Create records with timestamp; [RFR] No /migration/ level when using upgrade-path
parent
3a2b838f41
commit
b16c6f36e3
|
@ -62,11 +62,12 @@ class UpgradeAnalysis(models.Model):
|
||||||
% module_name
|
% module_name
|
||||||
)
|
)
|
||||||
module_path = os.path.join(self.upgrade_path, module_name)
|
module_path = os.path.join(self.upgrade_path, module_name)
|
||||||
|
full_path = os.path.join(module_path, version)
|
||||||
else:
|
else:
|
||||||
module_path = get_module_path(module_name)
|
module_path = get_module_path(module_name)
|
||||||
|
full_path = os.path.join(module_path, "migrations", version)
|
||||||
if not module_path:
|
if not module_path:
|
||||||
return "ERROR: could not find module path of '%s':\n" % (module_name)
|
return "ERROR: could not find module path of '%s':\n" % (module_name)
|
||||||
full_path = os.path.join(module_path, "migrations", version)
|
|
||||||
if not os.path.exists(full_path):
|
if not os.path.exists(full_path):
|
||||||
try:
|
try:
|
||||||
os.makedirs(full_path)
|
os.makedirs(full_path)
|
||||||
|
|
|
@ -27,8 +27,8 @@ def get_record_id(cr, module, model, field, mode):
|
||||||
return record[0]
|
return record[0]
|
||||||
cr.execute(
|
cr.execute(
|
||||||
"INSERT INTO upgrade_record "
|
"INSERT INTO upgrade_record "
|
||||||
"(module, model, field, mode, type) "
|
"(create_date, module, model, field, mode, type) "
|
||||||
"VALUES (%s, %s, %s, %s, %s)",
|
"VALUES (NOW() AT TIME ZONE 'UTC', %s, %s, %s, %s, %s)",
|
||||||
(module, model, field, mode, "field"),
|
(module, model, field, mode, "field"),
|
||||||
)
|
)
|
||||||
cr.execute(
|
cr.execute(
|
||||||
|
@ -67,7 +67,8 @@ def compare_registries(cr, module, registry, local_registry):
|
||||||
if not cr.fetchone():
|
if not cr.fetchone():
|
||||||
cr.execute(
|
cr.execute(
|
||||||
"INSERT INTO upgrade_attribute "
|
"INSERT INTO upgrade_attribute "
|
||||||
"(name, value, record_id) VALUES (%s, %s, %s)",
|
"(create_date, name, value, record_id) "
|
||||||
|
"VALUES (NOW() AT TIME ZONE 'UTC', %s, %s, %s)",
|
||||||
(key, value, record_id),
|
(key, value, record_id),
|
||||||
)
|
)
|
||||||
old_field[key] = value
|
old_field[key] = value
|
||||||
|
@ -212,6 +213,7 @@ def log_xml_id(cr, module, xml_id):
|
||||||
if not cr.fetchone():
|
if not cr.fetchone():
|
||||||
cr.execute(
|
cr.execute(
|
||||||
"INSERT INTO upgrade_record "
|
"INSERT INTO upgrade_record "
|
||||||
"(module, model, name, type) values(%s, %s, %s, %s)",
|
"(create_date, module, model, name, type) "
|
||||||
|
"values(NOW() AT TIME ZONE 'UTC', %s, %s, %s, %s)",
|
||||||
(module, record[0], xml_id, "xmlid"),
|
(module, record[0], xml_id, "xmlid"),
|
||||||
)
|
)
|
||||||
|
|
|
@ -88,8 +88,9 @@ class GenerateWizard(models.TransientModel):
|
||||||
# Log model records
|
# Log model records
|
||||||
self.env.cr.execute(
|
self.env.cr.execute(
|
||||||
"""INSERT INTO upgrade_record
|
"""INSERT INTO upgrade_record
|
||||||
(module, name, model, type)
|
(create_date, module, name, model, type)
|
||||||
SELECT imd2.module, imd2.module || '.' || imd.name AS name,
|
SELECT NOW() AT TIME ZONE 'UTC',
|
||||||
|
imd2.module, imd2.module || '.' || imd.name AS name,
|
||||||
im.model, 'model' AS type
|
im.model, 'model' AS type
|
||||||
FROM (
|
FROM (
|
||||||
SELECT min(id) as id, name, res_id
|
SELECT min(id) as id, name, res_id
|
||||||
|
|
Loading…
Reference in New Issue