Skip to content

Instantly share code, notes, and snippets.

@oleersoy
Created March 30, 2019 23:11
Show Gist options
  • Select an option

  • Save oleersoy/35c06502757c521fd8ef524613048230 to your computer and use it in GitHub Desktop.

Select an option

Save oleersoy/35c06502757c521fd8ef524613048230 to your computer and use it in GitHub Desktop.
import Dexie from 'dexie';
class MyAppDatabase extends Dexie {
public users: Dexie.Table<User, number>;
public groups: Dexie.Table<Group, number>;
public usersInGroups: Dexie.Table<UserInGroup, [number, number]>;
constructor () {
super("MyAppDatabase");
this.version(1).stores({
users: '++id, name',
groups: '++id, name',
usersInGroups: '[userId+groupId],userId,groupId'
});
this.users = this.table('users');
this.groups = this.table('groups');
this.usersInGroups = this.table('usersInGroups');
}
}
const db = new MyAppDatabase();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment