forked from IT-Academy-BCN/ita-wiki
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request IT-Academy-BCN#201 from IT-Academy-BCN/190-be-crea…
…te-new-unique-column-slug-on-topics-and-resources 190 be create new unique column slug on topics and resources
- Loading branch information
Showing
11 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -330,6 +330,8 @@ paths: | |
type: string | ||
title: | ||
type: string | ||
slug: | ||
type: string | ||
description: | ||
type: string | ||
url: | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
import { Prisma } from '@prisma/client' | ||
import slugify from 'slugify' | ||
|
||
export const topics: Omit< | ||
Prisma.TopicCreateArgs['data'], | ||
'categoryId' | ||
>[] = [ | ||
{ | ||
name: "Components", | ||
slug: slugify("Components", { lower: true }) | ||
}, | ||
{ | ||
name: "Eventos", | ||
slug: slugify("Eventos", { lower: true }) | ||
}, | ||
{ | ||
name: "Listas", | ||
slug: slugify("Listas", { lower: true }) | ||
}, | ||
{ | ||
name: "Estilos", | ||
slug: slugify("Estilos", { lower: true }) | ||
} | ||
] |
20 changes: 20 additions & 0 deletions
20
back/prisma/migrations/20230428085924_add_slug_columns/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
Warnings: | ||
- A unique constraint covering the columns `[slug]` on the table `resource` will be added. If there are existing duplicate values, this will fail. | ||
- A unique constraint covering the columns `[slug]` on the table `topic` will be added. If there are existing duplicate values, this will fail. | ||
- Added the required column `slug` to the `resource` table without a default value. This is not possible if the table is not empty. | ||
- Added the required column `slug` to the `topic` table without a default value. This is not possible if the table is not empty. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "resource" ADD COLUMN "slug" TEXT NOT NULL; | ||
|
||
-- AlterTable | ||
ALTER TABLE "topic" ADD COLUMN "slug" TEXT NOT NULL; | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "resource_slug_key" ON "resource"("slug"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "topic_slug_key" ON "topic"("slug"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters