-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_metadata_table.sql
More file actions
38 lines (30 loc) · 1.47 KB
/
create_metadata_table.sql
File metadata and controls
38 lines (30 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
-- Create metadata_sagar table for storing file processing metadata
-- Run this query in your Supabase SQL Editor
CREATE TABLE IF NOT EXISTS metadata_sagar (
id BIGSERIAL PRIMARY KEY,
original_filename TEXT NOT NULL,
processed_file_location TEXT NOT NULL,
status TEXT NOT NULL DEFAULT 'pending',
file_type TEXT,
metadata_payload JSONB,
geom TEXT, -- WKT geometry string (e.g., POLYGON for bounding boxes)
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW()
);
-- Create an index on processed_file_location for faster lookups
CREATE INDEX IF NOT EXISTS idx_metadata_sagar_processed_file_location
ON metadata_sagar(processed_file_location);
-- Create an index on status for filtering
CREATE INDEX IF NOT EXISTS idx_metadata_sagar_status
ON metadata_sagar(status);
-- Create an index on created_at for sorting
CREATE INDEX IF NOT EXISTS idx_metadata_sagar_created_at
ON metadata_sagar(created_at DESC);
-- Optional: Enable Row Level Security (RLS) if needed
-- ALTER TABLE metadata_sagar ENABLE ROW LEVEL SECURITY;
-- Optional: Create a policy to allow all operations (adjust as needed for your security requirements)
-- CREATE POLICY "Allow all operations on metadata_sagar"
-- ON metadata_sagar FOR ALL
-- USING (true)
-- WITH CHECK (true);
COMMENT ON TABLE metadata_sagar IS 'Stores metadata for processed data files including original filename, processed file location, status, file type, metadata payload, and geometry information';