Entity-Relationship Diagram

Pixel Create: Data Model

Database schema and entity relationships for Pixel Create

updated-erd-diagram

Entity-Relationship Diagram

This ERD represents the database structure for the Pixel Create pixel art application, designed to support local persistence using Room Database with potential for cloud synchronization.

For detailed descriptions and source code links for all entity classes and DAO interfaces, see the Entity Classes page.

Entity Descriptions

Core Entities

User

Stores user account information, authentication details, and personalized settings that persist across devices.

Key Attributes:

Relationships:


Project

The central entity representing a pixel art creation. Contains metadata about canvas size, timestamps, and thumbnail preview.

Key Attributes:

Relationships:


Layer

Represents individual drawing layers within a project, supporting complex artwork with stacking and visibility controls.

Key Attributes:

Relationships:


Pixel

Stores individual pixel color data. Each pixel is tied to a specific layer and position.

Key Attributes:

Relationships:

Design Note: For large canvases, storing each pixel individually may require optimization (e.g., sparse storage for transparent pixels, compression, or delta encoding).


Color Management

Palette

User-created color collections for consistent artwork styling.

Key Attributes:

Relationships:


PaletteColor

Individual colors within a palette.

Key Attributes:

Relationships:


Data Persistence & History

AutosaveSnapshot

Periodic backups of project state to prevent data loss.

Key Attributes:

Relationships:

Design Note: Consider retention policy (e.g., keep last 10 snapshots, delete older than 30 days).


ExportHistory

Logs every export operation for tracking and re-export functionality.

Key Attributes:

Relationships:


Relationship Cardinalities

Relationship Cardinality Description
User → Project 1:N One user creates many projects
User → Palette 1:N One user creates many palettes
Project → Layer 1:N One project has many layers (minimum 1)
Layer → Pixel 1:N One layer contains many pixels
Project → AutosaveSnapshot 1:N One project has many snapshots
Project → ExportHistory 1:N One project has many export records
Palette → PaletteColor 1:N One palette contains many colors (minimum 1)

Database Schema Location

The Room database schema is stored in:

app/schemas/edu.cnm.deepdive.myproject.service.LocalDatabase/1.json

DDL output location (configured in build.gradle.kts):

docs/sql/ddl.sql

Design Considerations

Normalization

The schema follows 3NF (Third Normal Form):

Indexing Recommendations

Performance Optimizations

Future Extensions (Stretch Goals)

If animation features are added:

If collaboration features are added: