Browse Source
[ADD] init hook to migrate from audittrail
pull/1040/head
Holger Brunn
10 years ago
committed by
Enric Tobella
No known key found for this signature in database
GPG Key ID: 1A2546A1B7BA2451
2 changed files with
15 additions and
0 deletions
-
auditlog/__init__.py
-
auditlog/__openerp__.py
|
|
@ -20,3 +20,17 @@ |
|
|
|
############################################################################## |
|
|
|
|
|
|
|
from . import models |
|
|
|
|
|
|
|
|
|
|
|
def pre_init_hook(cr): |
|
|
|
cr.execute("SELECT 1 FROM pg_class WHERE relname = 'audittrail_rule'") |
|
|
|
if cr.fetchall(): |
|
|
|
migrate_from_audittrail(cr) |
|
|
|
|
|
|
|
|
|
|
|
def migrate_from_audittrail(cr): |
|
|
|
cr.execute('ALTER TABLE audittrail_rule RENAME TO auditlog_rule') |
|
|
|
cr.execute('ALTER TABLE auditlog_rule RENAME COLUMN object_id TO model_id') |
|
|
|
cr.execute('ALTER TABLE audittrail_log RENAME TO auditlog_log') |
|
|
|
cr.execute('ALTER TABLE auditlog_log RENAME COLUMN object_id TO model_id') |
|
|
|
cr.execute('ALTER TABLE audittrail_log_line RENAME TO auditlog_log_line') |
|
|
@ -35,4 +35,5 @@ |
|
|
|
'application': True, |
|
|
|
'installable': True, |
|
|
|
'active': False, |
|
|
|
'pre_init_hook': 'pre_init_hook', |
|
|
|
} |