PageRequests table

Release 1.0 - ...

A new table is necessary for storing information about the number of requests that have been made.

SQL CopyCode image Copy Code
IF NOT EXISTS(SELECT 1 FROM sysobjects WHERE id=OBJECT_ID('PageRequests') AND OBJECTPROPERTY(id,'ISTABLE')=1)
BEGIN
    PRINT 'Adding table PageRequests.'
    CREATE TABLE PageRequests (
        Nr int NOT NULL,
        Pageviews bigint NOT NULL,
        Visits bigint NOT NULL,
        LastRequest datetime NOT NULL,
        CONSTRAINT PK_PageRequests PRIMARY KEY CLUSTERED (Nr),
        CONSTRAINT FK_PageRequestsContents FOREIGN KEY (Nr) REFERENCES Contents(Nr) ON DELETE CASCADE
    )
END