diff --git a/examples/realworld/schema/postgres.sql b/examples/realworld/schema/postgres.sql index b297c982..004feaff 100644 --- a/examples/realworld/schema/postgres.sql +++ b/examples/realworld/schema/postgres.sql @@ -1,8 +1,5 @@ -DROP VIEW IF EXISTS profiles CASCADE ; -DROP TABLE users, followers, articles, favorite_articles, tags, comments CASCADE ; - CREATE TABLE IF NOT EXISTS users ( - user_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, + user_id SERIAL PRIMARY KEY, email TEXT UNIQUE NOT NULL, password TEXT NOT NULL, @@ -20,7 +17,7 @@ SELECT user_id, username, bio, image FROM users; CREATE TABLE IF NOT EXISTS articles ( - article_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, + article_id SERIAL PRIMARY KEY, title TEXT UNIQUE NOT NULL, description TEXT NOT NULL, slug TEXT UNIQUE NOT NULL, @@ -59,7 +56,7 @@ CREATE TABLE IF NOT EXISTS tags ( ); CREATE TABLE IF NOT EXISTS comments ( - comment_id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, + comment_id SERIAL PRIMARY KEY, body TEXT NOT NULL, article_id INT NOT NULL REFERENCES articles (article_id) ON DELETE CASCADE,