Skip to content

Commit 1f34611

Browse files
authored
Merge pull request #9 from RedBe-an/main
chore: database reset.
2 parents b6e81fc + 40a5b7e commit 1f34611

File tree

12 files changed

+181
-74
lines changed

12 files changed

+181
-74
lines changed

bin/check-data.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { PrismaClient } from '@prisma/client';
2+
3+
const prisma = new PrismaClient();
4+
5+
async function checkData() {
6+
try {
7+
const count = await prisma.opening.count();
8+
console.log(`총 ${count}개의 오프닝 데이터가 있습니다.`);
9+
10+
const sample = await prisma.opening.findMany({
11+
take: 5,
12+
select: {
13+
eco: true,
14+
name: true,
15+
urlName: true,
16+
mdx: true
17+
}
18+
});
19+
20+
console.log('샘플 데이터:');
21+
sample.forEach((opening, index) => {
22+
console.log(`${index + 1}. ${opening.eco} - ${opening.name}`);
23+
console.log(` urlName: ${opening.urlName}`);
24+
console.log(` mdx: ${opening.mdx}`);
25+
console.log('');
26+
});
27+
28+
} catch (error) {
29+
console.error('오류:', error);
30+
} finally {
31+
await prisma.$disconnect();
32+
}
33+
}
34+
35+
checkData();

bin/check-db-info.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { PrismaClient } from '@prisma/client';
2+
3+
const prisma = new PrismaClient();
4+
5+
async function checkDatabase() {
6+
try {
7+
const result = await prisma.$queryRaw`SELECT current_database() as db_name`;
8+
console.log('현재 연결된 데이터베이스:', result);
9+
10+
// 스키마 정보도 확인
11+
const tables = await prisma.$queryRaw`
12+
SELECT table_name
13+
FROM information_schema.tables
14+
WHERE table_schema = 'public'
15+
`;
16+
console.log('테이블 목록:', tables);
17+
18+
} catch (error) {
19+
console.error('오류:', error);
20+
} finally {
21+
await prisma.$disconnect();
22+
}
23+
}
24+
25+
checkDatabase();

bin/sync-openings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { join } from "path";
55
import { normalizeFileName } from "@/lib/utils";
66

77
const supabase = createClient(
8-
process.env.SUPABASE_URL!,
9-
process.env.SUPABASE_SERVICE_ROLE_KEY!,
8+
process.env.OPENCHESS_SUPABASE_URL!,
9+
process.env.OPENCHESS_SUPABASE_SERVICE_ROLE_KEY!,
1010
);
1111

1212
const prisma = new PrismaClient();

bun.lockb

3.38 KB
Binary file not shown.

next.config.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ import remarkToc from "remark-toc";
55
import remarkGfm from "remark-gfm";
66
import remarkBreaks from "remark-breaks";
77

8+
/** @type {import('next').NextConfig} */
89
const nextConfig = {
9-
pageExtensions: ["js", "jsx", "md", "mdx", "ts", "tsx"],
1010
experimental: {
11-
mdxRs: true,
11+
// Jest worker 문제 해결을 위한 설정
12+
workerThreads: false,
13+
cpus: 1,
1214
},
15+
// 빌드 시 외부 의존성 처리
16+
serverComponentsExternalPackages: ['@prisma/client'],
1317
};
1418

1519
const withMDX = createMDX({
@@ -31,4 +35,4 @@ const withMDX = createMDX({
3135
},
3236
});
3337

34-
export default withMDX(nextConfig);
38+
module.exports = withMDX(nextConfig);

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"@mdx-js/react": "^3.1.0",
2323
"@next/mdx": "^15.1.4",
2424
"@opentelemetry/api": "^1.9.0",
25-
"@prisma/client": "^6.2.1",
25+
"@prisma/client": "^6.11.1",
2626
"@prisma/extension-accelerate": "^1.2.1",
2727
"@prisma/extension-optimize": "^1.1.4",
2828
"@radix-ui/react-accordion": "^1.2.2",
@@ -60,7 +60,7 @@
6060
"eslint-config-next": "15.1.4",
6161
"postcss": "^8.5.1",
6262
"prettier": "3.4.2",
63-
"prisma": "^6.2.1",
63+
"prisma": "^6.11.1",
6464
"rehype-autolink-headings": "^7.1.0",
6565
"rehype-slug": "^6.0.0",
6666
"remark-breaks": "^4.0.0",

prisma/schema.prisma

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
21
generator client {
32
provider = "prisma-client-js"
43
}
54

65
datasource db {
76
provider = "postgresql"
8-
url = env("DATABASE_URL")
9-
directUrl = env("DIRECT_URL")
10-
7+
url = env("OPENCHESS_DATABASE_URL")
8+
directUrl = env("OPENCHESS_DIRECT_URL")
119
}
1210

1311
model opening {
14-
eco String
15-
name String
16-
urlName String
17-
pgn String @unique
18-
mdx String? // Optional field, as most values are null
12+
eco String
13+
name String
14+
urlName String
15+
pgn String @unique
16+
mdx String?
1917
20-
@@map("opening") // Mapping table name to "opening"
18+
@@map("opening")
2119
}

src/app/globals.css

Lines changed: 55 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3,61 +3,62 @@
33
@tailwind utilities;
44

55
@layer base {
6-
:root {
7-
--background: 90 35% 100%;
8-
--foreground: 90 53% 5%;
9-
--muted: 90 20% 87%;
10-
--muted-foreground: 90 13% 25%;
11-
--popover: 90 35% 100%;
12-
--popover-foreground: 90 53% 5%;
13-
--card: 90 35% 100%;
14-
--card-foreground: 90 53% 5%;
15-
--border: 90 4% 95%;
16-
--input: 90 4% 95%;
17-
--primary: 90 42% 51%;
18-
--primary-foreground: 90 42% 11%;
19-
--secondary: 90 10% 84%;
20-
--secondary-foreground: 90 10% 24%;
21-
--accent: 90 19% 78%;
22-
--accent-foreground: 90 19% 18%;
23-
--destructive: 2 81% 25%;
24-
--destructive-foreground: 2 81% 85%;
25-
--ring: 90 42% 51%;
26-
--chart-1: 90 42% 51%;
27-
--chart-2: 90 10% 84%;
28-
--chart-3: 90 19% 78%;
29-
--chart-4: 90 10% 87%;
30-
--chart-5: 90 45% 51%;
31-
--radius: 0.5rem;
6+
:root {
7+
--background: 0 0% 100%;
8+
--foreground: 0 0% 13.33%;
9+
--muted: 0 0% 93.33%;
10+
--muted-foreground: 0 0% 45.1%;
11+
--popover: 0 0% 100%;
12+
--popover-foreground: 0 0% 13.33%;
13+
--card: 0 0% 100%;
14+
--card-foreground: 0 0% 13.33%;
15+
--border: 0 0% 93.33%;
16+
--input: 0 0% 93.33%;
17+
--primary: 150 50% 45%;
18+
--primary-foreground: 0 0% 100%;
19+
--secondary: 0 0% 93.33%;
20+
--secondary-foreground: 0 0% 13.33%;
21+
--accent: 0 0% 93.33%;
22+
--accent-foreground: 0 0% 13.33%;
23+
--destructive: 0 50% 50%;
24+
--destructive-foreground: 0 0% 100%;
25+
--ring: 150.26 50.22% 44.9%;
26+
--chart-1: 150 50% 45%;
27+
--chart-2: 0 0% 93.33%;
28+
--chart-3: 0 0% 93.33%;
29+
--chart-4: 0 0% 96.33%;
30+
--chart-5: 150 53% 45%;
31+
--radius: 0.5rem;
32+
}
33+
34+
.dark {
35+
--background: 0 0% 6.67%;
36+
--foreground: 0 0% 93.33%;
37+
--muted: 0 0% 14.9%;
38+
--muted-foreground: 0 0% 73.33%;
39+
--popover: 0 0% 6.67%;
40+
--popover-foreground: 0 0% 93.33%;
41+
--card: 0 0% 6.67%;
42+
--card-foreground: 0 0% 93.33%;
43+
--border: 0 0% 14.9%;
44+
--input: 0 0% 14.9%;
45+
--primary: 150.24 50% 40%;
46+
--primary-foreground: 0 0% 93.33%;
47+
--secondary: 0 0% 14.9%;
48+
--secondary-foreground: 0 0% 93.33%;
49+
--accent: 0 0% 14.9%;
50+
--accent-foreground: 0 0% 93.33%;
51+
--destructive: 0 50% 50%;
52+
--destructive-foreground: 0 0% 93.33%;
53+
--ring: 150 50% 40%;
54+
--chart-1: 150.24 50% 40%;
55+
--chart-2: 0 0% 14.9%;
56+
--chart-3: 0 0% 14.9%;
57+
--chart-4: 0 0% 17.9%;
58+
--chart-5: 150.24 53% 40%;
59+
}
3260
}
33-
34-
.dark {
35-
--background: 90 46% 4%;
36-
--foreground: 90 28% 100%;
37-
--muted: 90 0% 12.31%;
38-
--muted-foreground: 90 0% 100%;
39-
--popover: 90 0% 16.92%;
40-
--popover-foreground: 90 100% 50%;
41-
--card: 90 1.86% 10.82%;
42-
--card-foreground: 90 28% 100%;
43-
--border: 90 0% 38.72%;
44-
--input: 90 9.67% 20.34%;
45-
--primary: 90 42.06% 50.59%;
46-
--primary-foreground: 90 0% 100%;
47-
--secondary: 90 28.06% 57.59%;
48-
--secondary-foreground: 90 0% 100%;
49-
--accent: 90 0% 36.15%;
50-
--accent-foreground: 90 100% 95.77%;
51-
--destructive: 2 81% 54%;
52-
--destructive-foreground: 0 0% 100%;
53-
--ring: 90 42% 51%;
54-
--chart-1: 90 100% 74.78%;
55-
--chart-2: 90 60.1% 65.94%;
56-
--chart-3: 90 100% 78.94%;
57-
--chart-4: 90 61.88% 63.67%;
58-
--chart-5: 90 44.31% 52.11%;
59-
}
60-
}
61+
6162

6263
@layer base {
6364
* {

src/app/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import "./globals.css";
44
import { Footer } from "@/components/layout/footer";
55
import { Toaster } from "@/components/ui/toaster";
66
import { ThemeProvider } from "@/components/theme/theme-provider";
7+
78
const NotoSans = Noto_Sans_KR({
89
variable: "--font-geist-sans",
910
subsets: ["latin"],
@@ -32,7 +33,6 @@ export default function RootLayout({
3233
<ThemeProvider
3334
attribute="class"
3435
defaultTheme="dark"
35-
enableSystem
3636
disableTransitionOnChange
3737
>
3838
{children}

src/app/openings/[...slugs]/page.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,27 @@ type OpeningPageProps = {
1515
}>;
1616
};
1717

18+
// 정적 경로 생성 함수 추가
19+
export async function generateStaticParams() {
20+
try {
21+
if (!prisma?.opening) {
22+
console.log("Prisma not available during build, returning empty paths");
23+
return [];
24+
}
25+
26+
const openings = await prisma.opening.findMany({
27+
select: { urlName: true },
28+
});
29+
30+
return openings.map((opening: { urlName: string; }) => ({
31+
slugs: opening.urlName.split('/'),
32+
}));
33+
} catch (error) {
34+
console.log("Error generating static params:", error);
35+
return []; // 빌드 실패를 방지하기 위해 빈 배열 반환
36+
}
37+
}
38+
1839
async function getOpeningFromPath(openingPath: string) {
1940
if (!prisma?.opening) {
2041
console.error("Prisma or Opening model is not initialized.");

0 commit comments

Comments
 (0)