add initial db schema and models
This commit is contained in:
parent
933dd9f105
commit
cd0c8c8afc
|
@ -11,6 +11,7 @@ import { FundingContext } from './context'
|
|||
import { cancelProfile } from './utils/fundProfiles'
|
||||
import MainCointainer from './components/MainCointainer'
|
||||
import { getTransfersMemo } from './selectors/pledging'
|
||||
import database from './db'
|
||||
|
||||
const { getNetworkType } = web3.eth.net
|
||||
|
||||
|
@ -41,6 +42,8 @@ class App extends React.Component {
|
|||
const allLpEvents = await getAllLPEvents()
|
||||
const vaultEvents = await getAllVaultEvents()
|
||||
const transfers = getTransfersMemo({ allLpEvents })
|
||||
const lpCollection = database.collections.get('lp_events')
|
||||
console.log({lpCollection})
|
||||
this.setState({
|
||||
account,
|
||||
network,
|
||||
|
|
|
@ -2,6 +2,7 @@ import { Database } from '@nozbe/watermelondb'
|
|||
import LokiJSAdapter from '@nozbe/watermelondb/adapters/lokijs'
|
||||
|
||||
import schema from './model/schema'
|
||||
import LpEvent from './model/lpEvents'
|
||||
|
||||
const adapter = new LokiJSAdapter({
|
||||
schema,
|
||||
|
@ -10,7 +11,9 @@ const adapter = new LokiJSAdapter({
|
|||
const database = new Database({
|
||||
adapter,
|
||||
modelClasses: [
|
||||
// Post, // ⬅️ You'll add Models to Watermelon here
|
||||
LpEvent
|
||||
],
|
||||
actionsEnabled: true,
|
||||
})
|
||||
|
||||
export default database
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import { Model } from '@nozbe/watermelondb'
|
||||
|
||||
export default class LpEvent extends Model {
|
||||
static table = 'lp_events'
|
||||
|
||||
@field('event_id') eventId
|
||||
@field('address') address
|
||||
@field('event') event
|
||||
|
||||
}
|
|
@ -3,6 +3,13 @@ import { appSchema, tableSchema } from '@nozbe/watermelondb'
|
|||
export default appSchema({
|
||||
version: 1,
|
||||
tables: [
|
||||
// tableSchemas go here...
|
||||
tableSchema({
|
||||
name: 'lp_events',
|
||||
columns: [
|
||||
{ name: 'address', type: 'string' },
|
||||
{ name: 'event', type: 'string' },
|
||||
{ name: 'event_id', type: 'string' },
|
||||
]
|
||||
})
|
||||
]
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue