From a2d3f5efcf5d98e2bd7bc8d14a61bdaf05f92184 Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Tue, 28 Feb 2023 20:57:56 +1100 Subject: [PATCH] Exclude instagram posts from statuses --- app/repos/post_repo.rb | 2 ++ .../20230228095633_change_syndication_sources_type.rb | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 db/migrate/20230228095633_change_syndication_sources_type.rb diff --git a/app/repos/post_repo.rb b/app/repos/post_repo.rb index ee3ffbe..b09229e 100644 --- a/app/repos/post_repo.rb +++ b/app/repos/post_repo.rb @@ -1,6 +1,7 @@ module Adamantium module Repos class PostRepo < Adamantium::Repo[:posts] + Sequel.extension :pg_json Sequel.extension :pg_json_ops commands update: :by_pk @@ -97,6 +98,7 @@ module Adamantium def statuses_listing(limit: nil) posts .where(post_type: "post", name: nil) + .exclude(Sequel.pg_jsonb_op(:syndication_sources).has_key?("instagram")) .published .combine(:tags) .order(Sequel.desc(:published_at)) diff --git a/db/migrate/20230228095633_change_syndication_sources_type.rb b/db/migrate/20230228095633_change_syndication_sources_type.rb new file mode 100644 index 0000000..e324aff --- /dev/null +++ b/db/migrate/20230228095633_change_syndication_sources_type.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +ROM::SQL.migration do + change do + alter_table(:posts) do + set_column_type :syndication_sources, :jsonb + end + end +end