44 lines
1.2 KiB
SQL
44 lines
1.2 KiB
SQL
-- Main collections table with ALL Collection struct fields
|
|
CREATE TABLE IF NOT EXISTS maplefile.collections_by_id (
|
|
-- Identifiers
|
|
id UUID PRIMARY KEY,
|
|
owner_id UUID,
|
|
|
|
-- Encryption and Content Details
|
|
encrypted_name TEXT,
|
|
collection_type TEXT,
|
|
encrypted_collection_key TEXT,
|
|
|
|
-- Custom icon (emoji or predefined icon identifier, encrypted)
|
|
-- Empty string = default folder icon
|
|
-- Emoji character (e.g., "📷") = display as emoji
|
|
-- Icon identifier (e.g., "icon:briefcase") = predefined Heroicon
|
|
encrypted_custom_icon TEXT,
|
|
|
|
-- Hierarchical structure fields
|
|
parent_id UUID,
|
|
ancestor_ids TEXT, -- JSON array of UUIDs
|
|
|
|
-- File count for performance optimization
|
|
file_count BIGINT,
|
|
|
|
-- Tags assigned to this collection (embedded tag data as JSON)
|
|
tags TEXT,
|
|
|
|
-- Ownership, timestamps and conflict resolution
|
|
created_at TIMESTAMP,
|
|
created_by_user_id UUID,
|
|
modified_at TIMESTAMP,
|
|
modified_by_user_id UUID,
|
|
version BIGINT,
|
|
|
|
-- State management
|
|
state TEXT,
|
|
tombstone_version BIGINT,
|
|
tombstone_expiry TIMESTAMP,
|
|
|
|
-- IP tracking for GDPR compliance
|
|
created_from_ip_address TEXT,
|
|
modified_from_ip_address TEXT,
|
|
ip_anonymized_at TIMESTAMP
|
|
);
|