Skip to content

Commit

Permalink
Default does not initialize base tables.
Browse files Browse the repository at this point in the history
  • Loading branch information
gudaoxuri committed Oct 24, 2022
1 parent f3cecda commit c088841
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tardis/src/db/reldb_client.rs
Expand Up @@ -253,9 +253,7 @@ impl TardisRelDBClient {
url.port().unwrap_or(0),
min_connections
);
let client = TardisRelDBClient { con: Arc::new(con) };
client.init_basic_tables().await?;
Ok(client)
Ok(TardisRelDBClient { con: Arc::new(con) })
}

/// Get database instance implementation / 获取数据库实例的实现
Expand All @@ -271,7 +269,7 @@ impl TardisRelDBClient {
}

/// Initialize basic tables / 初始化基础表
async fn init_basic_tables(&self) -> TardisResult<()> {
pub async fn init_basic_tables(&self) -> TardisResult<()> {
trace!("[Tardis.RelDBClient] Initializing basic tables");
let tx = self.con.begin().await?;
let config_create_table_statements = tardis_db_config::ActiveModel::create_table_and_index_statement(self.con.get_database_backend());
Expand Down
2 changes: 2 additions & 0 deletions tardis/tests/test_reldb_client.rs
Expand Up @@ -24,6 +24,8 @@ async fn test_reldb_client() -> TardisResult<()> {
TardisTestContainer::mysql(None, |url| async move {
let client = TardisRelDBClient::init(&url, 10, 5, None, None).await?;

client.init_basic_tables().await?;

test_basic(&client).await?;
test_rel(&client).await?;
test_transaction(&client).await?;
Expand Down

0 comments on commit c088841

Please sign in to comment.