)]}'
{"tools/psql-migrate-db.sh":[{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"ae3e7d46c272da1295369bb8905ba143f3a7827e","unresolved":false,"context_lines":[{"line_number":75,"context_line":"        command\u003d\"psql -t\""},{"line_number":76,"context_line":"    fi"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    PGPASSWORD\u003d$pass $command -h$host -U$user $db $* 2\u003e$LAST_PSQL_ERR"},{"line_number":79,"context_line":"}"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"function check_db() {"}],"source_content_type":"text/x-sh","patch_set":2,"id":"3f79a3b5_48d67af4","line":78,"range":{"start_line":78,"start_character":0,"end_line":78,"end_character":69},"updated":"2018-09-20 10:45:24.000000000","message":"In mysql:\nmysql --skip-column-names -hlocalhost -uroot -p1 nova_api\n\nIn psql:\nPGPASSWORD\u003d1 psql -t -hlocalhost -Uroot nova_api\n\nWe need use PGPASSWORD to set password in psql","commit_id":"2f0fb482489fcb2ca4ef7ec864bd1092f820030b"},{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"ae3e7d46c272da1295369bb8905ba143f3a7827e","unresolved":false,"context_lines":[{"line_number":101,"context_line":"        return 1"},{"line_number":102,"context_line":"    fi"},{"line_number":103,"context_line":""},{"line_number":104,"context_line":"    error_found\u003d$(cat $LAST_PSQL_ERR | grep ERROR)"},{"line_number":105,"context_line":"    if [ $? -eq 0 ]; then"},{"line_number":106,"context_line":"        # No schema"},{"line_number":107,"context_line":"        return 1"}],"source_content_type":"text/x-sh","patch_set":2,"id":"3f79a3b5_886c9236","line":104,"updated":"2018-09-20 10:45:24.000000000","message":"In mysql\n\necho \"SELECT COUNT(id) FROM inventories\" | mysql --skip-column-names -hlocalhost -uroot -p1 placement ; echo $?\nmysql: [Warning] Using a password on the command line interface can be insecure.\nERROR 1146 (42S02) at line 1: Table \u0027placement.inventories\u0027 doesn\u0027t exist\n1\n\nIn psql\necho \"SELECT COUNT(id) FROM inventories\" | PGPASSWORD\u003d1 psql -hlocalhost -Uroot placement ; echo $?\nERROR:  relation \"inventories\" does not exist\nLINE 1: SELECT COUNT(id) FROM inventories\n                              ^\n0\n\n\nif \"Have DB, but No schema\", there are different error code between mysql(return 1) and psql(return 0).\n\nSo, if return 0, in psql we need to ensure \"inventories\" exist or not.","commit_id":"2f0fb482489fcb2ca4ef7ec864bd1092f820030b"},{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"ae3e7d46c272da1295369bb8905ba143f3a7827e","unresolved":false,"context_lines":[{"line_number":127,"context_line":"    local tmpfile\u003d\"${tmpdir}/from-nova.sql\""},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"    echo \"Dumping from $source to $tmpfile\""},{"line_number":130,"context_line":"    psql_command $source pg_dump -t $PG_MIGRATE_TABLES \u003e $tmpfile || {"},{"line_number":131,"context_line":"        echo \u0027Failed to dump source database:\u0027"},{"line_number":132,"context_line":"        cat $LAST_PSQL_ERR"},{"line_number":133,"context_line":"        return 1"}],"source_content_type":"text/x-sh","patch_set":2,"id":"3f79a3b5_c8e5aaa5","line":130,"updated":"2018-09-20 10:45:24.000000000","message":"mysqldump NOVA_API allocations placement_aggregates consumers ....\n\npsql_dump NOVA_API -t \"allocations|placement_aggregates|consumers| ....\"","commit_id":"2f0fb482489fcb2ca4ef7ec864bd1092f820030b"},{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"ae3e7d46c272da1295369bb8905ba143f3a7827e","unresolved":false,"context_lines":[{"line_number":133,"context_line":"        return 1"},{"line_number":134,"context_line":"    }"},{"line_number":135,"context_line":"    echo \"Loading to $dest from $tmpfile\""},{"line_number":136,"context_line":"    psql_command $dest \u003c $tmpfile \u003e/dev/null || {"},{"line_number":137,"context_line":"        echo \u0027Failed to load destination database:\u0027"},{"line_number":138,"context_line":"        cat $LAST_PSQL_ERR"},{"line_number":139,"context_line":"        return 1"}],"source_content_type":"text/x-sh","patch_set":2,"id":"3f79a3b5_28c1bee4","line":136,"updated":"2018-09-20 10:45:24.000000000","message":"There are some output when loading file, so we redirect it to /dev/null\n\n\nroot@ubuntubase:~# ./psql-migrate-db.sh --migrate\nNova database contains data, placement database does not. Okay to proceed with migration\nDumping from NOVA_API to migrate-db.Z5miEWCm/from-nova.sql\nLoading to PLACEMENT from migrate-db.Z5miEWCm/from-nova.sql\nSET\nSET\n\n\nSET\nSET\nSET\nCREATE TABLE\nALTER TABLE\nCREATE SEQUENCE\nCREATE INDEX\nCREATE INDEX\nALTER TABLE","commit_id":"2f0fb482489fcb2ca4ef7ec864bd1092f820030b"}]}
