-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
misc: add category to integration #2332
base: main
Are you sure you want to change the base?
Changes from all commits
d71663a
5893e43
514d121
4443ec7
421cec2
536c9d7
9f85b42
73f4d70
8bd834b
669d958
a610720
3327258
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# frozen_string_literal: true | ||
|
||
class AddCategoryToIntegrations < ActiveRecord::Migration[7.1] | ||
module Integrations | ||
class BaseIntegration < ApplicationRecord | ||
self.table_name = 'integrations' | ||
INTEGRATION_CATEGORIES = %w[system accounting tax_provider] | ||
enum category: INTEGRATION_CATEGORIES | ||
end | ||
|
||
class AnrokIntegration < BaseIntegration | ||
end | ||
|
||
class NetsuiteIntegration < BaseIntegration | ||
end | ||
|
||
class XeroIntegration < BaseIntegration | ||
end | ||
|
||
class OktaIntegration < BaseIntegration | ||
end | ||
end | ||
|
||
def up | ||
add_column :integrations, :category, :integer | ||
add_index :integrations, :category | ||
|
||
Integrations::AnrokIntegration.update_all(category: 'tax_provider') # rubocop:disable Rails/SkipsModelValidations | ||
Integrations::NetsuiteIntegration.update_all(category: 'accounting') # rubocop:disable Rails/SkipsModelValidations | ||
Integrations::XeroIntegration.update_all(category: 'accounting') # rubocop:disable Rails/SkipsModelValidations | ||
Integrations::OktaIntegration.update_all(category: 'system') # rubocop:disable Rails/SkipsModelValidations | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Run it locally on 4000 integrations - took 0.04s |
||
end | ||
|
||
def down | ||
remove_index :integrations, :category | ||
remove_column :integrations, :category | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated to
bitwise and
becauselogical and
returns value if it exist instead of true/falseSo in our case if second half returns nil,
&& - returns nil for the whole operation
& - returns false for the whole operation,
no matter what first argument was