-
Notifications
You must be signed in to change notification settings - Fork 0
/
sqlmigrations.txt
14 lines (14 loc) · 1.54 KB
/
sqlmigrations.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
BEGIN;
--
-- Create model StudySpaces
--
CREATE TABLE "locations_studyspaces" ("id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "location" varchar(255) NOT NULL, "name" varchar(255) NOT NULL, "is_verified" boolean NOT NULL, "noise_level" integer NOT NULL, "available_date" timestamp with time zone NOT NULL, "start_hours" time NOT NULL, "end_hours" time NOT NULL, "lat" double precision NOT NULL, "lng" double precision NOT NULL, "reservation" boolean NOT NULL, "location_details" varchar(255) NULL, "author_id" integer NULL);
--
-- Create model Activities
--
CREATE TABLE "locations_activities" ("id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "location" varchar(255) NOT NULL, "name" varchar(255) NOT NULL, "is_verified" boolean NOT NULL, "date_time" timestamp with time zone NOT NULL, "lat" double precision NOT NULL, "lng" double precision NOT NULL, "reservation" boolean NOT NULL, "location_details" varchar(255) NULL, "author_id" integer NULL);
ALTER TABLE "locations_studyspaces" ADD CONSTRAINT "locations_studyspaces_author_id_176f84c5_fk_auth_user_id" FOREIGN KEY ("author_id") REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "locations_studyspaces_author_id_176f84c5" ON "locations_studyspaces" ("author_id");
ALTER TABLE "locations_activities" ADD CONSTRAINT "locations_activities_author_id_c1ebd775_fk_auth_user_id" FOREIGN KEY ("author_id") REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "locations_activities_author_id_c1ebd775" ON "locations_activities" ("author_id");
COMMIT;