Skip to content

ninest/husker-gym

Repository files navigation

Husker Gym

Find the best times to go to the gym

This website displays charts and visualizations to show how crowded the Northeastern gyms usually are. It works by scraping the live counts website which is updated every 30 minutes or so by the gym proctors. All the scraping is done in husker-nu/gymtime.

If you're interested in getting updates on this project, join the mailing list.

Images

 

 

Development

Connect to the planetscale DB for local development:

pscale connect gymtime main

and set the database URL:

DATABASE_URL = 'mysql://127.0.0.1:3306/gymtime'

Reference

Prisma schemas reference

Planetscale does not support foreign keys, so add to schema.prisma:

datasource db {
  provider     = "mysql"
  url          = env("DATABASE_URL")
+ relationMode = "prisma"
}

Run npx prisma db pull, then add relation fields manually taking reference from the introspection docs.

[TODO] Indexes

Relation mode

With relationMode = "prisma", no foreign keys are used, so relation fields will not benefit from the index usually created by the relational database under the hood. This can lead to poor performance when querying these fields. Indexes should be added manually.

Prisma client

Generate the prisma client with

npx prisma generate