vitess.io/vitess@v0.16.2/examples/demo/vschema_ddls.sql (about) 1 -- Unsharded Keyspace 2 alter vschema add table product.product; 3 4 -- Sharded Keyspace 5 alter vschema on customer.customer add vindex hash(customer_id) using hash; 6 7 -- Sequences 8 alter vschema add sequence product.customer_seq; 9 alter vschema on customer.customer add auto_increment customer_id using product.customer_seq; 10 11 -- Shared Vindexes and Foreign Keys 12 alter vschema on customer.corder add vindex hash(customer_id); 13 alter vschema add sequence product.corder_seq; 14 alter vschema on customer.corder add auto_increment corder_id using product.corder_seq; 15 16 -- Unique Lookup Vindexes 17 alter vschema add table product.corder_keyspace_idx; 18 alter vschema on customer.corder add vindex corder_keyspace_idx(corder_id) using consistent_lookup_unique with owner=`corder`, table=`product.corder_keyspace_idx`, from=`corder_id`, to=`keyspace_id`; 19 20 -- Non-Unique Lookup Vindexes 21 alter vschema on customer.oname_keyspace_idx add vindex unicode_loose_md5(oname) using unicode_loose_md5; 22 alter vschema on customer.corder add vindex oname_keyspace_idx(oname,corder_id) using consistent_lookup with owner=`corder`, table=`customer.oname_keyspace_idx`, from=`oname,corder_id`, to=`keyspace_id`; 23 24 -- Lookup as Primary Vindex 25 alter vschema add sequence product.corder_event_seq; 26 alter vschema on customer.corder_event add vindex corder_keyspace_idx(corder_id); 27 alter vschema on customer.corder_event add auto_increment corder_event_id using product.corder_event_seq; 28 -- Reversible Vindexes 29 alter vschema on customer.corder_event add vindex `binary`(keyspace_id) using `binary`;