Created
March 30, 2019 23:11
-
-
Save oleersoy/35c06502757c521fd8ef524613048230 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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