Postgres Describe
This library provides a Mix task that documents PostgreSQL database tables
in files within the directory tree.
Installation
Add postgres_describe to your list of dependencies in mix.exs:
def deps do
[
{:postgres_describe, "~> 0.1"}
]
end
And mix deps.get.
Basic Usage
The following configuration values are required at a minimum:
database: Your PG database namewrite_dir: Where we should write your description filestables(map): Keys are schemas in your database (at a minimum you probably wantpublic), and values are lists of table names within that schema
Additional configuration values you can set:
host: Your PG host (defaults tolocalhost)port: PG port (defaults to5432)user: Your PG user (defaults to your current username, i.e.whoami)password: Your PG password (defaults tonil)
Configuration can be provided through your application config under the
postgres_describe application:
config :postgres_describe,
database: "mydatabase",
write_dir: Path.join([System.tmp_dir, "db_docs"]),
tables: %{public: ["table1", "table2"]}Or through system environment variables.
A complete example configuration is shown below:
config :postgres_describe,
host: "localhost",
port: 5432,
user: "myuser",
password: "mypassword",
database: "mydatabase",
write_dir: Path.join([System.tmp_dir, "db_docs"]),
tables: %{
public: [
"table_1",
"table_2"
],
another_schema: [
"table_3",
"table_4"
]
}Once your system is configured, then run the generator from the root of your application:
$ mix postgres_describeFull docs can be found online.