Mycat之ER表划分
假设现在有两张表orders和orders_detail
CREATE TABLE orders ( id INT AUTO_INCREMENT, order_type INT, customer_id INT, amount DECIMAL(10,2), PRIMARY KEY(id) )
CREATE TABLE order_detail ( id INT AUTO_INCREMENT, detail VARCHAR(2000), order_id INT, PRIMARY KEY(id) )
那么在schema.xml可以这么写
<table name="orders dataNode="dn1,dn2" rule="mod_rule">
<childTable name="orders_detail" primaryKey="id" joinKey="order_id" parentKey="id">
</table>