web3.db-fileconnector
Version:
GraphQL System Built on web3 technologies. Web3.DB is an open database built on top of web3 technologies. It is a decentralized, open-source database that allows users to store and query data in a secure and efficient manner. The system is designed to be
99 lines (65 loc) • 2.78 kB
Markdown
# PostgreSQL Permission Commands
**⚠️ CRITICAL SETUP REQUIRED**: These permissions are **MANDATORY** for web3.db-fileconnector to function properly.
## Why These Permissions Are Essential
1. **Data Operations**: Create, read, update, delete operations on Ceramic data
2. **Schema Management**: Dynamic table creation for new data models
3. **Vector Extensions**: pgvector operations for similarity search
4. **Ceramic Sync**: Proper synchronization with the Ceramic network
5. **Security**: Controlled access while maintaining functionality
## Quick Setup (Recommended)
```bash
# Run the automated permission script
psql -U postgres -d ceramic -f fix-postgres-permissions.sql
```
## Manual Setup
Run the following commands in your PostgreSQL terminal to grant the necessary permissions to the 'admin' user for the 'ceramic' database:
```sql
-- Connect to PostgreSQL as superuser (usually 'postgres')
psql -U postgres
-- Once connected to PostgreSQL, run these commands:
-- Connect to the ceramic database
\c ceramic
-- Grant usage on schema
GRANT USAGE ON SCHEMA public TO admin;
-- Grant create on schema
GRANT CREATE ON SCHEMA public TO admin;
-- Grant all privileges on all tables
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO admin;
-- Make privileges apply to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO admin;
-- Make admin the owner of the database (optional but recommended)
ALTER DATABASE ceramic OWNER TO admin;
-- Exit PostgreSQL
\q
```
## Alternative: Run as a Script
If you prefer to run this as a script instead of typing the commands manually, you can:
1. Save the following content to a file named `fix-permissions.sql`:
```sql
-- Grant usage on schema
GRANT USAGE ON SCHEMA public TO admin;
-- Grant create on schema
GRANT CREATE ON SCHEMA public TO admin;
-- Grant all privileges on all tables
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO admin;
-- Make privileges apply to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO admin;
-- Make admin the owner of the database (optional but recommended)
ALTER DATABASE ceramic OWNER TO admin;
```
2. Run the script with:
```bash
psql -U postgres -d ceramic -f fix-permissions.sql
```
## Verification
After applying these permissions, you can verify them by:
1. Connecting as the admin user:
```bash
psql -U admin -d ceramic
```
2. Trying to create a test table:
```sql
CREATE TABLE test_permissions (id SERIAL PRIMARY KEY, name TEXT);
DROP TABLE test_permissions; -- Clean up after testing
```
If you can create and drop the test table without errors, the permissions have been successfully applied.