|
| 1 | +DROP TABLE IF EXISTS "public"."followers"; |
| 2 | +-- This script only contains the table creation statements and does not fully represent the table in the database. It's still missing: indices, triggers. Do not use it as a backup. |
| 3 | + |
| 4 | +-- Sequence and defined type |
| 5 | +CREATE SEQUENCE IF NOT EXISTS followers_id_seq; |
| 6 | + |
| 7 | +-- Table Definition |
| 8 | +CREATE TABLE "public"."followers" ( |
| 9 | + "id" int4 NOT NULL DEFAULT nextval('followers_id_seq'::regclass), |
| 10 | + "leader_id" int4 NOT NULL, |
| 11 | + "follower_id" int4 NOT NULL, |
| 12 | + PRIMARY KEY ("id") |
| 13 | +); |
| 14 | + |
| 15 | +DROP TABLE IF EXISTS "public"."user"; |
| 16 | +-- This script only contains the table creation statements and does not fully represent the table in the database. It's still missing: indices, triggers. Do not use it as a backup. |
| 17 | + |
| 18 | +-- Sequence and defined type |
| 19 | +CREATE SEQUENCE IF NOT EXISTS user_id_seq1; |
| 20 | + |
| 21 | +-- Table Definition |
| 22 | +CREATE TABLE "public"."user" ( |
| 23 | + "id" int4 NOT NULL DEFAULT nextval('user_id_seq1'::regclass), |
| 24 | + "name" varchar NOT NULL, |
| 25 | + "birthday" date, |
| 26 | + PRIMARY KEY ("id") |
| 27 | +); |
| 28 | + |
| 29 | +INSERT INTO "public"."user" ("id", "name", "birthday") VALUES |
| 30 | +(1, 'Morgan Freeman', '1937-06-01'), |
| 31 | +(2, 'Elon Musk', '1971-06-28'), |
| 32 | +(3, 'Keanu Reeves', '1964-09-02'), |
| 33 | +(4, 'Robin Williams', '1951-07-21'), |
| 34 | +(5, 'Tom Hanks', '1956-07-09'), |
| 35 | +(6, 'Harrison Ford', '1942-07-13'), |
| 36 | +(7, 'Nicole Kidman', '1967-06-20'), |
| 37 | +(8, 'Julia Roberts', '1967-10-28'), |
| 38 | +(9, 'Nicolas Cage', '1964-01-07'), |
| 39 | +(10, 'Bill Murray', '1950-10-21'), |
| 40 | +(11, 'Bruce Lee', '1940-11-27'); |
| 41 | + |
| 42 | +ALTER TABLE "public"."followers" ADD FOREIGN KEY ("follower_id") REFERENCES "public"."user"("id"); |
| 43 | +ALTER TABLE "public"."followers" ADD FOREIGN KEY ("leader_id") REFERENCES "public"."user"("id"); |
0 commit comments