Skip to content

Instantly share code, notes, and snippets.

@lenalytics
Created August 1, 2021 11:18
Show Gist options
  • Save lenalytics/d69157a31e889c08518ff0d391bd781c to your computer and use it in GitHub Desktop.
Save lenalytics/d69157a31e889c08518ff0d391bd781c to your computer and use it in GitHub Desktop.
Airbnb Calendar Table
BEGIN;
CREATE TABLE "airdata"."calendar"
(
"listing_id" BIGINT NOT NULL,
"date" timestamptz,
"available" BOOLEAN,
"price" DECIMAL,
"adjusted_price" DECIMAL,
"minimum_nights" INTEGER,
"maximum_nights" INTEGER,
CONSTRAINT "PK_calendar_01" PRIMARY KEY ("listing_id", "date")
);
CREATE INDEX "IDX_calendar_listing_id" ON "airdata"."calendar" ("listing_id");
CREATE INDEX "IDX_calendar_date" ON "airdata"."calendar" ("date");
CREATE INDEX "IDX_calendar_price" ON "airdata"."calendar" ("price");
COMMIT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment