Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
78485e24
Commit
78485e24
authored
Sep 17, 2017
by
lain
Browse files
Fixup old migrations.
parent
7c82b821
Changes
5
Hide whitespace changes
Inline
Side-by-side
priv/repo/migrations/20170501124823_add_id_contraints_to_activities_and_objects.exs
View file @
78485e24
...
...
@@ -2,7 +2,8 @@ defmodule Pleroma.Repo.Migrations.AddIdContraintsToActivitiesAndObjects do
use
Ecto
.
Migration
def
change
do
create
index
(
:objects
,
[
"(data->>
\"
id
\"
)"
],
name:
:objects_unique_apid_index
)
create
index
(
:activities
,
[
"(data->>
\"
id
\"
)"
],
name:
:activities_unique_apid_index
)
# This was wrong, make it a noop.
# create index(:objects, ["(data->>\"id\")"], name: :objects_unique_apid_index)
# create index(:activities, ["(data->>\"id\")"], name: :activities_unique_apid_index)
end
end
priv/repo/migrations/20170501133231_add_id_contraints_to_activities_and_objects_part_two.exs
View file @
78485e24
...
...
@@ -2,8 +2,8 @@ defmodule Pleroma.Repo.Migrations.AddIdContraintsToActivitiesAndObjectsPartTwo d
use
Ecto
.
Migration
def
change
do
drop
index
(
:objects
,
[
"(data->>
\"
id
\"
)"
],
name:
:objects_unique_apid_index
)
drop
index
(
:activities
,
[
"(data->>
\"
id
\"
)"
],
name:
:activities_unique_apid_index
)
drop
_if_exists
index
(
:objects
,
[
"(data->>
\"
id
\"
)"
],
name:
:objects_unique_apid_index
)
drop
_if_exists
index
(
:activities
,
[
"(data->>
\"
id
\"
)"
],
name:
:activities_unique_apid_index
)
create
unique_index
(
:objects
,
[
"(data->>'id')"
],
name:
:objects_unique_apid_index
)
create
unique_index
(
:activities
,
[
"(data->>'id')"
],
name:
:activities_unique_apid_index
)
end
...
...
priv/repo/migrations/20170620133028_add_object_activity_index.exs
View file @
78485e24
...
...
@@ -2,6 +2,7 @@ defmodule Pleroma.Repo.Migrations.AddObjectActivityIndex do
use
Ecto
.
Migration
def
change
do
create
index
(
:objects
,
[
"(data->'object'->>'id')"
,
"(data->>'type')"
],
name:
:activities_create_objects_index
)
# This was wrong, now a noop
# create index(:objects, ["(data->'object'->>'id')", "(data->>'type')"], name: :activities_create_objects_index)
end
end
priv/repo/migrations/20170620142420_add_object_activity_index_part_two.exs
View file @
78485e24
...
...
@@ -2,7 +2,7 @@ defmodule Pleroma.Repo.Migrations.AddObjectActivityIndexPartTwo do
use
Ecto
.
Migration
def
change
do
drop
index
(
:objects
,
[
"(data->'object'->>'id')"
,
"(data->>'type')"
],
name:
:activities_create_objects_index
)
drop
_if_exists
index
(
:objects
,
[
"(data->'object'->>'id')"
,
"(data->>'type')"
],
name:
:activities_create_objects_index
)
create
index
(
:activities
,
[
"(data->'object'->>'id')"
,
"(data->>'type')"
],
name:
:activities_create_objects_index
)
end
end
priv/repo/migrations/20170719152213_add_follower_address_to_user.exs
View file @
78485e24
...
...
@@ -8,21 +8,23 @@ def up do
alter
table
(
:users
)
do
add
:follower_address
,
:string
,
unique:
true
end
flush
()
children
=
[
# Start the endpoint when the application starts
supervisor
(
Pleroma
.
Web
.
Endpoint
,
[])
]
opts
=
[
strategy:
:one_for_one
,
name:
Pleroma
.
Supervisor
]
Supervisor
.
start_link
(
children
,
opts
)
# Not needed anymore for new setups.
# flush()
Enum
.
each
(
Repo
.
all
(
User
),
fn
(
user
)
->
if
!user
.
follower_address
do
cs
=
Ecto
.
Changeset
.
change
(
user
,
%{
follower_address:
User
.
ap_followers
(
user
)})
Repo
.
update!
(
cs
)
end
end
)
# children = [
# # Start the endpoint when the application starts
# supervisor(Pleroma.Web.Endpoint, [])
# ]
# opts = [strategy: :one_for_one, name: Pleroma.Supervisor]
# Supervisor.start_link(children, opts)
# Enum.each(Repo.all(User), fn (user) ->
# if !user.follower_address do
# cs = Ecto.Changeset.change(user, %{follower_address: User.ap_followers(user)})
# Repo.update!(cs)
# end
# end)
end
def
down
do
...
...
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