Add db-migrator to CSIT tests
[policy/docker.git] / csit / db_migrator_policy_init.sh
1 #!/bin/sh
2 # ============LICENSE_START====================================================
3 #  Copyright (C) 2021 Nordix Foundation.
4 # =============================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #      http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END======================================================
19
20 export POLICY_HOME=/opt/app/policy
21 export SQL_USER=${MYSQL_USER}
22 export SQL_PASSWORD=${MYSQL_PASSWORD}
23
24 /opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB}
25
26 /opt/app/policy/bin/db-migrator -s ${SQL_DB} -o report
27
28 /opt/app/policy/bin/db-migrator -s ${SQL_DB} -o upgrade
29 rc=$?
30
31 /opt/app/policy/bin/db-migrator -s ${SQL_DB} -o report
32
33 nc -l -p 6824
34
35 exit $rc