chore: remove unused code + delete existing feeds before seeding
This commit is contained in:
parent
3774c0b6db
commit
60cb0083f5
@ -13,22 +13,6 @@ function generateRandomChannelId() {
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min + '';
|
||||
}
|
||||
|
||||
function createRandomChannels(): Prisma.Prisma.ChannelCreateNestedManyWithoutFeedInput {
|
||||
if (Math.random() < 0.5) {
|
||||
return { createMany: { data: [] } };
|
||||
}
|
||||
|
||||
const channels: Prisma.Prisma.ChannelCreateNestedManyWithoutFeedInput = {
|
||||
createMany: {
|
||||
data: Array.from({ length: 5 }, () => ({
|
||||
channel_id: generateRandomChannelId()
|
||||
}))
|
||||
}
|
||||
};
|
||||
|
||||
return channels;
|
||||
}
|
||||
|
||||
async function createManyChannels(feedId: number) {
|
||||
const channelData: Prisma.Prisma.ChannelCreateManyInput[] = [ ];
|
||||
|
||||
@ -44,6 +28,10 @@ async function createManyChannels(feedId: number) {
|
||||
await client.channel.createMany({ data: channelData });
|
||||
}
|
||||
|
||||
async function deleteAllFeeds() {
|
||||
await client.feed.deleteMany()
|
||||
}
|
||||
|
||||
async function createManyFeeds() {
|
||||
const feedData: Prisma.Prisma.FeedCreateManyInput[] = [ ];
|
||||
|
||||
@ -69,6 +57,7 @@ async function createManyFeeds() {
|
||||
}
|
||||
|
||||
async function main() {
|
||||
await deleteAllFeeds();
|
||||
await createManyFeeds();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user