Skip to content

Commit 0299444

Browse files
authored
Merge pull request #28 from yoshidan/feature/skipAutoSetup
Add configuration parameter for skipping auto create database
2 parents c6310c3 + a5f2919 commit 0299444

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

config/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ type Config struct {
9898
DistributedTransaction bool `yaml:"distributed_transaction"`
9999
// map table name and configuration
100100
Tables map[string]*TableConfig `yaml:"tables"`
101+
// if true skip auto create database
102+
SkipAutoSetup bool `yaml:"skip_auto_setup"`
101103
}
102104

103105
// ShardColumnName column name of unique id for all shards

connection/connection.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,9 @@ func setupDBFromConfig(config *config.Config) error {
808808
if config == nil {
809809
return errors.New("cannot setup database connection. config is nil")
810810
}
811+
if config.SkipAutoSetup {
812+
return nil
813+
}
811814
for tableName, table := range config.Tables {
812815
var err error
813816
if table.IsShard {

0 commit comments

Comments
 (0)