Skip to content

Commit

Permalink
feat: change user table to match mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
oh2024 committed May 28, 2024
1 parent 59d79f6 commit b9275fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
8 changes: 2 additions & 6 deletions src/nameserver/name_server_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1391,12 +1391,8 @@ base::Status NameServerImpl::PutUserRecord(const std::string& host, const std::s
row_values.push_back(user);
row_values.push_back(password);
row_values.push_back("0"); // password_last_changed
row_values.push_back("0"); // password_expired_time
row_values.push_back("0"); // create_time
row_values.push_back("0"); // update_time
row_values.push_back("1"); // account_type
row_values.push_back("0"); // privileges
row_values.push_back("null"); // extra_info
row_values.push_back("0"); // password_expired
row_values.push_back("false"); // Create_user_priv

std::string encoded_row;
codec::RowCodec::EncodeRow(row_values, table_info->column_desc(), 1, encoded_row);
Expand Down
18 changes: 7 additions & 11 deletions src/nameserver/system_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,16 @@ class SystemTable {
break;
}
case SystemTableType::kUser: {
SetColumnDesc("host", type::DataType::kString, table_info->add_column_desc());
SetColumnDesc("user", type::DataType::kString, table_info->add_column_desc());
SetColumnDesc("password", type::DataType::kString, table_info->add_column_desc());
SetColumnDesc("Host", type::DataType::kString, table_info->add_column_desc());
SetColumnDesc("User", type::DataType::kString, table_info->add_column_desc());
SetColumnDesc("authentication_string", type::DataType::kString, table_info->add_column_desc());
SetColumnDesc("password_last_changed", type::DataType::kTimestamp, table_info->add_column_desc());
SetColumnDesc("password_expired_time", type::DataType::kBigInt, table_info->add_column_desc());
SetColumnDesc("create_time", type::DataType::kTimestamp, table_info->add_column_desc());
SetColumnDesc("update_time", type::DataType::kTimestamp, table_info->add_column_desc());
SetColumnDesc("account_type", type::DataType::kInt, table_info->add_column_desc());
SetColumnDesc("privileges", type::DataType::kString, table_info->add_column_desc());
SetColumnDesc("extra_info", type::DataType::kString, table_info->add_column_desc());
SetColumnDesc("password_expired", type::DataType::kTimestamp, table_info->add_column_desc());
SetColumnDesc("Create_user_priv", type::DataType::kBool, table_info->add_column_desc());
auto index = table_info->add_column_key();
index->set_index_name("index");
index->add_col_name("host");
index->add_col_name("user");
index->add_col_name("Host");
index->add_col_name("User");
auto ttl = index->mutable_ttl();
ttl->set_ttl_type(::openmldb::type::kLatestTime);
ttl->set_lat_ttl(1);
Expand Down

0 comments on commit b9275fd

Please sign in to comment.