-- 初始化 byai schema 和扩展
CREATE SCHEMA IF NOT EXISTS byai;
CREATE EXTENSION IF NOT EXISTS ltree;
CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE EXTENSION IF NOT EXISTS age;

-- 授权 gaussdb 用户访问 byai schema
GRANT ALL PRIVILEGES ON SCHEMA byai TO gaussdb;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA byai TO gaussdb;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA byai TO gaussdb;
ALTER DEFAULT PRIVILEGES IN SCHEMA byai GRANT ALL ON TABLES TO gaussdb;
ALTER DEFAULT PRIVILEGES IN SCHEMA byai GRANT ALL ON SEQUENCES TO gaussdb;
