Skip to content

Commit 44017d6

Browse files
committed
Add script to create sql commands for timestamp updates.
1 parent 56eceb5 commit 44017d6

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

create-update-timestamps-sql.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import json
2+
3+
pattern_notes = 'UPDATE `gitlab`.`notes` \
4+
SET `created_at` = \'%s\', `updated_at` = \'%s\' \
5+
WHERE `noteable_id` = %d \
6+
AND `note` = \'_Status changed to closed_\' \
7+
AND `noteable_type` = \'Issue\';'
8+
9+
pattern_issues = 'UPDATE `gitlab`.`issues` \
10+
SET `created_at` = \'%s\', `updated_at` = \'%s\' \
11+
WHERE `issues`.`id` = %d;'
12+
13+
with open('new_issue_timestamps.json') as fd:
14+
ids = json.load(fd)
15+
16+
for id, timestamps in ids.items():
17+
print(pattern_issues % (timestamps['created'], timestamps['updated'], int(id)))
18+
19+
for id, timestamps in ids.items():
20+
print(pattern_notes % (timestamps['updated'], timestamps['updated'], int(id)))

0 commit comments

Comments
 (0)