See the new site: https://postgresisenough.dev
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import schemacrawler.schema.Catalog | |
| import schemacrawler.schema.Schema | |
| import schemacrawler.schema.Table | |
| println("@startuml") | |
| println(''' | |
| !theme plain | |
| hide empty methods | |
| !procedure $schema($name, $slug) |
PlantUML is a descriptive language to generate a number of types of software diagrams, such as sequence, class, deployment and state diagrams, and many others. PlantUML does not generate very good-looking schema diagrams out of the box, but it supports themes and preprocessed macros. If you use themes and macros, you can not only use a simplified syntax, but also generate beautiful diagrams.
Here is an example of a PlantUML schema diagram, and we will build up the code to generate it.
To start, describe your schemas, tables and columns using this syntax as an example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Custom caching policy for on HTTP POST for Azure API Management: | |
| 1. Policy looks in the Request body - 'cacheKey' property which then used as cache key. | |
| Expected values are: <null>, ALL or NOEXPIRED | |
| Defaults to ALL in case <null> | |
| 2. Cache expiration set to 60 seconds/1 minute | |
| !--> | |
| <policies> | |
| <inbound> | |
| <base /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM postgres:18-alpine | |
| LABEL maintainer="Jordan Gould <jordangould@gmail.com>" | |
| # Based on https://github.com/andreaswachowski/docker-postgres/blob/master/initdb.sh | |
| # pg_jobmon 1.5.0 | |
| # They never cut a release for 1.5.0 (https://github.com/omniti-labs/pg_jobmon/commit/b9d49e6d4603f2670b3a2d512c31fc7cd5e9a334) | |
| ENV PG_JOBMON_VERSION=b9d49e6d4603f2670b3a2d512c31fc7cd5e9a334 | |
| ENV PG_PARTMAN_VERSION=v5.3.1 | |
| # Install pg_jobmon |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Json = | |
| | Null | |
| | Bool of bool | |
| | Number of float | |
| | String of string | |
| | Array of Json list | |
| | Object of (string * Json) list | |
| type Bracket = Open | Close |
See also: SchemaCrawler Database Diagramming.
-
Downlod the latest release of SchemaCrawler, for example v14.16.01 was tested to work.
-
Ensure Java is in place.
-
Run:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let ParallelThrottledIgnore (startOnCallingThread:bool) (parallelism:int) (xs:seq<Async<_>>) = async { | |
| let! ct = Async.CancellationToken | |
| let sm = new SemaphoreSlim(parallelism) | |
| let count = ref 1 | |
| let res = TaskCompletionSource<_>() | |
| let tryWait () = | |
| try sm.Wait () ; true | |
| with _ -> false | |
| let tryComplete () = | |
| if Interlocked.Decrement count = 0 then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // StartResult would be the type of the response. Must be marked with [<CLIMutable>] | |
| let response = | |
| restWithResponse<StartResult> ( | |
| POST >> toResource "stopwatch/{type}/{key}/start" >> atUrl config.Url | |
| >> withUrlSegment "type" stopwatchType | |
| >> withUrlSegment "key" key | |
| >> withFormValue "owner" owner | |
| >> withExpectedStatusOk | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (* | |
| An incomplete implementation of a type-safe SQL query in F#. | |
| The idea is that a query is built up clause by clause, by representing | |
| each additional clause being added on to the query as a state transition | |
| between different types of queries. We capture these different types as | |
| phantom types to make sure that only valid transitions (query clause | |
| additions) as defined by us can be carried out. | |
| The final result is a 'total query' that can be converted to a string, |
NewerOlder
