forked from dubinc/dub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9cd1a5b
commit 92e6c05
Showing
5 changed files
with
70 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import "dotenv-flow/config"; | ||
import prisma from "@/lib/prisma"; | ||
|
||
const DOMAIN = "x.com"; | ||
const PROJECT_ID = "xxx"; | ||
|
||
async function main() { | ||
const [links, project] = await Promise.all([ | ||
prisma.link.updateMany({ | ||
where: { | ||
domain: DOMAIN, | ||
}, | ||
data: { | ||
projectId: PROJECT_ID, | ||
}, | ||
}), | ||
prisma.project.findFirst({ | ||
where: { | ||
domains: { | ||
some: { | ||
slug: DOMAIN, | ||
}, | ||
}, | ||
}, | ||
}), | ||
]); | ||
|
||
const response = await Promise.all([ | ||
prisma.domain.update({ | ||
where: { | ||
slug: DOMAIN, | ||
}, | ||
data: { | ||
projectId: PROJECT_ID, | ||
primary: false, | ||
}, | ||
}), | ||
prisma.project.update({ | ||
where: { | ||
id: PROJECT_ID, | ||
}, | ||
data: { | ||
usage: { | ||
increment: project?.usage, | ||
}, | ||
linksUsage: { | ||
increment: links.count, | ||
}, | ||
}, | ||
}), | ||
]); | ||
|
||
console.log({ response }); | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters