modify sql functions
This commit is contained in:
@ -1,20 +1,22 @@
|
||||
CREATE OR REPLACE PROCEDURE create_tables() AS $$
|
||||
CREATE OR REPLACE PROCEDURE public.create_tables()
|
||||
LANGUAGE SQL
|
||||
AS $$
|
||||
DROP TABLE IF EXISTS artist_website;
|
||||
DROP TABLE IF EXISTS website;
|
||||
DROP TABLE IF EXISTS artist;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS artist (
|
||||
id serial PRIMARY KEY,
|
||||
name text NOT NULL,
|
||||
CONSTRAINT a_name UNIQUE(name)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS website (
|
||||
id serial PRIMARY KEY,
|
||||
name text NOT NULL,
|
||||
CONSTRAINT w_name UNIQUE(name)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS artist_website (
|
||||
id serial PRIMARY KEY,
|
||||
url text NOT NULL,
|
||||
@ -26,4 +28,4 @@ CREATE OR REPLACE PROCEDURE create_tables() AS $$
|
||||
CONSTRAINT aw_artist FOREIGN KEY (artist_id) REFERENCES artist (ID),
|
||||
CONSTRAINT aw_website FOREIGN KEY (website_id) REFERENCES website (ID)
|
||||
);
|
||||
$$ LANGUAGE SQL;
|
||||
$$;
|
||||
|
Reference in New Issue
Block a user