当用ydn-db定义模式时,我可以用以下代码将单个列定义为PK:
var products = {
name: 'products',
keyPath: 'id_product',
autoIncrement: true,
indexes: [
{keyPath: 'id_product'},
{keyPath: 'id_supplier'}
]
};
var schema = {
stores: [products]
};如何定义一个带有两个或更多列的PK的Store (表)?谢谢
发布于 2013-08-25 08:58:42
如何定义一个带有两个或更多列的PK的Store (表)?
我不能肯定回答你的问题。IndexedDB (ynd非常以IDB为中心)只能有一个PK。但是,主键可以是多个keyPath (列)使用阵列键盘的复合键组合。它是这样定义的
var products = {
name: 'products',
keyPath: ['id_category', id_product']
};https://stackoverflow.com/questions/18427089
复制相似问题