-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_fkey_again.js
More file actions
18 lines (16 loc) · 934 Bytes
/
Copy pathfix_fkey_again.js
File metadata and controls
18 lines (16 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const fs = require('fs');
function replaceStr(file, target, rep) {
const path = require('path').resolve(__dirname, file);
if (fs.existsSync(path)) {
let c = fs.readFileSync(path, 'utf8');
fs.writeFileSync(path, c.split(target).join(rep));
console.log('Fixed:', file);
} else {
console.log('File not found:', path);
}
}
replaceStr('./src/app/api/users/[userId]/posts/route.ts', 'author:users!posts_author_id_fkey(', 'author:users!author_id(');
replaceStr('./src/app/api/posts/[postId]/route.ts', 'author:users!posts_author_id_fkey(', 'author:users!author_id(');
replaceStr('./src/app/api/posts/route.ts', 'author:users!posts_author_id_fkey(', 'author:users!author_id(');
replaceStr('./src/app/api/feed/route.ts', 'author:users!posts_author_id_fkey(', 'author:users!author_id(');
replaceStr('./src/app/api/posts/[postId]/comments/route.ts', 'author:users!comments_author_id_fkey(', 'author:users!author_id(');