cockroachdb / docs

CockroachDB user documentation
https://cockroachlabs.com/docs
Creative Commons Attribution 4.0 International
187 stars 453 forks source link

Update description of movr schema for 21.1 #10413

Open jseldess opened 3 years ago

jseldess commented 3 years ago

Jesse Seldess (jseldess) commented:

Our 21.1 multi-region tutorial uses a version of Movr without compound primary keys. However, the description of the Movr schema still shows compound primary keys and discusses this.

We need to update https://www.cockroachlabs.com/docs/v21.1/demo-low-latency-multi-region-deployment.html#a-basic-understanding-of-the-movr-application.

We may also need to update https://www.cockroachlabs.com/docs/v21.1/movr.html. However, that page refers to both the movr application (used in tutorial above), and the built-in movr dataset via cockroach demo and cockroach workload. For the latter, I think the table schemas still use compound primary keys:

~/cockroach-v21.1.0-beta.4.darwin-10.9-amd64$ ./cockroach demo
#
# Welcome to the CockroachDB demo database!
#
# You are connected to a temporary, in-memory CockroachDB cluster of 1 node.
#
# This demo session will attempt to enable enterprise features
# by acquiring a temporary license from Cockroach Labs in the background.
# To disable this behavior, set the environment variable
# COCKROACH_SKIP_ENABLING_DIAGNOSTIC_REPORTING=true.
#
# Beginning initialization of the movr dataset, please wait...
#
# The cluster has been preloaded with the "movr" dataset
# (MovR is a fictional vehicle sharing company).
#
# Reminder: your changes to data stored in the demo session will not be saved!
#
# Connection parameters:
#   (console) http://127.0.0.1:8080/demologin?password=demo6462&username=demo
#   (sql)     postgres://demo:demo6462@?host=%2Fvar%2Ffolders%2Fj5%2Fjkvm_vyn47dfnpw4bb1_n8l00000gn%2FT%2Fdemo378250877&port=26257
#   (sql/tcp) postgres://demo:demo6462@127.0.0.1:26257?sslmode=require
#
#
# The user "demo" with password "demo6462" has been created. Use it to access the Web UI!
#
# Server version: CockroachDB CCL v21.1.0-beta.4 (x86_64-apple-darwin19, built 2021/04/19 15:35:45, go1.15.10) (same version as client)
# Cluster ID: 76d2fe61-d95e-4cbf-b052-e2b4d0bafef0
# Organization: Cockroach Demo
#
# Enter \? for a brief introduction.
#
demo@127.0.0.1:26257/movr> show create table rides;
  table_name |                                                        create_statement
-------------+----------------------------------------------------------------------------------------------------------------------------------
  rides      | CREATE TABLE public.rides (
             |     id UUID NOT NULL,
             |     city VARCHAR NOT NULL,
             |     vehicle_city VARCHAR NULL,
             |     rider_id UUID NULL,
             |     vehicle_id UUID NULL,
             |     start_address VARCHAR NULL,
             |     end_address VARCHAR NULL,
             |     start_time TIMESTAMP NULL,
             |     end_time TIMESTAMP NULL,
             |     revenue DECIMAL(10,2) NULL,
             |     CONSTRAINT "primary" PRIMARY KEY (city ASC, id ASC),
             |     CONSTRAINT fk_city_ref_users FOREIGN KEY (city, rider_id) REFERENCES public.users(city, id),
             |     CONSTRAINT fk_vehicle_city_ref_vehicles FOREIGN KEY (vehicle_city, vehicle_id) REFERENCES public.vehicles(city, id),
             |     INDEX rides_auto_index_fk_city_ref_users (city ASC, rider_id ASC),
             |     INDEX rides_auto_index_fk_vehicle_city_ref_vehicles (vehicle_city ASC, vehicle_id ASC),
             |     FAMILY "primary" (id, city, vehicle_city, rider_id, vehicle_id, start_address, end_address, start_time, end_time, revenue),
             |     CONSTRAINT check_vehicle_city_city CHECK (vehicle_city = city)
             | )
(1 row)

Time: 21ms total (execution 20ms / network 0ms)

@awoods187, @ajstorm, do we want to update those built-in datasets as well?

Jira Issue: DOC-1621

ajstorm commented 3 years ago

I was under the impression that @awoods187 was working on changing the built-in movr dataset.