-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move database to database provider from watermelondb
- Loading branch information
Showing
5 changed files
with
92 additions
and
112 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Database } from "@nozbe/watermelondb"; | ||
import SQLiteAdapter from "@nozbe/watermelondb/adapters/sqlite"; | ||
|
||
import migrations from "../model/migrations"; | ||
import Review from "../model/Review"; | ||
import schema from "../model/schema"; | ||
import Settings from "../model/Settings"; | ||
import Study from "../model/Study"; | ||
|
||
const adapter = new SQLiteAdapter({ | ||
schema, | ||
// (You might want to comment it out for development purposes -- see Migrations documentation) | ||
migrations, | ||
// (optional database name or file system path) | ||
// dbName: 'myapp', | ||
// (recommended option, should work flawlessly out of the box on iOS. On Android, | ||
// additional installation steps have to be taken - disable if you run into issues...) | ||
jsi: true /* Platform.OS === 'ios' */, | ||
// (optional, but you should implement this method) | ||
onSetUpError: (error) => { | ||
// Database failed to load -- offer the user to reload the app or log out | ||
} | ||
}); | ||
|
||
// Then, make a Watermelon database from it! | ||
const database = new Database({ | ||
adapter, | ||
modelClasses: [Review, Study, Settings] | ||
}); | ||
|
||
export default database; |