CREATE TABLE IF NOT EXISTS files (
    id BIGSERIAL,
    file_name VARCHAR(255) NOT NULL,
    file_key VARCHAR(500) NOT NULL UNIQUE,
    created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id)
);

COMMENT ON TABLE files IS 'Files table for storing uploaded files';

COMMENT ON COLUMN files.id IS 'Unique identifier for the file';
COMMENT ON COLUMN files.file_name IS 'Name of the uploaded file';
COMMENT ON COLUMN files.file_key IS 'Unique key for the file storage';
COMMENT ON COLUMN files.created_at IS 'Timestamp when the file was uploaded';

CREATE INDEX idx_files_created_at ON files(created_at);