GetDutchie / brick

An intuitive way to work with persistent data in Dart

Home Page:https://getdutchie.github.io/brick/#/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No Support for Realm - A More Fully-Featured DB for Resource Constrained Environments

MarcusSorealheis opened this issue · comments

Hi all, I noticed that this project, which I love, is built purely for SQLite. The integration is tightly coupled. For more companies to adopt this project, it could be good if the DB choice could be left to the user.

I'd like to propose adding Realm. Is that something that the team would be:

  1. Open to
  2. Willing to review and/or guide my naïve implementation? i'm a PM, Dutchie fan, and not regularly working on Realm
  3. Open to chatting with someone from the Realm team?

I suspect you might've already done 3, so ignore that request if so. I rather talk via GitHub myself.

Hey @MarcusSorealheis thanks for using Brick and opening this issue.

I haven't used Realm since 2015 and haven't reviewed much since. A couple questions about it in its modern implementation:

  1. Can you programmatically create the data storage interface? Such as CREATE TABLE User IF NONE EXISTS or ALTER TABLE User ADD name?
  2. Is Realm's Flutter SDK insufficient?
  3. What advantage does Realm have over SQLite for a Brick user (since almost all of Brick's end-user interactions are in Dart)?

I will leave my colleague @ianpward to answer questions 2 and 3 as he will be able to provide the most comprehensive answer. Although, the specifics for number 2 may require more details. What motivates the question? What data types need be supported? I expect that the Flutter SDK will be evolving over the course of this dance, and others, to close gaps where we identify inefficiency.

The answer to number 1 is broadly you have a few different options. Check out the React to Changes docs. There are some cool APIs for versioning schemas and things. I need to find them in the AM.

thanks Marcus - hey @tshedor - glad to meet another Realm user! To answer your questions -

  1. Realm instantiates the schema at compile time by inferring it from your object model definitions. So you do not need to write or maintain any schema DDL code yourself. You can see it here -
    https://www.mongodb.com/docs/realm/sdk/flutter/realm-database/define-realm-object-schema/#many-to-one
    Realm also has the ability migrate any schema simply by adding or removing a field - it changes the underlying data store schema for you based on your object model definition.

  2. I believe it is sufficient but I would love to pick your brain on your GraphQL integration and how you accomplished offline. Apollo is reaching out and I would to hear from you on where the dragons are - it would be great to chat, I'm at ian.ward@mongodb.com

  3. This is a pretty slick interface, great work; one thing I might point out is that because Realm is an object database there are native object relationships to related entitles in addition to dictionaries and sets. Realm also automatically syncs to cloud - which is part of the reason I'd like to understand how this is accomplished with GraphQL... the team is also asking about your experience with the FFI layer

Hope to connect!

@ianpward since you and I have connected directly via email, I'm going to close this issue out. Looking forward to working together