Skip to content

Commit 926398e

Browse files
authored
chore: Bump version to 0.1.1 and add create_all_tables property (#11)
1 parent c761f5d commit 926398e

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

py_spring_model/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
"Query",
1919
]
2020

21-
__version__ = "0.1.0"
21+
__version__ = "0.1.1"

py_spring_model/core/commons.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ class PySpringModelProperties(Properties):
3030
__key__ = "py_spring_model"
3131
model_file_postfix_patterns: set[str]
3232
sqlalchemy_database_uri: str
33+
create_all_tables: bool = True

py_spring_model/py_spring_model_provider.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ def _get_pyspring_model_inheritors(self) -> set[Type[object]]:
114114
return set(class_name_with_class_map.values())
115115

116116
def _create_all_tables(self) -> None:
117+
props = self._get_props()
118+
if not props.create_all_tables:
119+
logger.info("[SQLMODEL TABLE CREATION] Skip creating all tables, set create_all_tables to True to enable.")
120+
return
121+
117122
table_names = SQLModel.metadata.tables.keys()
118123
logger.success(
119124
f"[SQLMODEL TABLE CREATION] Create all SQLModel tables, engine url: {self.sql_engine.url}, tables: {', '.join(table_names)}"

0 commit comments

Comments
 (0)