From aa46bc486ebb0cb8141e20000f8f13e88802ae7a Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Sat, 20 Apr 2019 01:52:21 +0000 Subject: [PATCH] [db migrator] migrate the DB to latest schema when needed Signed-off-by: Ying Xie --- files/build_templates/docker_image_ctl.j2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index c2d227b43522..a828dfb4c296 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -59,6 +59,11 @@ function postStartAction() redis-cli -n 4 SET "CONFIG_DB_INITIALIZED" "1" fi + + if [[ -x /usr/bin/db_migrator.py ]]; then + # Migrate the DB to the latest schema version if needed + /usr/bin/db_migrator.py -o migrate + fi {%- elif docker_container_name == "swss" %} docker exec swss rm -f /ready # remove cruft if [[ "$BOOT_TYPE" == "fast" ]] && [[ -d /host/fast-reboot ]]; then