41 lines
1.4 KiB
SQL
41 lines
1.4 KiB
SQL
CREATE TABLE IF NOT EXISTS rsplat.splats (
|
|
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
slug TEXT NOT NULL UNIQUE,
|
|
title TEXT NOT NULL,
|
|
description TEXT,
|
|
file_path TEXT NOT NULL,
|
|
file_format TEXT NOT NULL DEFAULT 'ply',
|
|
file_size_bytes BIGINT DEFAULT 0,
|
|
tags TEXT[] DEFAULT '{}',
|
|
space_slug TEXT NOT NULL DEFAULT 'demo',
|
|
contributor_id TEXT,
|
|
contributor_name TEXT,
|
|
source TEXT DEFAULT 'upload',
|
|
status TEXT NOT NULL DEFAULT 'published',
|
|
view_count INTEGER DEFAULT 0,
|
|
payment_tx TEXT,
|
|
payment_network TEXT,
|
|
processing_status TEXT DEFAULT 'ready',
|
|
processing_error TEXT,
|
|
source_file_count INTEGER DEFAULT 0,
|
|
created_at TIMESTAMPTZ DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_splats_space ON rsplat.splats (space_slug);
|
|
CREATE INDEX IF NOT EXISTS idx_splats_slug ON rsplat.splats (slug);
|
|
CREATE INDEX IF NOT EXISTS idx_splats_status ON rsplat.splats (status);
|
|
CREATE INDEX IF NOT EXISTS idx_splats_created ON rsplat.splats (created_at DESC);
|
|
|
|
-- Source files table (photos/video uploaded for splatting)
|
|
CREATE TABLE IF NOT EXISTS rsplat.source_files (
|
|
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
splat_id UUID REFERENCES rsplat.splats(id) ON DELETE CASCADE,
|
|
file_path TEXT NOT NULL,
|
|
file_name TEXT NOT NULL,
|
|
mime_type TEXT,
|
|
file_size_bytes BIGINT DEFAULT 0,
|
|
created_at TIMESTAMPTZ DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_source_files_splat ON rsplat.source_files (splat_id);
|