sendou.ink/prisma/scripts/preBuild.ts
Ryan Laughlin 8fbc0fbdac
Update development setup instructions (#313)
* Add step about requiring patrons.json file

* Update steps to get DB up and running

* Clarify Discord login setup instructions

* Clarify how to start/stop server for new developers

* Update README to remove unneeded .env.local var

Co-authored-by: Kalle <38327916+Sendouc@users.noreply.github.com>
2021-03-31 12:15:52 +03:00

34 lines
766 B
TypeScript

import fs from "fs";
import path from "path";
import prisma from "../client";
// Include Prisma's .env file as well, so we can fetch the DATABASE_URL
require('dotenv').config({path: 'prisma/.env'});
const main = async () => {
const patrons = await prisma.user.findMany({
where: { patreonTier: { not: null } },
orderBy: { patreonTier: "desc" },
select: {
username: true,
discriminator: true,
patreonTier: true,
discordId: true,
},
});
fs.writeFile(
path.resolve(__dirname, "..", "..", "utils", "data", "patrons.json"),
JSON.stringify(patrons),
function (err) {
if (err) throw err;
}
);
};
main()
.catch((e) => console.error(e))
.finally(async () => {
await prisma.$disconnect();
});