mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
Format and style
Format SQL query in clean database, run npm run format
This commit is contained in:
@@ -27,7 +27,7 @@ const useCheckIfUserLikesBreweryPost = (breweryPostId: string) => {
|
||||
|
||||
const response = await fetch(`/api/breweries/${breweryPostId}/like/is-liked`);
|
||||
const json = await response.json();
|
||||
|
||||
|
||||
const parsed = APIResponseValidationSchema.safeParse(json);
|
||||
if (!parsed.success) {
|
||||
throw new Error('Invalid API response.');
|
||||
|
||||
@@ -27,7 +27,9 @@ const ProtectedPage: NextPage = () => {
|
||||
{isEvening && 'evening'}
|
||||
{`, ${user?.firstName}!`}
|
||||
</h1>
|
||||
<h2 className="text-xl font-bold lg:text-4xl">Welcome to the Biergarten App!</h2>
|
||||
<h2 className="text-xl font-bold lg:text-4xl">
|
||||
Welcome to the Biergarten App!
|
||||
</h2>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -10,16 +10,17 @@ const cleanDatabase = async () => {
|
||||
* schema then loops through each table and truncates it.
|
||||
*/
|
||||
await prisma.$executeRaw`
|
||||
DO $$
|
||||
DECLARE
|
||||
statements CURSOR FOR
|
||||
DO $$
|
||||
DECLARE
|
||||
statements CURSOR FOR
|
||||
SELECT tablename FROM pg_tables
|
||||
WHERE schemaname = 'public';
|
||||
BEGIN
|
||||
FOR statement IN statements LOOP
|
||||
EXECUTE 'TRUNCATE TABLE ' || quote_ident(statement.tablename) || ' CASCADE;';
|
||||
END LOOP;
|
||||
END;
|
||||
WHERE schemaname = 'public'
|
||||
AND tablename != '_prisma_migrations';
|
||||
BEGIN
|
||||
FOR statement IN statements LOOP
|
||||
EXECUTE 'TRUNCATE TABLE ' || quote_ident(statement.tablename) || ' CASCADE;';
|
||||
END LOOP;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user