2012-06-01 22:59:32 +04:00
|
|
|
from django.db import connection, transaction
|
|
|
|
|
|
|
|
|
|
|
|
def run():
|
|
|
|
cursor = connection.cursor()
|
|
|
|
cursor.execute('select activity_log_id from log_activity_app;')
|
2012-06-02 01:03:12 +04:00
|
|
|
ids = [r[0] for r in cursor.fetchall()]
|
2012-06-01 22:59:32 +04:00
|
|
|
|
2012-06-05 23:04:36 +04:00
|
|
|
if not ids:
|
|
|
|
return
|
|
|
|
|
2012-06-05 23:05:22 +04:00
|
|
|
cursor.execute('set foreign_key_checks = 0')
|
2012-06-01 22:59:32 +04:00
|
|
|
cursor.execute('insert into log_activity_mkt '
|
|
|
|
'select * from log_activity where id IN %(ids)s;',
|
|
|
|
{'ids':ids})
|
2012-06-02 01:13:08 +04:00
|
|
|
cursor.execute('insert into log_activity_app_mkt '
|
2012-06-02 01:53:25 +04:00
|
|
|
'select id, created, modified, addon_id, activity_log_id '
|
|
|
|
'from log_activity_app;')
|
2012-06-02 01:20:21 +04:00
|
|
|
cursor.execute('set foreign_key_checks = 1')
|
2012-06-02 01:26:07 +04:00
|
|
|
transaction.commit_unless_managed()
|