Changes between Version 1 and Version 2 of Phase1_Partitioning


Ignore:
Timestamp:
12/10/25 00:26:24 (3 weeks ago)
Author:
226052
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Phase1_Partitioning

    v1 v2  
    3333{{{
    3434CREATE TABLE rental (
    35     rental_id   BIGINT GENERATED ALWAYS AS IDENTITY,
     35    rental_id BIGINT GENERATED ALWAYS AS IDENTITY,
    3636    rental_date TIMESTAMP NOT NULL,
    37     inventory_id INT NOT NULL,
    38     customer_id  INT NOT NULL,
    39     staff_id     INT NOT NULL,
    40     return_date  TIMESTAMP,
    41     last_update  TIMESTAMP DEFAULT now(),
    42     PRIMARY KEY (rental_id, rental_date)
     37    inventory_id BIGINT NOT NULL,
     38    customer_id BIGINT NOT NULL,
     39    staff_id BIGINT NOT NULL,
     40    return_date TIMESTAMP,
     41    last_update TIMESTAMP DEFAULT now() NOT NULL,
     42    PRIMARY KEY (rental_id, rental_date),
     43    CONSTRAINT fk_rental_inventory FOREIGN KEY (inventory_id) REFERENCES inventory(inventory_id) ON UPDATE CASCADE ON DELETE RESTRICT,
     44    CONSTRAINT fk_rental_customer FOREIGN KEY (customer_id) REFERENCES customer(customer_id) ON UPDATE CASCADE ON DELETE RESTRICT,
     45    CONSTRAINT fk_rental_staff FOREIGN KEY (staff_id) REFERENCES staff(staff_id) ON UPDATE CASCADE ON DELETE RESTRICT
    4346)
    4447PARTITION BY RANGE (rental_date);