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.sql
anddown.sql
to contain only a trivial statement (likeSELECT 1
). This is necessary because by default they contain a random trigger that CockroachDB can't handle. schema.rs
was manually spelled out using thetable!
macro. The tutorial usesinfer_schema!
for which we don't have all the internals. Note that we useBigInt
to properly support CockroachDB'sSERIAL
type. In turn,struct Post
hasid: i64
instead ofi32
.- Some adjustments in
show_posts
to 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.