Skip to content

Commit

Permalink
Remove is_pinned from filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomáš Durčák committed Sep 25, 2024
1 parent 6f5ba24 commit 29cc358
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
1 change: 0 additions & 1 deletion app/models/everything_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#
# id :bigint not null, primary key
# icon :string
# is_pinned :boolean default(FALSE), not null
# name :string not null
# position :integer not null
# query :string
Expand Down
6 changes: 1 addition & 5 deletions app/models/filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#
# id :bigint not null, primary key
# icon :string
# is_pinned :boolean default(FALSE), not null
# name :string not null
# position :integer not null
# query :string
Expand All @@ -28,11 +27,8 @@ class Filter < ApplicationRecord

before_create :fill_position

scope :pinned, -> { where(is_pinned: true) }
scope :not_pinned, -> { where(is_pinned: false) }
scope :visible_for, -> (user) { joins(:user_filter_visibilities)
.where(user_filter_visibilities: { visible: true, user: user})
.where(is_pinned: false) }
.where(user_filter_visibilities: { visible: true, user: user}) }

acts_as_list scope: :tenant_id

Expand Down
1 change: 0 additions & 1 deletion app/models/fulltext_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#
# id :bigint not null, primary key
# icon :string
# is_pinned :boolean default(FALSE), not null
# name :string not null
# position :integer not null
# query :string
Expand Down
1 change: 0 additions & 1 deletion app/models/tag_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#
# id :bigint not null, primary key
# icon :string
# is_pinned :boolean default(FALSE), not null
# name :string not null
# position :integer not null
# query :string
Expand Down
10 changes: 10 additions & 0 deletions db/migrate/20240925134557_remove_is_pinned_from_filters.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class RemoveIsPinnedFromFilters < ActiveRecord::Migration[7.1]
def up
remove_column :filters, :is_pinned
end

def down
add_column :filters, :is_pinned, :boolean, null: false, default: false
add_index :filters, :is_pinned
end
end
4 changes: 1 addition & 3 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 29cc358

Please sign in to comment.