mirror of
https://github.com/bonfire-networks/bonfire-app.git
synced 2024-05-05 10:48:43 +00:00
This commit is contained in:
parent
741d3abeed
commit
73cfe18ced
|
@ -267,7 +267,7 @@ how useful this is in practice, so we might go for a simpler option in future.
|
|||
Example:
|
||||
|
||||
```elixir
|
||||
defmodule Bonfire.Data.Social.APActivity.Migration do
|
||||
defmodule Bonfire.Data.Social.APActivity.Migration do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
import Needle.Migration
|
||||
|
|
|
@ -2,14 +2,15 @@ defmodule Bonfire.Repo.Migrations.InitPointers do
|
|||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
import Needle.Migration
|
||||
import Needle.ULID.Migration
|
||||
|
||||
def up do
|
||||
init_pointers_ulid_extra()
|
||||
init_pointers()
|
||||
end
|
||||
def up(), do: init(:up)
|
||||
def down(), do: init(:down)
|
||||
|
||||
def down do
|
||||
init_pointers_ulid_extra()
|
||||
init_pointers()
|
||||
defp init(dir) do
|
||||
# this one is optional but recommended
|
||||
init_pointers_ulid_extra(dir)
|
||||
# this one is not optional
|
||||
init_pointers(dir)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Bonfire.Federate.ActivityPub.Repo.Migrations.ImportMe do
|
||||
defmodule Bonfire.Federate.ActivityPub.Repo.Migrations.ImportAP do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
defmodule Bonfire.Social.Graph.Repo.Migrations.ImportSocial do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Social.Graph.Migrations
|
||||
import Needle.Migration
|
||||
|
||||
def up do
|
||||
migrate_social()
|
||||
end
|
||||
|
||||
def down, do: migrate_social()
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
defmodule Bonfire.Posts.Repo.Migrations.ImportSocial do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Posts.Migrations
|
||||
import Needle.Migration
|
||||
|
||||
def up do
|
||||
migrate_social()
|
||||
end
|
||||
|
||||
def down, do: migrate_social()
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
defmodule Bonfire.Messages.Repo.Migrations.ImportSocial do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Messages.Migrations
|
||||
import Needle.Migration
|
||||
|
||||
def up do
|
||||
migrate_social()
|
||||
end
|
||||
|
||||
def down, do: migrate_social()
|
||||
end
|
|
@ -3,14 +3,10 @@ defmodule Bonfire.Repo.Migrations.ImportClassify do
|
|||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
if Code.ensure_loaded?(Bonfire.Classify.Migrations) do
|
||||
Bonfire.Classify.Migrations.up()
|
||||
end
|
||||
Bonfire.Classify.Migrations.up()
|
||||
end
|
||||
|
||||
def down do
|
||||
if Code.ensure_loaded?(Bonfire.Classify.Migrations) do
|
||||
Bonfire.Classify.Migrations.down()
|
||||
end
|
||||
Bonfire.Classify.Migrations.down()
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Bonfire.Repo.Migrations.ImportSharedUser do
|
||||
defmodule Bonfire.Data.SharedUser.ImportSharedUser do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
defmodule Bonfire.Posts.Repo.Migrations.Import do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Posts.Migrations
|
||||
|
||||
def change, do: migrate_posts()
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
defmodule Bonfire.Messages.Repo.MessagesMigrations do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Messages.Migrations
|
||||
|
||||
def change, do: migrate_messages()
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
defmodule Bonfire.Social.Graph.Repo.Migrations.Import do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Social.Graph.Migrations
|
||||
|
||||
def change, do: migrate_social_graph()
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Bonfire.Social.Repo.Migrations.ProfileImages do
|
||||
defmodule Bonfire.UI.Me.Repo.Migrations.ProfileImages do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Bonfire.Repo.Migrations.FP do
|
||||
defmodule Bonfire.Social.Repo.Migrations.FeedPublish do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Bonfire.Social.Repo.Migrations.PeeredURI do
|
||||
defmodule Bonfire.Federate.ActivityPub.Repo.Migrations.PeeredURI do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
defmodule Bonfire.Repo.Migrations.UpdateObanJobsTable do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def up, do: Oban.Migrations.up()
|
||||
|
||||
def down, do: nil
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
defmodule Bonfire.Repo.Migrations.Seen do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
require Bonfire.Data.Social.Seen.Migration
|
||||
|
||||
def up do
|
||||
Bonfire.Data.Social.Seen.Migration.migrate_seen()
|
||||
end
|
||||
|
||||
def down do
|
||||
Bonfire.Data.Social.Seen.Migration.migrate_seen()
|
||||
end
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
defmodule Bonfire.Common.Repo.Migrations.CreateObanPeers do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def up, do: Oban.Migrations.up(version: 11)
|
||||
|
||||
def down, do: Oban.Migrations.down(version: 11)
|
||||
end
|
|
@ -3,9 +3,7 @@ defmodule Bonfire.Repo.Migrations.ClassifyAddType do
|
|||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
if Code.ensure_loaded?(Bonfire.Classify.Migrations) do
|
||||
Bonfire.Classify.Migrations.add_type()
|
||||
end
|
||||
Bonfire.Classify.Migrations.add_type()
|
||||
end
|
||||
|
||||
def down do
|
||||
|
|
|
@ -4,16 +4,12 @@ defmodule Bonfire.Repo.Migrations.ClassifyAddTree do
|
|||
require Bonfire.Classify.Tree.Migration
|
||||
|
||||
def up do
|
||||
if Code.ensure_loaded?(Bonfire.Classify.Tree.Migration) do
|
||||
Bonfire.Classify.Tree.Migration.migrate_tree()
|
||||
Bonfire.Classify.Tree.Migration.migrate_functions()
|
||||
end
|
||||
Bonfire.Classify.Tree.Migration.migrate_tree()
|
||||
Bonfire.Classify.Tree.Migration.migrate_functions()
|
||||
end
|
||||
|
||||
def down do
|
||||
if Code.ensure_loaded?(Bonfire.Classify.Tree.Migration) do
|
||||
Bonfire.Classify.Tree.Migration.migrate_functions()
|
||||
Bonfire.Classify.Tree.Migration.migrate_tree()
|
||||
end
|
||||
Bonfire.Classify.Tree.Migration.migrate_functions()
|
||||
Bonfire.Classify.Tree.Migration.migrate_tree()
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
defmodule Bonfire.Social.Repo.Migrations.ArrayFn do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def up, do: Bonfire.Social.Migrations.add_array_reverse_fn()
|
||||
def down, do: nil
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Bonfire.Repo.Migrations.GinIndexes do
|
||||
defmodule Bonfire.Search.Repo.Migrations.GinIndexes do
|
||||
use Ecto.Migration
|
||||
|
||||
@disable_ddl_transaction true
|
||||
|
|
|
@ -370,7 +370,7 @@ const createEditor = async (_this, hidden_input, composer$) => {
|
|||
referenceElement: trigger,
|
||||
triggerElement: trigger,
|
||||
emojiSize: '1.75rem',
|
||||
className: 'z-[9999]',
|
||||
className: 'z-[99999999999999999999]',
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -17,77 +17,92 @@ let PreviewActivity = {
|
|||
mounted() {
|
||||
this.el.addEventListener("click", e => {
|
||||
console.log("PreviewActivity clicked")
|
||||
console.log("where clicked")
|
||||
let trigger = this.el.querySelector('.open_preview_link')
|
||||
let anchor = e.target.closest('a')
|
||||
let anchor = e.target.closest('a')
|
||||
console.log(e.target)
|
||||
|
||||
// this was used to expand long posts by clicking on them, now replaced with a 'Read more' button
|
||||
// let previewable_activity = e.target.closest('.previewable_activity')
|
||||
// anchor == trigger || (!anchor && previewable_activity && ( previewable_activity.classList.contains('previewable_expanded') || this.isTruncated(previewable_activity.querySelector('.previewable_truncate')) == false)
|
||||
// this was used to expand long posts by clicking on them, now replaced with a 'Read more' button
|
||||
// let previewable_activity = e.target.closest('.previewable_activity')
|
||||
// anchor == trigger || (!anchor && previewable_activity && ( previewable_activity.classList.contains('previewable_expanded') || this.isTruncated(previewable_activity.querySelector('.previewable_truncate')) == false)
|
||||
|
||||
if (trigger && ((!anchor || anchor.classList.contains('preview_activity_link')) && !e.ctrlKey && !e.metaKey && !window.getSelection().toString() && !e.target.closest('button') && !e.target.closest('figure') && !e.target.closest('.dropdown') && !e.target.closest('[data-id=activity_actions]')
|
||||
)) {
|
||||
let uri = this.el.dataset.href || (trigger !== undefined && trigger.getAttribute('href')) //this.el.dataset.permalink
|
||||
if (window.liveSocket) {
|
||||
// const feed = document.querySelector(".feed")
|
||||
const main = document.getElementById("inner")
|
||||
const layout = document.getElementById("root")
|
||||
const preview_content = document.getElementById("preview_content")
|
||||
let previous_scroll = null
|
||||
if ((trigger || !window.liveSocket) && ((!anchor || anchor.classList.contains('preview_activity_link')) && !e.ctrlKey && !e.metaKey && (!window.getSelection().toString() || window.getSelection().toString() == "") && !e.target.closest('button') && !e.target.closest('figure') && !e.target.closest('.dropdown') && !e.target.closest('[data-id=activity_actions]')
|
||||
)) {
|
||||
let uri = this.el.dataset.href || (trigger !== undefined && trigger.getAttribute('href'))
|
||||
if (window.liveSocket) {
|
||||
// const feed = document.querySelector(".feed")
|
||||
const main = document.getElementById("inner")
|
||||
const layout = document.getElementById("root")
|
||||
const preview_content = document.getElementById("preview_content")
|
||||
let previous_scroll = null
|
||||
|
||||
console.log("push event to load up the PreviewContent")
|
||||
this.pushEventTo(trigger, "open", {})
|
||||
console.log("push event to load up the PreviewContent")
|
||||
this.pushEventTo(trigger, "open", {})
|
||||
|
||||
// this.pushEvent("Bonfire.Social.Feeds:open_activity", { id: this.el.dataset.id, permalink: uri })
|
||||
// this.pushEvent("Bonfire.Social.Feeds:open_activity", { id: this.el.dataset.id, permalink: uri })
|
||||
|
||||
if (layout) {
|
||||
previous_scroll = layout.scrollTop
|
||||
if (layout) {
|
||||
previous_scroll = layout.scrollTop
|
||||
}
|
||||
|
||||
if (preview_content) {
|
||||
preview_content.classList.remove("hidden")
|
||||
}
|
||||
if (main) {
|
||||
main.classList.add("hidden")
|
||||
}
|
||||
if (uri) {
|
||||
// console.log(uri)
|
||||
|
||||
history.pushState(
|
||||
{
|
||||
'previous_url': document.location.href,
|
||||
'previous_scroll': previous_scroll
|
||||
},
|
||||
'',
|
||||
uri)
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
} else {
|
||||
|
||||
// fallback if not connected with live socket
|
||||
|
||||
if (uri) {
|
||||
console.log(uri)
|
||||
window.location = uri;
|
||||
e.preventDefault();
|
||||
} else {
|
||||
console.log("No URL")
|
||||
}
|
||||
}
|
||||
|
||||
if (preview_content) {
|
||||
preview_content.classList.remove("hidden")
|
||||
}
|
||||
if (main) {
|
||||
main.classList.add("hidden")
|
||||
}
|
||||
if (uri) {
|
||||
// console.log(uri)
|
||||
|
||||
history.pushState(
|
||||
{
|
||||
'previous_url': document.location.href,
|
||||
'previous_scroll': previous_scroll
|
||||
},
|
||||
'',
|
||||
uri)
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
} else {
|
||||
|
||||
// fallback if not connected with live socket
|
||||
|
||||
if (uri) {
|
||||
console.log(uri)
|
||||
window.location = uri;
|
||||
e.preventDefault();
|
||||
} else {
|
||||
console.log("No URL")
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// e.preventDefault();
|
||||
|
||||
console.log("PreviewActivity: do not trigger preview in favour of another link or button's action (or opening in new tab)")
|
||||
|
||||
// if (previewable_activity) { previewable_activity.classList.add("previewable_expanded") }
|
||||
console.log(trigger)
|
||||
console.log(window.liveSocket)
|
||||
console.log(anchor)
|
||||
console.log(anchor.classList)
|
||||
console.log(e.ctrlKey)
|
||||
console.log(e.metaKey)
|
||||
console.log(window.getSelection().toString())
|
||||
console.log(e.target.closest('button'))
|
||||
console.log(e.target.closest('figure'))
|
||||
console.log(e.target.closest('.dropdown'))
|
||||
console.log(e.target.closest('[data-id=activity_actions]'))
|
||||
|
||||
// if (previewable_activity) { previewable_activity.classList.add("previewable_expanded") }
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
This file was generated by the Surface compiler.
|
||||
*/
|
||||
|
||||
|
||||
export default {
|
||||
timeAgo(input) {
|
||||
const locale = (navigator.languages && navigator.languages.length) ? navigator.languages[0] : navigator.language; // TODO: use app local instead of browser locale
|
||||
const date = (input instanceof Date) ? input : new Date(input);
|
||||
const formatter = new Intl.RelativeTimeFormat(locale);
|
||||
const ranges = {
|
||||
years: 3600 * 24 * 365,
|
||||
months: 3600 * 24 * 30,
|
||||
weeks: 3600 * 24 * 7,
|
||||
days: 3600 * 24,
|
||||
hours: 3600,
|
||||
minutes: 60,
|
||||
seconds: 1
|
||||
};
|
||||
const secondsElapsed = (date.getTime() - Date.now()) / 1000;
|
||||
for (let key in ranges) {
|
||||
if (ranges[key] < Math.abs(secondsElapsed)) {
|
||||
const delta = secondsElapsed / ranges[key];
|
||||
return formatter.format(Math.round(delta), key);
|
||||
}
|
||||
}
|
||||
},
|
||||
setTimeAgo(el, the_date) {
|
||||
var date_ago = this.timeAgo(the_date)
|
||||
// console.log(date_ago)
|
||||
|
||||
if (date_ago) {
|
||||
this.el.innerHTML = date_ago
|
||||
|
||||
setTimeout(() => {
|
||||
this.setTimeAgo(el, the_date)
|
||||
}, 60_000);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
var the_date = this.el.getAttribute("data-date")
|
||||
// console.log(the_date)
|
||||
if (the_date) {
|
||||
setTimeout(() => {
|
||||
this.setTimeAgo(this.el, the_date)
|
||||
}, 60_000);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,6 +18,7 @@ import * as c5 from "./Bonfire.UI.Common.LoadMoreLive.hooks"
|
|||
import * as c6 from "./Bonfire.UI.Common.ChangeLocaleLive.hooks"
|
||||
import * as c7 from "./Bonfire.UI.Common.ChangeThemesLive.hooks"
|
||||
import * as c8 from "./Bonfire.UI.Common.ComposerLive.hooks"
|
||||
import * as c9 from "./Bonfire.UI.Social.Activity.DateAgoLive.hooks"
|
||||
|
||||
let hooks = Object.assign(
|
||||
ns(c1, "Bonfire.Editor.Milkdown"),
|
||||
|
@ -27,7 +28,8 @@ let hooks = Object.assign(
|
|||
ns(c5, "Bonfire.UI.Common.LoadMoreLive"),
|
||||
ns(c6, "Bonfire.UI.Common.ChangeLocaleLive"),
|
||||
ns(c7, "Bonfire.UI.Common.ChangeThemesLive"),
|
||||
ns(c8, "Bonfire.UI.Common.ComposerLive")
|
||||
ns(c8, "Bonfire.UI.Common.ComposerLive"),
|
||||
ns(c9, "Bonfire.UI.Social.Activity.DateAgoLive")
|
||||
)
|
||||
|
||||
export default hooks
|
||||
|
|
|
@ -2,14 +2,15 @@ defmodule Bonfire.Repo.Migrations.InitPointers do
|
|||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
import Needle.Migration
|
||||
import Needle.ULID.Migration
|
||||
|
||||
def up do
|
||||
init_pointers_ulid_extra()
|
||||
init_pointers()
|
||||
end
|
||||
def up(), do: init(:up)
|
||||
def down(), do: init(:down)
|
||||
|
||||
def down do
|
||||
init_pointers_ulid_extra()
|
||||
init_pointers()
|
||||
defp init(dir) do
|
||||
# this one is optional but recommended
|
||||
init_pointers_ulid_extra(dir)
|
||||
# this one is not optional
|
||||
init_pointers(dir)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Bonfire.Federate.ActivityPub.Repo.Migrations.ImportMe do
|
||||
defmodule Bonfire.Federate.ActivityPub.Repo.Migrations.ImportAP do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
defmodule Bonfire.Social.Graph.Repo.Migrations.ImportSocial do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Social.Graph.Migrations
|
||||
import Needle.Migration
|
||||
|
||||
def up do
|
||||
migrate_social()
|
||||
end
|
||||
|
||||
def down, do: migrate_social()
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
defmodule Bonfire.Posts.Repo.Migrations.ImportSocial do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Posts.Migrations
|
||||
import Needle.Migration
|
||||
|
||||
def up do
|
||||
migrate_social()
|
||||
end
|
||||
|
||||
def down, do: migrate_social()
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
defmodule Bonfire.Messages.Repo.Migrations.ImportSocial do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Messages.Migrations
|
||||
import Needle.Migration
|
||||
|
||||
def up do
|
||||
migrate_social()
|
||||
end
|
||||
|
||||
def down, do: migrate_social()
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Bonfire.Repo.Migrations.ImportSharedUser do
|
||||
defmodule Bonfire.Data.SharedUser.ImportSharedUser do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
defmodule Bonfire.Posts.Repo.Migrations.Import do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Posts.Migrations
|
||||
|
||||
def change, do: migrate_posts()
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
defmodule Bonfire.Messages.Repo.MessagesMigrations do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Messages.Migrations
|
||||
|
||||
def change, do: migrate_messages()
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
defmodule Bonfire.Social.Graph.Repo.Migrations.Import do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Social.Graph.Migrations
|
||||
|
||||
def change, do: migrate_social_graph()
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Bonfire.Social.Repo.Migrations.ProfileImages do
|
||||
defmodule Bonfire.UI.Me.Repo.Migrations.ProfileImages do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Bonfire.Repo.Migrations.FP do
|
||||
defmodule Bonfire.Social.Repo.Migrations.FeedPublish do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Bonfire.Social.Repo.Migrations.PeeredURI do
|
||||
defmodule Bonfire.Federate.ActivityPub.Repo.Migrations.PeeredURI do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
defmodule Bonfire.Repo.Migrations.UpdateObanJobsTable do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def up, do: Oban.Migrations.up()
|
||||
|
||||
def down, do: nil
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
defmodule Bonfire.Repo.Migrations.Seen do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
require Bonfire.Data.Social.Seen.Migration
|
||||
|
||||
def up do
|
||||
Bonfire.Data.Social.Seen.Migration.migrate_seen()
|
||||
end
|
||||
|
||||
def down do
|
||||
Bonfire.Data.Social.Seen.Migration.migrate_seen()
|
||||
end
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
defmodule Bonfire.Repo.Migrations.AuthSecondFactor do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
require Bonfire.Data.Identity.AuthSecondFactor.Migration
|
||||
|
||||
def up do
|
||||
Bonfire.Data.Identity.AuthSecondFactor.Migration.migrate_auth_second_factor()
|
||||
end
|
||||
|
||||
def down do
|
||||
Bonfire.Data.Identity.AuthSecondFactor.Migration.migrate_auth_second_factor()
|
||||
end
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
defmodule Bonfire.Repo.Migrations.ExtraInfo do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
require Bonfire.Data.Identity.ExtraInfo.Migration
|
||||
|
||||
def up do
|
||||
Bonfire.Data.Identity.ExtraInfo.Migration.migrate_extra_info(:up)
|
||||
end
|
||||
|
||||
def down do
|
||||
Bonfire.Data.Identity.ExtraInfo.Migration.migrate_extra_info(:down)
|
||||
end
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
defmodule Bonfire.Common.Repo.Migrations.CreateObanPeers do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def up, do: Oban.Migrations.up(version: 11)
|
||||
|
||||
def down, do: Oban.Migrations.down(version: 11)
|
||||
end
|
|
@ -3,9 +3,7 @@ defmodule Bonfire.Repo.Migrations.ClassifyAddType do
|
|||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
if Code.ensure_loaded?(Bonfire.Classify.Migrations) do
|
||||
Bonfire.Classify.Migrations.add_type()
|
||||
end
|
||||
Bonfire.Classify.Migrations.add_type()
|
||||
end
|
||||
|
||||
def down do
|
||||
|
|
|
@ -4,16 +4,12 @@ defmodule Bonfire.Repo.Migrations.ClassifyAddTree do
|
|||
require Bonfire.Classify.Tree.Migration
|
||||
|
||||
def up do
|
||||
if Code.ensure_loaded?(Bonfire.Classify.Tree.Migration) do
|
||||
Bonfire.Classify.Tree.Migration.migrate_tree()
|
||||
Bonfire.Classify.Tree.Migration.migrate_functions()
|
||||
end
|
||||
Bonfire.Classify.Tree.Migration.migrate_tree()
|
||||
Bonfire.Classify.Tree.Migration.migrate_functions()
|
||||
end
|
||||
|
||||
def down do
|
||||
if Code.ensure_loaded?(Bonfire.Classify.Tree.Migration) do
|
||||
Bonfire.Classify.Tree.Migration.migrate_functions()
|
||||
Bonfire.Classify.Tree.Migration.migrate_tree()
|
||||
end
|
||||
Bonfire.Classify.Tree.Migration.migrate_functions()
|
||||
Bonfire.Classify.Tree.Migration.migrate_tree()
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
defmodule Bonfire.Search.Repo.Migrations.GinIndexes do
|
||||
use Ecto.Migration
|
||||
|
||||
@disable_ddl_transaction true
|
||||
@disable_migration_lock true
|
||||
# ^ Needed to migrate indexes concurrently.
|
||||
# Disabling DDL transactions removes the guarantee that all of the changes in the migration will happen at once.
|
||||
# Disabling the migration lock removes the guarantee only a single node will run a given migration if multiple nodes are attempting to migrate at the same time.
|
||||
|
||||
def up do
|
||||
execute "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
|
||||
|
||||
create_index("bonfire_data_social_named", "name")
|
||||
create_index("bonfire_data_identity_character", "username")
|
||||
|
||||
# create_index("bonfire_data_social_profile", "name")
|
||||
create_index_fields(
|
||||
"bonfire_data_social_profile",
|
||||
"name gin_trgm_ops, summary gin_trgm_ops"
|
||||
)
|
||||
|
||||
create_index_fields(
|
||||
"bonfire_data_social_post_content",
|
||||
# "name gin_trgm_ops, summary gin_trgm_ops, html_body gin_trgm_ops"
|
||||
"name gin_trgm_ops, summary gin_trgm_ops"
|
||||
)
|
||||
end
|
||||
|
||||
def down do
|
||||
# TODO
|
||||
end
|
||||
|
||||
def create_index(table, field) do
|
||||
create_index_fields(table, "#{field} gin_trgm_ops")
|
||||
end
|
||||
|
||||
def create_index_fields(table, fields) do
|
||||
execute """
|
||||
DROP INDEX IF EXISTS #{table}_gin_index;
|
||||
"""
|
||||
|
||||
execute """
|
||||
CREATE INDEX CONCURRENTLY #{table}_gin_index
|
||||
ON #{table}
|
||||
USING gin (#{fields});
|
||||
"""
|
||||
end
|
||||
end
|
13
flavours/community/repo/migrations/20240121084501_label.exs
Normal file
13
flavours/community/repo/migrations/20240121084501_label.exs
Normal file
|
@ -0,0 +1,13 @@
|
|||
defmodule Bonfire.Repo.Migrations.Label do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
require Bonfire.Label.Migration
|
||||
|
||||
def up do
|
||||
Bonfire.Label.Migration.migrate_label()
|
||||
end
|
||||
|
||||
def down do
|
||||
Bonfire.Label.Migration.migrate_label()
|
||||
end
|
||||
end
|
|
@ -1,21 +0,0 @@
|
|||
defmodule Rauversion.Repo.Migrations.CreateTracks do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:tracks) do
|
||||
add(:title, :string)
|
||||
add(:description, :text)
|
||||
add(:private, :boolean, default: false, null: false)
|
||||
add(:slug, :string)
|
||||
add(:caption, :text)
|
||||
add(:notification_settings, :map)
|
||||
add(:metadata, :map)
|
||||
add(:user_id, RauversionExtension.user_table_reference())
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create(index(:tracks, [:user_id]))
|
||||
end
|
||||
end
|
|
@ -1,18 +0,0 @@
|
|||
defmodule Rauversion.Repo.Migrations.CreatePlaylists do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:playlists) do
|
||||
add(:slug, :string)
|
||||
add(:description, :text)
|
||||
add(:title, :string)
|
||||
add(:metadata, :map)
|
||||
add(:user_id, RauversionExtension.user_table_reference())
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create(index(:playlists, [:user_id]))
|
||||
end
|
||||
end
|
|
@ -1,16 +0,0 @@
|
|||
defmodule Rauversion.Repo.Migrations.CreateTrackPlaylists do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:track_playlists) do
|
||||
add(:track_id, references(:tracks, on_delete: :nothing))
|
||||
add(:playlist, references(:playlists, on_delete: :nothing))
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create(index(:track_playlists, [:track_id]))
|
||||
create(index(:track_playlists, [:playlist]))
|
||||
end
|
||||
end
|
|
@ -1,58 +0,0 @@
|
|||
defmodule Chaskiq.Repo.Migrations.CreateActiveStorageTables do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:active_storage_blobs) do
|
||||
# add :id, :uuid, primary_key: true, null: false
|
||||
add(:key, :string, null: false)
|
||||
add(:filename, :string, null: false)
|
||||
add(:content_type, :string)
|
||||
add(:metadata, :string)
|
||||
add(:service_name, :string, null: false)
|
||||
add(:byte_size, :integer, null: false)
|
||||
add(:checksum, :string)
|
||||
|
||||
timestamps(inserted_at: :created_at, updated_at: :updated_at)
|
||||
end
|
||||
|
||||
create(unique_index(:active_storage_blobs, [:key]))
|
||||
|
||||
create table(:active_storage_attachments) do
|
||||
add(:name, :string, null: false)
|
||||
add(:record_id, :integer)
|
||||
add(:record_type, :string)
|
||||
|
||||
add(:blob_id, :integer)
|
||||
add(:blob_type, :string)
|
||||
|
||||
timestamps(inserted_at: :created_at, updated_at: :updated_at)
|
||||
end
|
||||
|
||||
create(
|
||||
index("active_storage_attachments", [:record_type, :record_id, :name, :blob_id],
|
||||
name: :index_active_storage_attachments_uniqueness,
|
||||
unique: true
|
||||
)
|
||||
)
|
||||
|
||||
create(
|
||||
index("active_storage_attachments", [:blob_id],
|
||||
name: :index_active_storage_attachments_on_blob_id,
|
||||
unique: false
|
||||
)
|
||||
)
|
||||
|
||||
create table(:active_storage_variant_records) do
|
||||
# for binary types use:
|
||||
# add :blob_id, references(:active_storage_blobs, on_delete: :nothing, type: :binary_id)
|
||||
add(:blob_id, references(:active_storage_blobs, on_delete: :nothing))
|
||||
add(:variation_digest, :string, null: false)
|
||||
timestamps(inserted_at: :created_at, updated_at: :updated_at)
|
||||
end
|
||||
|
||||
create(index(:active_storage_variant_records, [:blob_id, :variation_digest]))
|
||||
# with: [group_id: :group_id])
|
||||
# add :blob_id, references("active_storage_blobs")
|
||||
end
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
defmodule Rauversion.Repo.Migrations.AlterPlaylistFielfToTrackPlaylists do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
rename(table("track_playlists"), :playlist, to: :playlist_id)
|
||||
end
|
||||
end
|
|
@ -1,10 +0,0 @@
|
|||
defmodule Rauversion.Repo.Migrations.AddPrivateToPlaylist do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
alter table(:playlists) do
|
||||
add(:private, :boolean)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,12 +0,0 @@
|
|||
defmodule Rauversion.Repo.Migrations.AddTypeToPlaylist do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
alter table(:playlists) do
|
||||
add(:playlist_type, :string)
|
||||
add(:genre, :string)
|
||||
add(:release_date, :utc_datetime)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,11 +0,0 @@
|
|||
defmodule Rauversion.Repo.Migrations.AddCounterCachesToTrack do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
alter table(:tracks) do
|
||||
add(:likes_count, :integer, default: 0)
|
||||
add(:reposts_count, :integer, default: 0)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,10 +0,0 @@
|
|||
defmodule Rauversion.Repo.Migrations.AddCounterCachesToPlaylist do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
alter table(:playlists) do
|
||||
add(:likes_count, :integer, default: 0)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,39 +0,0 @@
|
|||
defmodule Rauversion.Repo.Migrations.CreateTrackEvent do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:listening_events) do
|
||||
add(:remote_ip, :string)
|
||||
add(:country, :string)
|
||||
add(:city, :string)
|
||||
add(:ua, :string)
|
||||
add(:lang, :string)
|
||||
add(:referer, :string)
|
||||
add(:utm_medium, :string)
|
||||
add(:utm_source, :string)
|
||||
add(:utm_campaign, :string)
|
||||
add(:utm_content, :string)
|
||||
add(:utm_term, :string)
|
||||
add(:browser_name, :string)
|
||||
add(:browser_version, :string)
|
||||
add(:modern, :boolean)
|
||||
add(:platform, :string)
|
||||
add(:device_type, :string)
|
||||
add(:bot, :boolean)
|
||||
add(:search_engine, :boolean)
|
||||
|
||||
add(:resource_profile_id, RauversionExtension.user_table_reference())
|
||||
add(:user_id, RauversionExtension.user_table_reference())
|
||||
add(:track_id, references(:tracks, on_delete: :nothing))
|
||||
add(:playlist_id, references(:tracks, on_delete: :nothing))
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create(index(:listening_events, [:resource_profile_id]))
|
||||
create(index(:listening_events, [:user_id]))
|
||||
create(index(:listening_events, [:track_id]))
|
||||
create(index(:listening_events, [:playlist_id]))
|
||||
end
|
||||
end
|
|
@ -1,12 +0,0 @@
|
|||
defmodule Rauversion.Repo.Migrations.AddObanJobsTable do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
Oban.Migrations.up()
|
||||
end
|
||||
|
||||
def down do
|
||||
Oban.Migrations.down(version: 1)
|
||||
end
|
||||
end
|
|
@ -1,12 +0,0 @@
|
|||
defmodule Rauversion.Repo.Migrations.AddStateToTrack do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
alter table(:tracks) do
|
||||
add(:state, :string)
|
||||
end
|
||||
|
||||
create(index(:tracks, [:state]))
|
||||
end
|
||||
end
|
|
@ -1,19 +0,0 @@
|
|||
defmodule Rauversion.Repo.Migrations.CreatePreviewCards do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:preview_cards) do
|
||||
add(:url, :string)
|
||||
add(:title, :string)
|
||||
add(:description, :text)
|
||||
add(:type, :string)
|
||||
add(:author_name, :string)
|
||||
add(:author_url, :string)
|
||||
add(:html, :text)
|
||||
add(:image, :string)
|
||||
|
||||
timestamps()
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,46 +0,0 @@
|
|||
defmodule Rauversion.Repo.Migrations.CreateEvent do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:events) do
|
||||
add(:title, :string)
|
||||
add(:description, :text)
|
||||
add(:slug, :string)
|
||||
add(:state, :string)
|
||||
add(:timezone, :string)
|
||||
add(:event_start, :utc_datetime)
|
||||
add(:event_ends, :naive_datetime)
|
||||
add(:private, :boolean, default: false, null: false)
|
||||
add(:online, :boolean, default: false, null: false)
|
||||
add(:location, :string)
|
||||
add(:street, :string)
|
||||
add(:street_number, :string)
|
||||
add(:lat, :decimal)
|
||||
add(:lng, :decimal)
|
||||
add(:venue, :string)
|
||||
add(:country, :string)
|
||||
add(:city, :string)
|
||||
add(:province, :string)
|
||||
add(:postal, :string)
|
||||
add(:age_requirement, :string)
|
||||
add(:event_capacity, :boolean, default: false, null: false)
|
||||
add(:event_capacity_limit, :integer)
|
||||
add(:eticket, :boolean, default: false, null: false)
|
||||
add(:will_call, :boolean, default: false, null: false)
|
||||
add(:order_form, :map)
|
||||
add(:widget_button, :map)
|
||||
add(:event_short_link, :string)
|
||||
add(:tax_rates_settings, :map)
|
||||
add(:attendee_list_settings, :map)
|
||||
add(:scheduling_settings, :map)
|
||||
add(:event_settings, :map)
|
||||
add(:tickets, :map)
|
||||
add(:user_id, RauversionExtension.user_table_reference())
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create(index(:events, [:user_id]))
|
||||
end
|
||||
end
|
|
@ -1,23 +0,0 @@
|
|||
defmodule Rauversion.Repo.Migrations.CreateEventTickets do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:event_tickets) do
|
||||
add(:title, :string)
|
||||
add(:price, :decimal)
|
||||
add(:early_bird_price, :decimal)
|
||||
add(:standard_price, :decimal)
|
||||
add(:qty, :integer)
|
||||
add(:selling_start, :utc_datetime)
|
||||
add(:selling_end, :utc_datetime)
|
||||
add(:short_description, :string)
|
||||
add(:settings, :map)
|
||||
add(:event_id, references(:events, on_delete: :nothing))
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create(index(:event_tickets, [:event_id]))
|
||||
end
|
||||
end
|
|
@ -1,20 +0,0 @@
|
|||
defmodule Rauversion.Repo.Migrations.CreatePurchasedTickets do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:purchased_tickets) do
|
||||
add(:state, :string)
|
||||
add(:data, :map)
|
||||
add(:checked_in, :boolean)
|
||||
add(:checked_in_at, :utc_datetime)
|
||||
add(:user_id, RauversionExtension.user_table_reference())
|
||||
add(:event_ticket_id, references(:event_tickets, on_delete: :nothing))
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create(index(:purchased_tickets, [:user_id]))
|
||||
create(index(:purchased_tickets, [:event_ticket_id]))
|
||||
end
|
||||
end
|
|
@ -1,18 +0,0 @@
|
|||
defmodule Rauversion.Repo.Migrations.CreatePurchaseOrders do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:purchase_orders) do
|
||||
add(:total, :decimal)
|
||||
add(:promo_code, :string)
|
||||
add(:data, :map)
|
||||
add(:state, :string)
|
||||
add(:user_id, RauversionExtension.user_table_reference())
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create(index(:purchase_orders, [:user_id]))
|
||||
end
|
||||
end
|
|
@ -1,10 +0,0 @@
|
|||
defmodule Rauversion.Repo.Migrations.AddPurchaseOrderToPurchasedTickets do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
alter table(:purchased_tickets) do
|
||||
add(:purchase_order_id, references(:purchase_orders, on_delete: :nothing))
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,12 +0,0 @@
|
|||
defmodule Rauversion.Repo.Migrations.AddPaymentIdAndPaymentProvider do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
alter table(:purchase_orders) do
|
||||
add(:payment_id, :string)
|
||||
add(:payment_provider, :string)
|
||||
# add :payment_, references(:purchase_orders, on_delete: :nothing)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -2,14 +2,15 @@ defmodule Bonfire.Repo.Migrations.InitPointers do
|
|||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
import Needle.Migration
|
||||
import Needle.ULID.Migration
|
||||
|
||||
def up do
|
||||
init_pointers_ulid_extra()
|
||||
init_pointers()
|
||||
end
|
||||
def up(), do: init(:up)
|
||||
def down(), do: init(:down)
|
||||
|
||||
def down do
|
||||
init_pointers_ulid_extra()
|
||||
init_pointers()
|
||||
defp init(dir) do
|
||||
# this one is optional but recommended
|
||||
init_pointers_ulid_extra(dir)
|
||||
# this one is not optional
|
||||
init_pointers(dir)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Bonfire.Federate.ActivityPub.Repo.Migrations.ImportMe do
|
||||
defmodule Bonfire.Federate.ActivityPub.Repo.Migrations.ImportAP do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
defmodule Bonfire.Social.Graph.Repo.Migrations.ImportSocial do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Social.Graph.Migrations
|
||||
import Needle.Migration
|
||||
|
||||
def up do
|
||||
migrate_social()
|
||||
end
|
||||
|
||||
def down, do: migrate_social()
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
defmodule Bonfire.Posts.Repo.Migrations.ImportSocial do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Posts.Migrations
|
||||
import Needle.Migration
|
||||
|
||||
def up do
|
||||
migrate_social()
|
||||
end
|
||||
|
||||
def down, do: migrate_social()
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
defmodule Bonfire.Messages.Repo.Migrations.ImportSocial do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Messages.Migrations
|
||||
import Needle.Migration
|
||||
|
||||
def up do
|
||||
migrate_social()
|
||||
end
|
||||
|
||||
def down, do: migrate_social()
|
||||
end
|
|
@ -1,9 +0,0 @@
|
|||
defmodule Bonfire.Boundaries.Repo.Migrations.BoundariesFixtures do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Boundaries.Fixtures
|
||||
|
||||
def up, do: Bonfire.Boundaries.Fixtures.insert()
|
||||
def down, do: nil
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
defmodule Bonfire.Breadpub.Repo.Migrations.ImportMe do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Breadpub.Migration
|
||||
# accounts & users
|
||||
|
||||
def change, do: migrate_me
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
defmodule Bonfire.Repo.Migrations.ImportClassify do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
if Code.ensure_loaded?(Bonfire.Classify.Migrations) do
|
||||
Bonfire.Classify.Migrations.up()
|
||||
end
|
||||
end
|
||||
|
||||
def down do
|
||||
if Code.ensure_loaded?(Bonfire.Classify.Migrations) do
|
||||
Bonfire.Classify.Migrations.down()
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Bonfire.Repo.Migrations.ImportSharedUser do
|
||||
defmodule Bonfire.Data.SharedUser.ImportSharedUser do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
defmodule Bonfire.Repo.Migrations.ImportValueFlowsObserve do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
alias ValueFlows.Observe.Migrations
|
||||
|
||||
def up do
|
||||
Migrations.up()
|
||||
end
|
||||
|
||||
def down do
|
||||
Migrations.down()
|
||||
end
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
defmodule Bonfire.Posts.Repo.Migrations.Import do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Posts.Migrations
|
||||
|
||||
def change, do: migrate_posts()
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
defmodule Bonfire.Messages.Repo.MessagesMigrations do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Messages.Migrations
|
||||
|
||||
def change, do: migrate_messages()
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
defmodule Bonfire.Social.Graph.Repo.Migrations.Import do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Social.Graph.Migrations
|
||||
|
||||
def change, do: migrate_social_graph()
|
||||
end
|
|
@ -1,9 +0,0 @@
|
|||
defmodule Bonfire.Repo.Migrations.Message do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
import Bonfire.Data.Social.Message.Migration
|
||||
|
||||
def up, do: migrate_message()
|
||||
def down, do: migrate_message()
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Bonfire.Social.Repo.Migrations.ProfileImages do
|
||||
defmodule Bonfire.UI.Me.Repo.Migrations.ProfileImages do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Bonfire.Repo.Migrations.FP do
|
||||
defmodule Bonfire.Social.Repo.Migrations.FeedPublish do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Bonfire.Social.Repo.Migrations.PeeredURI do
|
||||
defmodule Bonfire.Federate.ActivityPub.Repo.Migrations.PeeredURI do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
defmodule Bonfire.Repo.Migrations.UpdateObanJobsTable do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def up, do: Oban.Migrations.up()
|
||||
|
||||
def down, do: nil
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
defmodule Bonfire.Repo.Migrations.Seen do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
require Bonfire.Data.Social.Seen.Migration
|
||||
|
||||
def up do
|
||||
Bonfire.Data.Social.Seen.Migration.migrate_seen()
|
||||
end
|
||||
|
||||
def down do
|
||||
Bonfire.Data.Social.Seen.Migration.migrate_seen()
|
||||
end
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
defmodule Bonfire.Repo.Migrations.AuthSecondFactor do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
require Bonfire.Data.Identity.AuthSecondFactor.Migration
|
||||
|
||||
def up do
|
||||
Bonfire.Data.Identity.AuthSecondFactor.Migration.migrate_auth_second_factor()
|
||||
end
|
||||
|
||||
def down do
|
||||
Bonfire.Data.Identity.AuthSecondFactor.Migration.migrate_auth_second_factor()
|
||||
end
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
defmodule Bonfire.Repo.Migrations.ExtraInfo do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
require Bonfire.Data.Identity.ExtraInfo.Migration
|
||||
|
||||
def up do
|
||||
Bonfire.Data.Identity.ExtraInfo.Migration.migrate_extra_info(:up)
|
||||
end
|
||||
|
||||
def down do
|
||||
Bonfire.Data.Identity.ExtraInfo.Migration.migrate_extra_info(:down)
|
||||
end
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
defmodule Bonfire.Common.Repo.Migrations.CreateObanPeers do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def up, do: Oban.Migrations.up(version: 11)
|
||||
|
||||
def down, do: Oban.Migrations.down(version: 11)
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
defmodule Bonfire.Repo.Migrations.Pin do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
require Bonfire.Data.Social.Pin.Migration
|
||||
|
||||
def up do
|
||||
Bonfire.Data.Social.Pin.Migration.migrate_pin()
|
||||
end
|
||||
|
||||
def down do
|
||||
Bonfire.Data.Social.Pin.Migration.migrate_pin()
|
||||
end
|
||||
end
|
|
@ -1,18 +0,0 @@
|
|||
defmodule Bonfire.Encrypt.Repo.Migrations.InitSecret do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
if Code.ensure_loaded?(Bonfire.Encrypt.Migrations) do
|
||||
require Bonfire.Encrypt.Migrations
|
||||
|
||||
def up do
|
||||
Bonfire.Encrypt.Migrations.migrate_secret()
|
||||
end
|
||||
|
||||
def down do
|
||||
Bonfire.Encrypt.Migrations.migrate_secret()
|
||||
end
|
||||
else
|
||||
IO.puts("Skip Bonfire.Encrypt migrations because the extension is not available.")
|
||||
end
|
||||
end
|
|
@ -3,9 +3,7 @@ defmodule Bonfire.Repo.Migrations.ClassifyAddType do
|
|||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
if Code.ensure_loaded?(Bonfire.Classify.Migrations) do
|
||||
Bonfire.Classify.Migrations.add_type()
|
||||
end
|
||||
Bonfire.Classify.Migrations.add_type()
|
||||
end
|
||||
|
||||
def down do
|
||||
|
|
|
@ -4,16 +4,12 @@ defmodule Bonfire.Repo.Migrations.ClassifyAddTree do
|
|||
require Bonfire.Classify.Tree.Migration
|
||||
|
||||
def up do
|
||||
if Code.ensure_loaded?(Bonfire.Classify.Tree.Migration) do
|
||||
Bonfire.Classify.Tree.Migration.migrate_tree()
|
||||
Bonfire.Classify.Tree.Migration.migrate_functions()
|
||||
end
|
||||
Bonfire.Classify.Tree.Migration.migrate_tree()
|
||||
Bonfire.Classify.Tree.Migration.migrate_functions()
|
||||
end
|
||||
|
||||
def down do
|
||||
if Code.ensure_loaded?(Bonfire.Classify.Tree.Migration) do
|
||||
Bonfire.Classify.Tree.Migration.migrate_functions()
|
||||
Bonfire.Classify.Tree.Migration.migrate_tree()
|
||||
end
|
||||
Bonfire.Classify.Tree.Migration.migrate_functions()
|
||||
Bonfire.Classify.Tree.Migration.migrate_tree()
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
defmodule Bonfire.Social.Repo.Migrations.ArrayFn do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
|
||||
def up, do: Bonfire.Social.Migrations.add_array_reverse_fn()
|
||||
def down, do: nil
|
||||
end
|
|
@ -0,0 +1,48 @@
|
|||
defmodule Bonfire.Search.Repo.Migrations.GinIndexes do
|
||||
use Ecto.Migration
|
||||
|
||||
@disable_ddl_transaction true
|
||||
@disable_migration_lock true
|
||||
# ^ Needed to migrate indexes concurrently.
|
||||
# Disabling DDL transactions removes the guarantee that all of the changes in the migration will happen at once.
|
||||
# Disabling the migration lock removes the guarantee only a single node will run a given migration if multiple nodes are attempting to migrate at the same time.
|
||||
|
||||
def up do
|
||||
execute "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
|
||||
|
||||
create_index("bonfire_data_social_named", "name")
|
||||
create_index("bonfire_data_identity_character", "username")
|
||||
|
||||
# create_index("bonfire_data_social_profile", "name")
|
||||
create_index_fields(
|
||||
"bonfire_data_social_profile",
|
||||
"name gin_trgm_ops, summary gin_trgm_ops"
|
||||
)
|
||||
|
||||
create_index_fields(
|
||||
"bonfire_data_social_post_content",
|
||||
# "name gin_trgm_ops, summary gin_trgm_ops, html_body gin_trgm_ops"
|
||||
"name gin_trgm_ops, summary gin_trgm_ops"
|
||||
)
|
||||
end
|
||||
|
||||
def down do
|
||||
# TODO
|
||||
end
|
||||
|
||||
def create_index(table, field) do
|
||||
create_index_fields(table, "#{field} gin_trgm_ops")
|
||||
end
|
||||
|
||||
def create_index_fields(table, fields) do
|
||||
execute """
|
||||
DROP INDEX IF EXISTS #{table}_gin_index;
|
||||
"""
|
||||
|
||||
execute """
|
||||
CREATE INDEX CONCURRENTLY #{table}_gin_index
|
||||
ON #{table}
|
||||
USING gin (#{fields});
|
||||
"""
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
defmodule Bonfire.Repo.Migrations.Label do
|
||||
@moduledoc false
|
||||
use Ecto.Migration
|
||||
require Bonfire.Label.Migration
|
||||
|
||||
def up do
|
||||
Bonfire.Label.Migration.migrate_label()
|
||||
end
|
||||
|
||||
def down do
|
||||
Bonfire.Label.Migration.migrate_label()
|
||||
end
|
||||
end
|
|
@ -1,3 +0,0 @@
|
|||
|
||||
bonfire_classify = "https://github.com/bonfire-networks/bonfire_classify#main"
|
||||
bonfire_taxonomy_seeder = "https://github.com/bonfire-networks/bonfire_taxonomy_seeder#main"
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
phil_columns = "~> 3.1" # for inserting seed data in the DB
|
|
@ -1,9 +0,0 @@
|
|||
import Config
|
||||
|
||||
config :bonfire, :ui,
|
||||
theme: [
|
||||
instance_name: "HAHA Academy",
|
||||
instance_icon: "/images/bonfire-icon.png",
|
||||
instance_image: "https://haha.academy/images/wheel.png",
|
||||
instance_description: "Community roadmaps for learning every branch of human knowledge"
|
||||
]
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue