-- Create the main database
DO
$$
BEGIN
    IF NOT EXISTS (
        SELECT FROM pg_database WHERE datname = 'embeddings_db'
    ) THEN
        PERFORM dblink_exec('dbname=' || current_database(), 'CREATE DATABASE embeddings_db');
    END IF;
END
$$;

-- Connect to the newly created database
\c embeddings_db
CREATE EXTENSION IF NOT EXISTS vector;