瀏覽代碼

Fix bookmark migration using a query with a schema

This resulted in failures when updating from Pleroma <1.0 because of all
the new fields that were added to the user schema.
environments/review-fix-dokku-evrk7p/deployments/949
rinpatch 4 年之前
父節點
當前提交
c546da7cfe
共有 1 個檔案被更改,包括 3 行新增3 行删除
  1. +3
    -3
      priv/repo/migrations/20190414125034_migrate_old_bookmarks.exs

+ 3
- 3
priv/repo/migrations/20190414125034_migrate_old_bookmarks.exs 查看文件

@@ -8,10 +8,10 @@ defmodule Pleroma.Repo.Migrations.MigrateOldBookmarks do

def up do
query =
from(u in User,
from(u in "users",
where: u.local == true,
where: fragment("array_length(bookmarks, 1)") > 0,
select: %{id: u.id, bookmarks: fragment("bookmarks")}
where: fragment("array_length(?, 1)", u.bookmarks) > 0,
select: %{id: u.id, bookmarks: u.bookmarks}
)

Repo.stream(query)


Loading…
取消
儲存