how can i create a table with 2 primary key with $cordovaSQLite?
My code:
$cordovaSQLite.execute(db, 'CREATE TABLE IF NOT EXISTS mytable(id INTEGER PRIMARY KEY AUTOINCREMENT, num INTEGER PRIMARY KEY, text TEXT)');
It is possibile?
how can i create a table with 2 primary key with $cordovaSQLite?
My code:
$cordovaSQLite.execute(db, 'CREATE TABLE IF NOT EXISTS mytable(id INTEGER PRIMARY KEY AUTOINCREMENT, num INTEGER PRIMARY KEY, text TEXT)');
It is possibile?
Setting two primary keys is not possible, but you can set a unique constraint on any fields you want to act like a primary key. You can emulate autoincrementing on this field by looking at this question: SQLite auto-increment non-primary key field. Hope this helps.