Skip to content

Commit e1291e5

Browse files
committed
💡 enhance MySQL table prefix help message and clean up unused variables in transporter
1 parent 9a2d4ca commit e1291e5

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/sqlite3_to_mysql/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ def _validate_mysql_table_prefix(_: t.Any, __: t.Any, value: t.Optional[str]) ->
134134
"--mysql-table-prefix",
135135
default="",
136136
callback=_validate_mysql_table_prefix,
137-
help="Prefix to prepend to every created MySQL table (letters/numbers/underscores, must start with a letter).",
137+
help="MySQL table prefix must start with a letter and contain only letters, numbers, or underscores "
138+
"with a maximum length of 32 characters.",
138139
)
139140
@click.option(
140141
"--mysql-charset",

src/sqlite3_to_mysql/transporter.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -930,23 +930,21 @@ def _create_table(self, table_name: str, transfer_rowid: bool = False, skip_defa
930930
column["pk"] > 0 and column_type.startswith(("INT", "BIGINT")) and not compound_primary_key
931931
)
932932

933-
allow_expr_defaults: bool = getattr(self, "_allow_expr_defaults", False)
934-
is_mariadb: bool = getattr(self, "_is_mariadb", False)
935933
base_type: str = self._base_mysql_column_type(column_type)
936934

937935
# Build DEFAULT clause safely (preserve falsy defaults like 0/'')
938936
default_clause: str = ""
939937
if (
940938
not skip_default
941939
and column["dflt_value"] is not None
942-
and self._column_type_supports_default(base_type, allow_expr_defaults)
940+
and self._column_type_supports_default(base_type, self._allow_expr_defaults)
943941
and not auto_increment
944942
):
945943
td: str = self._translate_default_for_mysql(column_type, str(column["dflt_value"]))
946944
if td != "":
947945
stripped_td: str = td.strip()
948946
if base_type in MYSQL_TEXT_COLUMN_TYPES_WITH_JSON and stripped_td.upper() != "NULL":
949-
td = self._format_textual_default(stripped_td, allow_expr_defaults, is_mariadb)
947+
td = self._format_textual_default(stripped_td, self._allow_expr_defaults, self._is_mariadb)
950948
else:
951949
td = stripped_td
952950
default_clause = "DEFAULT " + td

0 commit comments

Comments
 (0)