mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
fix(migration): Avoid unique constraint violation
This commit is contained in:
parent
0f334bc163
commit
ed7b739d98
@ -24,9 +24,9 @@ export async function up() {
|
|||||||
`
|
`
|
||||||
MATCH (post:Post)
|
MATCH (post:Post)
|
||||||
WHERE post.image IS NOT NULL
|
WHERE post.image IS NOT NULL
|
||||||
CREATE (post)-[:HERO_IMAGE]->(image:Image)
|
MERGE(image:Image {url: post.image})
|
||||||
|
CREATE (post)-[:HERO_IMAGE]->(image)
|
||||||
SET
|
SET
|
||||||
image.url = post.image,
|
|
||||||
image.sensitive = post.imageBlurred,
|
image.sensitive = post.imageBlurred,
|
||||||
image.aspectRatio = post.imageAspectRatio
|
image.aspectRatio = post.imageAspectRatio
|
||||||
REMOVE
|
REMOVE
|
||||||
@ -37,15 +37,15 @@ export async function up() {
|
|||||||
`
|
`
|
||||||
MATCH (user:User)
|
MATCH (user:User)
|
||||||
WHERE user.avatar IS NOT NULL
|
WHERE user.avatar IS NOT NULL
|
||||||
CREATE (user)-[:AVATAR_IMAGE]->(avatar:Image)
|
MERGE(avatar:Image {url: user.avatar})
|
||||||
SET avatar.url = user.avatar
|
CREATE (user)-[:AVATAR_IMAGE]->(avatar)
|
||||||
REMOVE user.avatar
|
REMOVE user.avatar
|
||||||
`,
|
`,
|
||||||
`
|
`
|
||||||
MATCH (user:User)
|
MATCH (user:User)
|
||||||
WHERE user.coverImg IS NOT NULL
|
WHERE user.coverImg IS NOT NULL
|
||||||
CREATE (user)-[:COVER_IMAGE]->(coverImage:Image)
|
MERGE(coverImage:Image {url: user.coverImg})
|
||||||
SET coverImage.url = user.coverImg
|
CREATE (user)-[:COVER_IMAGE]->(coverImage)
|
||||||
REMOVE user.coverImg
|
REMOVE user.coverImg
|
||||||
`,
|
`,
|
||||||
].map(s => txc.run(s)),
|
].map(s => txc.run(s)),
|
||||||
Loading…
x
Reference in New Issue
Block a user