Skip to content

Trying to setup, but ran into a snag, do you happen to have the SQL required to create the database manually? #4

@Jieiku

Description

@Jieiku
sudo -u postgres psql -c "create user jieiku with password 'SuperSecretPass' superuser;" -U postgres
sudo -u postgres psql -c 'create database logging with owner jieiku;' -U postgres

git clone https://github.com/botiven/logger
cd logger
cargo update
cargo build --release

nano .env

DATABASE_URL=postgres://jieiku:SuperSecretPass@localhost:5432/logging

CTRL+X to save and exit

./target/release/server
2025-02-02T18:00:58.861426Z  INFO server: Starting up
2025-02-02T18:00:58.861444Z  INFO server: Loading environment variables
2025-02-02T18:00:58.861500Z  INFO server: Connecting to database at postgres://jieiku:SuperSecretPass@localhost:5432/logging
2025-02-02T18:00:58.871079Z DEBUG sqlx::query: summary="SELECT current_database()" db.statement="" rows_affected=0 rows_returned=1 elapsed=590.723µs elapsed_secs=0.000590723
2025-02-02T18:00:58.871395Z DEBUG sqlx::query: summary="SELECT pg_advisory_lock($1)" db.statement="" rows_affected=1 rows_returned=1 elapsed=287.822µs elapsed_secs=0.000287822
2025-02-02T18:00:58.871720Z  INFO sqlx::postgres::notice: relation "_sqlx_migrations" already exists, skipping
2025-02-02T18:00:58.871906Z DEBUG sqlx::query: summary="CREATE TABLE IF NOT …" db.statement="\n\nCREATE TABLE IF NOT EXISTS _sqlx_migrations (\n  version BIGINT PRIMARY KEY,\n  description TEXT NOT NULL,\n  installed_on TIMESTAMPTZ NOT NULL DEFAULT now(),\n  success BOOLEAN NOT NULL,\n  checksum BYTEA NOT NULL,\n  execution_time BIGINT NOT NULL\n);\n" rows_affected=0 rows_returned=0 elapsed=322.377µs elapsed_secs=0.000322377
2025-02-02T18:00:58.872917Z DEBUG sqlx::query: summary="SELECT version FROM _sqlx_migrations …" db.statement="\n\nSELECT\n  version\nFROM\n  _sqlx_migrations\nWHERE\n  success = false\nORDER BY\n  version\nLIMIT\n  1\n" rows_affected=0 rows_returned=0 elapsed=932.71µs elapsed_secs=0.00093271
2025-02-02T18:00:58.873248Z DEBUG sqlx::query: summary="SELECT version, checksum FROM …" db.statement="\n\nSELECT\n  version,\n  checksum\nFROM\n  _sqlx_migrations\nORDER BY\n  version\n" rows_affected=0 rows_returned=0 elapsed=283.332µs elapsed_secs=0.000283332
2025-02-02T18:00:58.873493Z  WARN sqlx::postgres::notice: there is already a transaction in progress
2025-02-02T18:00:58.995978Z DEBUG sqlx::query: summary="BEGIN; CREATE TABLE logs …" db.statement="\n\nBEGIN\n;\nCREATE TABLE logs (\n  id uuid DEFAULT gen_random_uuid(),\n  username varchar(32) NOT NULL,\n  channel varchar(32) NOT NULL,\n  content text,\n  log_type varchar(16) NOT NULL DEFAULT 'message',\n  created_at timestamp WITH TIME ZONE DEFAULT NOW()\n);\nCREATE INDEX logs_created_at_idx ON logs (created_at);\nCREATE INDEX logs_username_idx ON logs (username);\nCREATE INDEX logs_channel_idx ON logs (channel);\nSELECT\n  create_hypertable('logs', 'created_at');\nCOMMIT;\n" rows_affected=0 rows_returned=0 elapsed=122.39701ms elapsed_secs=0.12239701
thread 'main' panicked at src/main.rs:48:51:
called `Result::unwrap()` on an `Err` value: Execute(Database(PgDatabaseError { severity: Error, code: "42883", message: "function create_hypertable(unknown, unknown) does not exist", detail: None, hint: Some("No function matches the given name and argument types. You might need to add explicit type casts."), position: Some(Original(429)), where: None, schema: None, table: None, column: None, data_type: None, constraint: None, file: Some("parse_func.c"), line: Some(629), routine: Some("ParseFuncOrColumn") }))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions