diff --git a/db/app_uoj233.sql b/db/app_uoj233.sql index 806f345..1d2c42f 100644 --- a/db/app_uoj233.sql +++ b/db/app_uoj233.sql @@ -995,7 +995,8 @@ INSERT INTO `upgrades` (`name`, `status`, `updated_at`) VALUES ('21_problem_difficulty', 'up', now()), ('28_remote_judge', 'up', now()), ('31_problem_resources', 'up', now()), - ('36_decimal_score_range', 'up', now()); + ('36_decimal_score_range', 'up', now()), + ('40_contest_resources', 'up', now()); /*!40000 ALTER TABLE `upgrades` ENABLE KEYS */; UNLOCK TABLES; diff --git a/web/app/upgrade/40_contest_resources/up.sql b/web/app/upgrade/40_contest_resources/up.sql new file mode 100644 index 0000000..760bfc3 --- /dev/null +++ b/web/app/upgrade/40_contest_resources/up.sql @@ -0,0 +1 @@ +ALTER TABLE `contests` MODIFY `extra_config` json NOT NULL; diff --git a/web/app/upgrade/40_contest_resources/upgrade.php b/web/app/upgrade/40_contest_resources/upgrade.php new file mode 100644 index 0000000..6d51321 --- /dev/null +++ b/web/app/upgrade/40_contest_resources/upgrade.php @@ -0,0 +1,37 @@ + $link[0], + 'url' => '/blogs/' . $link[1], + ]; + } + + $extra_config['links'] = $new_links; + } + + DB::update([ + "update contests", + "set", [ + "extra_config" => json_encode($extra_config, JSON_FORCE_OBJECT), + ], + "where", [ + "id" => $contest['id'], + ], + ]); + } + } +};