Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function newDatabase() {
const adapter = new LokiJSAdapter({
schema,
});
const database = new Database({
actionsEnabled: true,
adapter,
// @ts-ignore
modelClasses: [Todo, User],
});
return database;
}
import {Injectable} from '@angular/core';
import {Database} from '@nozbe/watermelondb';
import LokiJSAdapter from '@nozbe/watermelondb/adapters/lokijs';
import schema from './schema';
import TaskMelon from './task';
import {Observable} from 'rxjs';
// First, create the adapter to the underlying database:
// const adapter = new SQLiteAdapter({
// schema,
// })
const adapter = new LokiJSAdapter({
schema,
});
const modelClasses = [
TaskMelon as any,
];
@Injectable({
providedIn: 'root'
})
export class WatermelonService {
db = new Database({
adapter,
modelClasses,
actionsEnabled: true,
import React from 'react'
import { render } from 'react-dom'
import { Database } from '@nozbe/watermelondb'
import LokiJSAdapter from '@nozbe/watermelondb/adapters/lokijs'
import DatabaseProvider from '@nozbe/watermelondb/DatabaseProvider'
import { mySchema } from 'models/schema'
import Blog from 'models/Blog'
import Post from 'models/Post'
import Comment from 'models/Comment'
import Root from 'components/Root'
const adapter = new LokiJSAdapter({
dbName: 'WatermelonDemo',
schema: mySchema,
})
const database = new Database({
adapter,
modelClasses: [Blog, Post, Comment],
actionsEnabled: true,
})
render(
, document.getElementById('application')
)
import { Database } from '@nozbe/watermelondb'
import LokiJSAdapter from '@nozbe/watermelondb/adapters/lokijs'
import schema from './model/schema'
import LpEvent from './model/lpEvents'
import VaultEvent from './model/vaultEvent'
import Profile from './model/profile'
import Pledge from './model/pledge'
import Delegate from './model/delegate'
const dbName = 'LiquidFunding'
const adapter = new LokiJSAdapter({
dbName,
schema,
})
const database = new Database({
adapter,
modelClasses: [
LpEvent,
VaultEvent,
Profile,
Pledge,
Delegate
],
actionsEnabled: true,
})