Skip to content

Commit

Permalink
Merge pull request #1784 from adnankattekaden/dev
Browse files Browse the repository at this point in the history
alter edit 1.42
  • Loading branch information
adnankattekaden authored Dec 9, 2023
2 parents f02826d + 57b3acb commit 7700e9b
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions alter-scripts/alter-1.42.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,28 @@ def insert_colleges(clgdata):
for org_id, lvl in clgdata.items():
execute(f"""
INSERT INTO college (id, level, org_id, updated_by, updated_at, created_by, created_at)
VALUES ('{uuid.uuid4()}', '{lvl}', '{org_id}', '{user_id}', NOW(), '{user_id}', NOW())
VALUES ('{uuid.uuid4()}', '{lvl}', '{org_id}', '{user_id}',UTC_TIMESTAMP(), '{user_id}', UTC_TIMESTAMP())
""")

execute(f"""
INSERT INTO college (id, level, org_id, updated_by, updated_at, created_by, created_at)
SELECT
UUID(),
0 AS level,
org.id AS org_id,
'{user_id}',
UTC_TIMESTAMP(),
'{user_id}',
UTC_TIMESTAMP()
FROM organization AS org
WHERE org.org_type = '{OrganizationType.COLLEGE.value}'
AND org.id NOT IN (SELECT org_id FROM college);
""")
return


if __name__ == "__main__":
data = clg_levels_check()
delete_colleges()
insert_colleges(data)
execute("UPDATE system_setting SET value = '1.42', updated_at = now() WHERE `key` = 'db.version';")
# execute("UPDATE system_setting SET value = '1.42', updated_at = now() WHERE `key` = 'db.version';")

0 comments on commit 7700e9b

Please sign in to comment.