A Migration is a set of instructions to Realm on how you want to go from one schema version to the next. Annyce gets you started on unlocking their potential in this video.
- [ Instructor] A migration is a set of instructions…to Realm on how you want to go…from one schema version to the next.…For instance, what if you had the following schema…defined with a user object that only had a name?…Then later it's decided that you need…to add a boolean field to the user class…which contains whether the user is active or not.…Making these types of changes without a migration…would leave Realm confused.…
If you recall, Realm keeps track of all the objects…associated with any given database.…As well as a listing of all fields…and their respective types.…As a result, when Realm does not have instructions…for migrating to a new schema version,…then it will throw an exception and crash your application.…Instead, you should create a migration class.…This class implements the Realm Migration Interface…and it's one method, migrate.…
The inputs to the migrate method are the Realm schema…on which to perform the migration,…the schema version of the Realm…at the start of the migration,…and the schema version of the Realm…
To begin, Annyce Davis reviews using the de facto data persistence solution available on Android: SQLite. She takes you through basic SQLite concepts—such as how to create a database wrapper and insert data into a table—as well as a few more advanced topics. Next, she covers working with Cupboard, an open-source project dedicated to simplifying your SQLite interactions. To wrap up, she dives into working with Realm, an object database solution designed with mobile devices in mind. Throughout the course, Annyce discusses establishing relationships between database tables, creating and running queries, as well as performing data migrations.
- Overview of SQLite
- Defining a database table's schema
- Exploring SQLite create table syntax
- Executing create table statements
- Inserting data with a foreign key relation
- Inspecting the database using a terminal
- Updating and deleting records
- Working with Cupboard
- Working with Realm
Skill Level Intermediate
Android App Development: Unit Testingwith James P White2h 59m Intermediate
1. SQLite Basics
2. SQLite Beyond the Basics
3. Working with Cupboard
4. Realm Basics
5. Realm Beyond the Basics
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.