Remove decode call from db migrations script

This is a follow up on 'py3 only' changes. Previously in py2
current_name variable had unicode type, however in py3 it is
a str type which leads to an Attribute error when the code
is executed by py3 ('str' object has no attribute 'decode').

Now when refstack is py3 only, we don't need to be decoding
current_name variable, the patch removes this conversion.

More about str and unicode and their meaning in py2 and py3:
 * https://portingguide.readthedocs.io/en/latest/strings.html

Change-Id: Ibc76a8797b467d45b05c6e6e61d4bc703a5d701f
This commit is contained in:
Martin Kopec 2021-01-28 19:00:06 +00:00
parent 94b1fa594f
commit 23fcee1239
1 changed files with 0 additions and 2 deletions

View File

@ -80,7 +80,6 @@ def get_db_tables(conn):
current_name =\ current_name =\
next((table for table in result if table != "alembic_version"), next((table for table in result if table != "alembic_version"),
result[0]) result[0])
current_name = current_name.decode('utf-8')
current_version = get_table_version(conn, current_name) current_version = get_table_version(conn, current_name)
default_name =\ default_name =\
next((table for table in result next((table for table in result
@ -93,7 +92,6 @@ def get_db_tables(conn):
current_name = next((table for table in result current_name = next((table for table in result
if table != current_name), if table != current_name),
result[0]) result[0])
current_name = current_name.decode('utf-8')
elif current_name: elif current_name:
# this is the case where the current-named table # this is the case where the current-named table
# exists, but is empty # exists, but is empty