forked from douban/code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_issue.py
More file actions
44 lines (37 loc) · 1.32 KB
/
update_issue.py
File metadata and controls
44 lines (37 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# -*- coding: utf-8 -*-
from vilya.libs.store import store
def main():
rs = store.execute("select id, type "
"from issues "
"where type='project'")
for r in rs:
id, _ = r
rs1 = store.execute("select id, project_id, issue_id "
"from project_issues "
"where issue_id=%s",
id)
if rs1 and rs1[0]:
_, target_id, _ = rs1[0]
store.execute("update issues "
"set target_id=%s "
"where id=%s",
(target_id, id))
store.commit()
rs = store.execute("select id, type "
"from issues "
"where type='team'")
for r in rs:
id, _ = r
rs1 = store.execute("select id, team_id, issue_id "
"from team_issues "
"where issue_id=%s",
id)
if rs1 and rs1[0]:
_, target_id, _ = rs1[0]
store.execute("update issues "
"set target_id=%s "
"where id=%s",
(target_id, id))
store.commit()
if __name__ == "__main__":
main()