How to use the @nozbe/watermelondb.appSchema function in @nozbe/watermelondb

To help you get started, we’ve selected a few @nozbe/watermelondb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Nozbe / WatermelonDB / examples / web / src / models / schema.js View on Github external
import { appSchema, tableSchema } from '@nozbe/watermelondb'

export const mySchema = appSchema({
  version: 2,
  tables: [
    tableSchema({
      name: 'blogs',
      columns: [{ name: 'name', type: 'string' }],
    }),
    tableSchema({
      name: 'posts',
      columns: [
        { name: 'title', type: 'string' },
        { name: 'subtitle', type: 'string' },
        { name: 'body', type: 'string' },
        { name: 'blog_id', type: 'string', isIndexed: true },
      ],
    }),
    tableSchema({
github AliAllaf / firemelon / src / utils / schema.ts View on Github external
import { appSchema, Database, Model, tableSchema } from '@nozbe/watermelondb';
import LokiJSAdapter from '@nozbe/watermelondb/adapters/lokijs';
import { field } from '@nozbe/watermelondb/decorators';

export const schema = appSchema({
    tables: [
        tableSchema({
            columns: [
                { name: 'text', type: 'string', isIndexed: true },
                { name: 'color', type: 'string', isIndexed: true },
            ],
            name: 'todos',
        }),
        tableSchema({
            columns: [{ name: 'name', type: 'string', isIndexed: true }],
            name: 'users',
        }),
    ],
    version: 1,
});