import "isomorphic-fetch"; | |
console.log("Start ..."); | |
const numberOfRequests = 100; | |
async function main() { | |
// 1. Create x requests (as unresolved promises) | |
console.log(`Creating ${numberOfRequests} requests ...`); | |
const requests = []; |
grant usage on schema public to supabase_auth_admin; | |
grant all on public."Profile" to supabase_auth_admin; | |
create or replace function create_profile_on_user_creation() returns trigger as | |
$$ | |
begin | |
insert into | |
public."Profile"(id, "modifiedAt") | |
values(new.id, current_timestamp); |
In Prisma 1, it wasn't necessary to specify both sides of a relation, this means this was allowed:
type User {
id: ID! @unique @id
questions: [Question]
}
type Question {
id: ID! @unique @id
We're shipping Prisma stickers for your favorite framework to your home address!
- Learn about Prisma and your favorite framework by following the link below 👇
- Scroll to the bottom of the page and click Get Stickers
- Fill out the form so we can ship the stickers to you 🚢
Next.js blurs the lines between client and server. It supports pre-rendering pages at build time (SSG) or request time (SSR). Prisma is the perfect companion if you need to work with a database in a Next.js app.
Here is a list of example apps that are based on Next.js and use Prisma on the server to access data from a database:
✍️ Language | 🤖 Server | 🔐 Authentication | 🔗 URL |
---|---|---|---|
TypeScript | API Routes | Yes (via NextAuth.js) | URL |
TypeScript | API Routes | No |
Addressing feedback from this Gist.
Pagination. Looks like limited to paginate by id. I wanted to paginate by a date field and felt impossible
In the most recent Preview version, (cursor-)pagination can be done by any unique field or combination of fields. For example:
model Post {
id Int @id @default(autoincrement())
title String
datasource sqlite { | |
url = "file:data.db" | |
provider = "sqlite" | |
} | |
generator photonjs { | |
provider = "photonjs" | |
} | |
model User { |
I'm using these prisma2
versions:
{
"dependencies": {
"@prisma/photon": "alpha"
},
"devDependencies": {
"prisma2": "alpha",
"ts-node-dev": "^1.0.0-pre.44",