SQL database (Postgres, MySQL)
SQL databases are easy to set up and often the go-to choices for less abstracted storage solutions. Terra currently supports Postgres & MySQL.
Setup
You will need to ensure your SQL database is publicly accessible. As a security measure, you may implement IP whitelisting using the list of IPs above.
Next, create a user with enough permissions to create tables & have read & write access within those tables. You can execute the scripts below based on your database
CREATE USER terra_user WITH PASSWORD 'your_password';
GRANT CONNECT ON DATABASE your_database_name TO terra_user;
GRANT USAGE ON SCHEMA public TO terra_user;
GRANT CREATE ON SCHEMA public TO terra_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA public 
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO terra_user;CREATE USER 'terra_user'@'%' IDENTIFIED BY 'your_password';
GRANT CREATE, SELECT, INSERT, UPDATE, DELETE ON your_database_name.* TO 'terra_user'@'%';
REVOKE ALL PRIVILEGES ON your_database_name.existing_table FROM 'terra_user'@'%';Data Structure
Data will be stored in tables within your SQL database following the structure below:

Users will be created in the terra_users table, data payloads will be placed in the terra_data_payloads, and all other payloads sent will be added to the terra_other_payloads. 
Last updated
Was this helpful?
