#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

spring.shardingsphere.datasource.names=ds-0,ds-1

spring.shardingsphere.datasource.ds-0.jdbc-url=jdbc:mysql://localhost:3306/demo_ds_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
spring.shardingsphere.datasource.ds-0.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.ds-0.driver-class-name=com.mysql.jdbc.Driver
spring.shardingsphere.datasource.ds-0.username=root
spring.shardingsphere.datasource.ds-0.password=apijson

spring.shardingsphere.datasource.ds-1.jdbc-url=jdbc:mysql://localhost:3306/demo_ds_1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
spring.shardingsphere.datasource.ds-1.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.ds-1.driver-class-name=com.mysql.jdbc.Driver
spring.shardingsphere.datasource.ds-1.username=root
spring.shardingsphere.datasource.ds-1.password=apijson

spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-column=id
spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-algorithm-name=database-inline
spring.shardingsphere.rules.sharding.binding-tables[0]=Moment,Comment

spring.shardingsphere.rules.sharding.autotables.Moment.actual-datasources=ds-${0..1}

spring.shardingsphere.rules.sharding.auto-tables.Moment.sharding-strategy.standard.sharding-column=id
spring.shardingsphere.rules.sharding.auto-tables.Moment.sharding-strategy.standard.sharding-algorithm-name=auto-mod

spring.shardingsphere.rules.sharding.auto-tables.Moment.key-generate-strategy.column=userId
spring.shardingsphere.rules.sharding.auto-tables.Moment.key-generate-strategy.key-generator-name=snowflake

spring.shardingsphere.rules.sharding.auto-tables.Comment.actual-datasources=ds-${0..1}

spring.shardingsphere.rules.sharding.auto-tables.Comment.sharding-strategy.standard.sharding-column=id
spring.shardingsphere.rules.sharding.auto-tables.Comment.sharding-strategy.standard.sharding-algorithm-name=auto-mod

spring.shardingsphere.rules.sharding.auto-tables.Comment.key-generate-strategy.column=id
spring.shardingsphere.rules.sharding.auto-tables.Comment.key-generate-strategy.key-generator-name=snowflake

spring.shardingsphere.rules.sharding.sharding-algorithms.auto-mod.type=mod
spring.shardingsphere.rules.sharding.sharding-algorithms.auto-mod.props.sharding-count=4

spring.shardingsphere.rules.sharding.key-generators.snowflake.type=SNOWFLAKE
