Skip to main content

Overview

Simple Manager Mobile uses SQLite as its local database, providing offline-first data storage through the Expo SQLite library.

Database Configuration

The database is initialized using Expo SQLite with a synchronous connection:

Database Details

string
simple_manager.db
string
Local device storage managed by Expo SQLite
string
Synchronous connection using openDatabaseSync()

Schema

The database contains a single primary table for storing records:

Records Table

Usage

Once the database connection is established, you can use it throughout your application:

Key Features

Offline-First

All data is stored locally on the device, allowing the app to function without an internet connection.

Synchronous Operations

Using openDatabaseSync() provides a simpler API for database operations without dealing with promises or callbacks.

Soft Deletes

Records are not permanently deleted but marked with isDeleted = 1, enabling data recovery and audit trails.

Flexible Metadata

The metadata TEXT field allows storing JSON or other structured data for extensibility.

Best Practices

  1. Use parameterized queries: Always use placeholders (?) to prevent SQL injection
  2. Handle errors: Wrap database operations in try-catch blocks
  3. Maintain indexes: Consider adding indexes for frequently queried fields
  4. Backup data: Implement backup strategies for important user data
  5. Migration strategy: Plan for schema changes in future versions

Example: Complete CRUD Operations