WEBVTT

00:00:00.500 --> 00:00:03.846
A cinema publishes its Saturday program in start time order.

00:00:04.746 --> 00:00:07.051
Every screening needs a room that exists.

00:00:07.950 --> 00:00:09.838
The cinema owns both facts.

00:00:10.736 --> 00:00:13.991
It can keep both tables in one actor, next to the code that

00:00:14.004 --> 00:00:15.228
changes the program.

00:00:16.127 --> 00:00:18.822
Ashroot is an optional layer for these tables.

00:00:19.720 --> 00:00:22.338
Each room and screening has a primary ID.

00:00:23.236 --> 00:00:25.306
A screening stores its room ID.

00:00:26.205 --> 00:00:29.981
The cinema's scheduling service asks Ashroot to write each change.

00:00:30.879 --> 00:00:33.731
Ashroot owns the stored rows and their indexes.

00:00:35.867 --> 00:00:39.291
The program asks which screenings are on Saturday, earliest

00:00:39.304 --> 00:00:39.851
first.

00:00:40.751 --> 00:00:43.564
Give it an ordered index by day and start time.

00:00:44.462 --> 00:00:47.314
Each entry pairs that key with a screening ID.

00:00:48.212 --> 00:00:51.337
The query takes the first two matches and follows their IDs

00:00:51.350 --> 00:00:52.470
to the film names.

00:00:53.369 --> 00:00:56.520
The cinema chooses the page size and a limit on how many rows

00:00:56.533 --> 00:00:57.731
the query may visit.

00:00:58.629 --> 00:01:00.882
Now Lanterns moves to a later time.

00:01:01.780 --> 00:01:05.335
The service replaces screening forty one under the same ID.

00:01:06.233 --> 00:01:09.788
Ashroot removes its old index entry and writes the new one.

00:01:10.686 --> 00:01:13.863
When the program reads again, Low Tide comes first.

00:01:16.000 --> 00:01:18.486
Try to add a screening in room ninety nine.

00:01:19.387 --> 00:01:22.629
The schema declares which table the room reference points to.

00:01:23.528 --> 00:01:26.392
Ashroot checks that the room exists before it writes.

00:01:27.291 --> 00:01:29.074
Room ninety nine is missing.

00:01:29.973 --> 00:01:33.371
The new screening is refused and the program stays as it was.

00:01:34.270 --> 00:01:36.496
The rule also works from the room side.

00:01:37.395 --> 00:01:41.223
If the cinema asks to remove Studio, the restrict policy tells

00:01:41.236 --> 00:01:43.944
Ashroot to refuse while any screening points to it.

00:01:44.843 --> 00:01:47.017
Lanterns and Paper Moon still do.

00:01:47.916 --> 00:01:50.767
The cinema can move both screenings to Main first.

00:01:51.666 --> 00:01:54.179
Their room references now point to room twenty.

00:01:55.077 --> 00:01:59.478
Studio has no incoming references, so the same removal can succeed.

00:02:00.377 --> 00:02:03.345
Those are three deliberate edits the cinema chooses to make.

00:02:05.467 --> 00:02:09.373
Foreign keys keep the two tables consistent inside this database.

00:02:10.273 --> 00:02:13.307
The cinema service still decides who may edit a screening and

00:02:13.320 --> 00:02:14.857
whether two bookings overlap.

00:02:15.755 --> 00:02:18.971
If room availability belongs to a different actor, the cinema

00:02:18.984 --> 00:02:21.523
needs a message and a workflow for that agreement.

00:02:22.422 --> 00:02:25.664
Give your team the rows the owner keeps, the queries it must

00:02:25.677 --> 00:02:28.164
answer, and a rule for each relationship.

00:02:29.062 --> 00:02:31.758
Put those declarations in the owner's memory version.

00:02:32.656 --> 00:02:35.950
When the schema changes, plan the migration and rehearse it

00:02:35.963 --> 00:02:37.161
on populated data.

00:02:38.060 --> 00:02:41.341
Include the allowed edits and the refusals in the test cases.

