Skip to content

Commit

Permalink
oh i forgot
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatXliner committed Apr 13, 2024
1 parent ae16ce3 commit 9dd00da
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 16 deletions.
32 changes: 16 additions & 16 deletions packages/db/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,21 +184,21 @@ export const qualitativeScouting = pgTable("qualitative_scouting", {

// Attendance schema

export const location = pgTable("location", {
id: varchar("id", {
length: 256,
}).primaryKey(),
name: varchar("name", { length: 256 }).notNull(),
latitude: doublePrecision("latitude").notNull(),
longitude: doublePrecision("longitude").notNull(),
radius: varchar("radius", { length: 256 }).notNull(),
createdAt: timestamp("created_at")
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
isActive: boolean("is_active").notNull(),
isSchool: boolean("is_school").notNull(), // basically a "primary" location. default location when we're not at regionals, etc.
author_id: varchar("author_id", { length: 256 }),
});
// export const location = pgTable("location", {
// id: varchar("id", {
// length: 256,
// }).primaryKey(),
// name: varchar("name", { length: 256 }).notNull(),
// latitude: doublePrecision("latitude").notNull(),
// longitude: doublePrecision("longitude").notNull(),
// radius: varchar("radius", { length: 256 }).notNull(),
// createdAt: timestamp("created_at")
// .default(sql`CURRENT_TIMESTAMP`)
// .notNull(),
// isActive: boolean("is_active").notNull(),
// isSchool: boolean("is_school").notNull(), // basically a "primary" location. default location when we're not at regionals, etc.
// author_id: varchar("author_id", { length: 256 }),
// });

// export const locationRelations = relations(location, ({ many, one }) => ({
// meetings: many(meeting),
Expand Down Expand Up @@ -280,5 +280,5 @@ export const attendanceSessions = pgTable("attendanceSessions", {
.references(() => attendanceKeys.uid)
.notNull(),
startTime: timestamp("startTime").notNull(),
endTime: timestamp("startTime"),
endTime: timestamp("endTime"),
});
87 changes: 87 additions & 0 deletions tooling/supabase/migrations/20240413234214_attendance.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
create table "public"."attendanceKeys" (
"uid" text not null,
"name" text,
"currentlyAttending" boolean not null default false
);


alter table "public"."attendanceKeys" enable row level security;

create table "public"."attendanceSessions" (
"uid" text not null,
"startTime" timestamp with time zone not null default now(),
"endTime" timestamp with time zone
);


alter table "public"."attendanceSessions" enable row level security;

CREATE UNIQUE INDEX "attendanceKeys_pkey" ON public."attendanceKeys" USING btree (uid);

CREATE UNIQUE INDEX "attendanceSessions_pkey" ON public."attendanceSessions" USING btree (uid);

alter table "public"."attendanceKeys" add constraint "attendanceKeys_pkey" PRIMARY KEY using index "attendanceKeys_pkey";

alter table "public"."attendanceSessions" add constraint "attendanceSessions_pkey" PRIMARY KEY using index "attendanceSessions_pkey";

alter table "public"."attendanceSessions" add constraint "public_attendanceSessions_uid_fkey" FOREIGN KEY (uid) REFERENCES "attendanceKeys"(uid) ON UPDATE CASCADE ON DELETE CASCADE not valid;

alter table "public"."attendanceSessions" validate constraint "public_attendanceSessions_uid_fkey";

grant delete on table "public"."assignments" to "PUBLIC";

grant insert on table "public"."assignments" to "PUBLIC";

grant references on table "public"."assignments" to "PUBLIC";

grant select on table "public"."assignments" to "PUBLIC";

grant trigger on table "public"."assignments" to "PUBLIC";

grant truncate on table "public"."assignments" to "PUBLIC";

grant update on table "public"."assignments" to "PUBLIC";

grant delete on table "public"."events" to "PUBLIC";

grant insert on table "public"."events" to "PUBLIC";

grant references on table "public"."events" to "PUBLIC";

grant select on table "public"."events" to "PUBLIC";

grant trigger on table "public"."events" to "PUBLIC";

grant truncate on table "public"."events" to "PUBLIC";

grant update on table "public"."events" to "PUBLIC";

grant delete on table "public"."matches" to "PUBLIC";

grant insert on table "public"."matches" to "PUBLIC";

grant references on table "public"."matches" to "PUBLIC";

grant select on table "public"."matches" to "PUBLIC";

grant trigger on table "public"."matches" to "PUBLIC";

grant truncate on table "public"."matches" to "PUBLIC";

grant update on table "public"."matches" to "PUBLIC";

grant delete on table "public"."profiles" to "PUBLIC";

grant insert on table "public"."profiles" to "PUBLIC";

grant references on table "public"."profiles" to "PUBLIC";

grant select on table "public"."profiles" to "PUBLIC";

grant trigger on table "public"."profiles" to "PUBLIC";

grant truncate on table "public"."profiles" to "PUBLIC";

grant update on table "public"."profiles" to "PUBLIC";


0 comments on commit 9dd00da

Please sign in to comment.