Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
pleroma
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
392
Issues
392
List
Boards
Labels
Service Desk
Milestones
Merge Requests
54
Merge Requests
54
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pleroma
pleroma
Commits
93605025
Commit
93605025
authored
Jul 10, 2019
by
Alexander Strizhakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
saving following_address for existing users
parent
f8786fa6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
priv/repo/migrations/20190710125158_add_following_address_from_source_data.exs
...20190710125158_add_following_address_from_source_data.exs
+20
-0
No files found.
priv/repo/migrations/20190710125158_add_following_address_from_source_data.exs
0 → 100644
View file @
93605025
defmodule
Pleroma
.
Repo
.
Migrations
.
AddFollowingAddressFromSourceData
do
use
Ecto
.
Migration
import
Ecto
.
Query
alias
Pleroma
.
User
def
change
do
query
=
User
.
external_users_query
()
|>
select
([
u
],
struct
(
u
,
[
:id
,
:ap_id
,
:info
]))
Pleroma
.
Repo
.
stream
(
query
)
|>
Enum
.
each
(
fn
%{
info:
%{
source_data:
source_data
}}
=
user
->
Ecto
.
Changeset
.
cast
(
user
,
%{
following_address:
source_data
[
"following"
]},
[
:following_address
])
|>
Pleroma
.
Repo
.
update
()
end
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment