I'm writing a plugin for Nylas to send to-dos to Wunderlist, and I would like to persist some data related to the Wunderlist account locally.
I've seen other plugins use localStorage to store that stuff, but I was thinking it'd be better to use the DB if it's there! Is it possible to create custom tables in the DB at all?
What I tried:
I created a class called Root, which extends Nylas' Model, I registered it in the DatabaseObjectRegistry, and I'm trying to persist it with:
let root = new Root({/* ... */})
DatabaseStore.inTransaction(t => t.persistModel(root))
But I get this error:
Error: DatabaseStore: Query REPLACE INTO Root [...] failed
Error: Failed to construct SQL statement (no such table: Root)
Root.js
import { Attributes, Model } from 'nylas-exports'
export default class Root extends Model {
static attributes = Object.assign({}, Model.attributes, {
// define some attributes here...
})
}
I tried this stuff by exploring the code myself, so I have no idea if this is possible at all...
This might be related to #3297 where I can use the Task because it doesn't seem to be registered.
I'm writing a plugin for Nylas to send to-dos to Wunderlist, and I would like to persist some data related to the Wunderlist account locally.
I've seen other plugins use localStorage to store that stuff, but I was thinking it'd be better to use the DB if it's there! Is it possible to create custom tables in the DB at all?
What I tried:
I created a class called
Root
, which extends Nylas'Model
, I registered it in theDatabaseObjectRegistry
, and I'm trying to persist it with:But I get this error:
Root.js
main.es6
I tried this stuff by exploring the code myself, so I have no idea if this is possible at all...
This might be related to #3297 where I can use the
Task
because it doesn't seem to be registered.