This is almost verbatim the example from
https://github.com/diesel-rs/diesel/tree/3ae353c3aff8a7ea64ed6cb39b3a045ac86cd60e/examples/postgres
with minor adjustments:
- after
diesel setup, edit the createdup.sqlanddown.sqlto contain only a trivial statement (likeSELECT 1). This is necessary because by default they contain a random trigger that CockroachDB can't handle. schema.rswas manually spelled out using thetable!macro. The tutorial usesinfer_schema!for which we don't have all the internals. Note that we useBigIntto properly support CockroachDB'sSERIALtype. In turn,struct Posthasid: i64instead ofi32.- Some adjustments in
show_poststo list the ID which is otherwise impossible to guess. - Pinned the diesel dependency for no good reason (to hopefully have this go stale later).
There are likely more problems not discovered by this toy example. See the tracking issue.