1 PG_SEQUENCE_RESETS = """
2 SELECT setval('"auth_user_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "auth_user";
3 SELECT setval('"auth_user_groups_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "auth_user_groups";
4 SELECT setval('"auth_user_user_permissions_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "auth_user_user_permissions";
5 SELECT setval('"forum_keyvalue_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "forum_keyvalue";
6 SELECT setval('"forum_action_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "forum_action";
7 SELECT setval('"forum_actionrepute_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "forum_actionrepute";
8 SELECT setval('"forum_subscriptionsettings_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "forum_subscriptionsettings";
9 SELECT setval('"forum_validationhash_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "forum_validationhash";
10 SELECT setval('"forum_authkeyuserassociation_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "forum_authkeyuserassociation";
11 SELECT setval('"forum_tag_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "forum_tag";
12 SELECT setval('"forum_markedtag_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "forum_markedtag";
13 SELECT setval('"forum_node_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "forum_node";
14 SELECT setval('"forum_nodestate_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "forum_nodestate";
15 SELECT setval('"forum_node_tags_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "forum_node_tags";
16 SELECT setval('"forum_noderevision_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "forum_noderevision";
17 SELECT setval('"forum_node_tags_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "forum_node_tags";
18 SELECT setval('"forum_questionsubscription_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "forum_questionsubscription";
19 SELECT setval('"forum_vote_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "forum_vote";
20 SELECT setval('"forum_flag_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "forum_flag";
21 SELECT setval('"forum_badge_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "forum_badge";
22 SELECT setval('"forum_award_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "forum_award";
23 SELECT setval('"forum_openidnonce_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "forum_openidnonce";
24 SELECT setval('"forum_openidassociation_id_seq"', coalesce(max("id"), 1) + 2, max("id") IS NOT null) FROM "forum_openidassociation";
27 PG_DISABLE_TRIGGERS = """
28 ALTER table auth_user DISABLE TRIGGER ALL;
29 ALTER table auth_user_groups DISABLE TRIGGER ALL;
30 ALTER table auth_user_user_permissions DISABLE TRIGGER ALL;
31 ALTER table forum_keyvalue DISABLE TRIGGER ALL;
32 ALTER table forum_action DISABLE TRIGGER ALL;
33 ALTER table forum_actionrepute DISABLE TRIGGER ALL;
34 ALTER table forum_subscriptionsettings DISABLE TRIGGER ALL;
35 ALTER table forum_validationhash DISABLE TRIGGER ALL;
36 ALTER table forum_authkeyuserassociation DISABLE TRIGGER ALL;
37 ALTER table forum_tag DISABLE TRIGGER ALL;
38 ALTER table forum_markedtag DISABLE TRIGGER ALL;
39 ALTER table forum_node DISABLE TRIGGER ALL;
40 ALTER table forum_nodestate DISABLE TRIGGER ALL;
41 ALTER table forum_node_tags DISABLE TRIGGER ALL;
42 ALTER table forum_noderevision DISABLE TRIGGER ALL;
43 ALTER table forum_node_tags DISABLE TRIGGER ALL;
44 ALTER table forum_questionsubscription DISABLE TRIGGER ALL;
45 ALTER table forum_vote DISABLE TRIGGER ALL;
46 ALTER table forum_flag DISABLE TRIGGER ALL;
47 ALTER table forum_badge DISABLE TRIGGER ALL;
48 ALTER table forum_award DISABLE TRIGGER ALL;
49 ALTER table forum_openidnonce DISABLE TRIGGER ALL;
50 ALTER table forum_openidassociation DISABLE TRIGGER ALL;
53 PG_ENABLE_TRIGGERS = """
54 ALTER table auth_user ENABLE TRIGGER ALL;
55 ALTER table auth_user_groups ENABLE TRIGGER ALL;
56 ALTER table auth_user_user_permissions ENABLE TRIGGER ALL;
57 ALTER table forum_keyvalue ENABLE TRIGGER ALL;
58 ALTER table forum_action ENABLE TRIGGER ALL;
59 ALTER table forum_actionrepute ENABLE TRIGGER ALL;
60 ALTER table forum_subscriptionsettings ENABLE TRIGGER ALL;
61 ALTER table forum_validationhash ENABLE TRIGGER ALL;
62 ALTER table forum_authkeyuserassociation ENABLE TRIGGER ALL;
63 ALTER table forum_tag ENABLE TRIGGER ALL;
64 ALTER table forum_markedtag ENABLE TRIGGER ALL;
65 ALTER table forum_node ENABLE TRIGGER ALL;
66 ALTER table forum_nodestate ENABLE TRIGGER ALL;
67 ALTER table forum_node_tags ENABLE TRIGGER ALL;
68 ALTER table forum_noderevision ENABLE TRIGGER ALL;
69 ALTER table forum_node_tags ENABLE TRIGGER ALL;
70 ALTER table forum_questionsubscription ENABLE TRIGGER ALL;
71 ALTER table forum_vote ENABLE TRIGGER ALL;
72 ALTER table forum_flag ENABLE TRIGGER ALL;
73 ALTER table forum_badge ENABLE TRIGGER ALL;
74 ALTER table forum_award ENABLE TRIGGER ALL;
75 ALTER table forum_openidnonce ENABLE TRIGGER ALL;
76 ALTER table forum_openidassociation ENABLE TRIGGER ALL;