1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# The configuration the checked-in tests/generated/sqlite fixture was
# generated with. `url` is injected by the tests (a temp database built from
# fixtures/sqlite_schema.sql).
= "sqlite"
[]
= "crate::hooks"
# The same hooks the hand-written spec model implements; the application's
# implementations live in the test binary's `hooks` module.
[]
= ["before_insert", "after_insert"]
# The schema cannot say that `posts.published_at` (a plain TEXT column with
# no default) holds a datetime — the override records the intent, and its
# assert_bind line proves the replacement type binds.
[[]]
= ["posts"]
= "chrono::NaiveDateTime"
[]
= "published_at"
= "TEXT"
# `editable_users` is the one view SQLite will write through — it carries
# INSTEAD OF triggers for all three statements — so declaring its identity is
# accepted and the full `Table` surface is generated for it. The same
# declaration on `user_emails` or `post_authors` is refused, because SQLite
# will not write through those (see `config_effects.rs`).
[]
= ["id"]
# Relations a view is party to have to be declared: a view has no foreign keys
# and no key, so nothing in the catalog says how it joins or how many rows sit
# on each end.
# The view is the *referencing* side: one row per post, each naming its
# author, so a user has many of them.
[[]]
= "post_authors"
= "user_id"
= "users"
= "id"
= "many_to_one"
# The view is the *referenced* side, one row per post: to-one from `posts`,
# and an `Option` back-reference on the view rather than a `Vec`.
[[]]
= "posts"
= "id"
= "post_authors"
= "post_id"
= "authorship"
= "one_to_one"
# View to table, one row each way.
[[]]
= "user_emails"
= "id"
= "users"
= "id"
= "one_to_one"