diff --git a/.env b/.env new file mode 100644 index 00000000..99bf8a89 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +DATABASE_URL=mysql://root:dev_web3_proxy@127.0.0.1:3306/web3_proxy diff --git a/diesel.toml b/diesel.toml new file mode 100644 index 00000000..92267c82 --- /dev/null +++ b/diesel.toml @@ -0,0 +1,5 @@ +# For documentation on how to configure this file, +# see diesel.rs/guides/configuring-diesel-cli + +[print_schema] +file = "src/schema.rs" diff --git a/web3-proxy/diesel.toml b/web3-proxy/diesel.toml new file mode 100644 index 00000000..92267c82 --- /dev/null +++ b/web3-proxy/diesel.toml @@ -0,0 +1,5 @@ +# For documentation on how to configure this file, +# see diesel.rs/guides/configuring-diesel-cli + +[print_schema] +file = "src/schema.rs" diff --git a/web3-proxy/migrations/.gitkeep b/web3-proxy/migrations/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/web3-proxy/migrations/2022-07-25-234230_first/down.sql b/web3-proxy/migrations/2022-07-25-234230_first/down.sql new file mode 100644 index 00000000..89469da5 --- /dev/null +++ b/web3-proxy/migrations/2022-07-25-234230_first/down.sql @@ -0,0 +1,4 @@ +DROP TABLE users; +DROP TABLE secondary_users; +DROP TABLE blocklist; +DROP TABLE user_keys; diff --git a/web3-proxy/migrations/2022-07-25-234230_first/up.sql b/web3-proxy/migrations/2022-07-25-234230_first/up.sql new file mode 100644 index 00000000..88bbe221 --- /dev/null +++ b/web3-proxy/migrations/2022-07-25-234230_first/up.sql @@ -0,0 +1,41 @@ +CREATE TABLE users ( + id SERIAL PRIMARY KEY, + primary_address VARCHAR NOT NULL, + chain INT NOT NULL, + description VARCHAR, + email VARCHAR DEFAULT NULL, +) + +CREATE TABLE secondary_users ( + id SERIAL PRIMARY KEY, + -- TODO: foreign key + user_id INT, + -- TODO: how should we store addresses? + secondary_address VARCHAR NOT NULL, + chain INT NOT NULL, + description VARCHAR, + -- TODO: creation time? + -- TODO: permissions. likely similar to infura +) + +CREATE TABLE blocklist ( + id SERIAL PRIMARY KEY, + -- TODO: creation time? + blocked_address VARCHAR NOT NULL, + chain INT NOT NULL, + reason TEXT, +) + +CREATE TABLE user_keys ( + id SERIAL PRIMARY KEY, + -- TODO: foreign key + user_id BIGINT, + api_key VARCHAR, + name VARCHAR, + private_txs BOOLEAN, + active BOOLEAN, + -- TODO: creation time? + -- TODO: requests_per_second INT, + -- TODO: requests_per_day INT, + -- TODO: more security features. likely similar to infura +)