Advertisement
Guest User

Untitled

a guest
Dec 4th, 2018
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. create extension if not exists "uuid-ossp";
  2. create table engine
  3. (
  4.   id           uuid default uuid_generate_v4() not null
  5.     constraint engine_pkey
  6.     primary key,
  7.   name         varchar(150)                    not null,
  8.   date_created timestamp                       not null,
  9.   type         varchar(20)                     not null
  10. );
  11.  
  12. create table car
  13. (
  14.   id        uuid default uuid_generate_v4() not null
  15.     constraint car_pkey
  16.     primary key,
  17.   brand     varchar(50)                     not null,
  18.   model     varchar(100)                    not null,
  19.   engine_id uuid                            not null
  20.     constraint car_engine_id_fk
  21.     references engine
  22. );
  23.  
  24. create table truck
  25. (
  26.   id               uuid default uuid_generate_v4() not null
  27.     constraint truck_pkey
  28.     primary key,
  29.   brand            varchar(50)                     not null,
  30.   model            varchar(100)                    not null,
  31.   cargo_max_weight smallint                        not null,
  32.   truck_type       varchar(100),
  33.   engine_id        uuid                            not null
  34.     constraint truck_engine_id_fk
  35.     references engine
  36. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement