-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
25 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
SET client_min_messages = warning; | ||
|
||
DROP TABLE IF EXISTS "Posts_intermediate" CASCADE; | ||
DROP TABLE IF EXISTS "Posts" CASCADE; | ||
DROP TABLE IF EXISTS "Posts_retired" CASCADE; | ||
DROP FUNCTION IF EXISTS "Posts_insert_trigger"(); | ||
DROP TABLE IF EXISTS "Users" CASCADE; | ||
|
||
CREATE TABLE "Users" ( | ||
"Id" SERIAL PRIMARY KEY | ||
); | ||
|
||
CREATE TABLE "Posts" ( | ||
"Id" SERIAL PRIMARY KEY, | ||
"UserId" INTEGER, | ||
"createdAt" timestamp, | ||
"createdAtTz" timestamptz, | ||
"createdOn" date, | ||
CONSTRAINT "foreign_key_1" FOREIGN KEY ("UserId") REFERENCES "Users"("Id") | ||
); | ||
|
||
CREATE INDEX ON "Posts" ("createdAt"); | ||
|
||
INSERT INTO "Posts" ("createdAt", "createdAtTz", "createdOn") SELECT NOW(), NOW(), NOW() FROM generate_series(1, 10000) n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters