Skip to content

Commit

Permalink
Updated schema.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
alina tarasova committed Mar 3, 2024
1 parent ae5f502 commit 7bce4f8
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions app/src/main/resources/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ DROP TABLE IF EXISTS urls;
CREATE TABLE urls (
id BIGINT GENERATED ALWAYS AS IDENTITY UNIQUE NOT NULL,
name VARCHAR(255) NOT NULL,
created_at TIMESTAMP NOT NULL
created_at TIMESTAMP NOT NULL,
CONSTRAINT pk_url PRIMARY KEY (id)
);

CREATE TABLE url_checks (
Expand All @@ -15,5 +16,13 @@ CREATE TABLE url_checks (
title VARCHAR(255),
description TEXT,
created_at TIMESTAMP,
FOREIGN KEY (url_id) REFERENCES urls (id)
);
FOREIGN KEY (url_id) REFERENCES urls (id),
CONSTRAINT pk_url_checks PRIMARY KEY (id)
);

CREATE INDEX ix_url_check_url_id ON url_checks (url_id);
ALTER TABLE url_checks
ADD CONSTRAINT fk_url_checks_url_id
FOREIGN KEY (url_id)
REFERENCES urls (id)
ON DELETE RESTRICT ON UPDATE RESTRICT;

0 comments on commit 7bce4f8

Please sign in to comment.