-
Notifications
You must be signed in to change notification settings - Fork 95
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
Users/amit909sin/issue 195 #219
Merged
gurkanindibay
merged 19 commits into
citusdata:issue_195
from
Amit909Singh:users/amit909sin/issue_195
Dec 3, 2023
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
16fd851
Aligns badges
gurkanindibay 7b6bb2f
Wrap ActiveRecord::Base with ActiveSupport.on_load (#199)
nipe0324 fd42dbd
Adds Changelog entries for 2.3.0 (#201)
gurkanindibay bed29b1
update logic inside the tenant_klass_defined? method (#202)
msasaki666 5217915
Bump certifi from 2023.5.7 to 2023.7.22 in /docs (#204)
dependabot[bot] 100ac67
Fix missing scope in habtm.rb (#207)
Laykou 648f353
Support rails 7.1 (#208)
alpaca-tc cf1b412
Adds citus 12 to test matrix (#210)
gurkanindibay 9939b5e
Bump version to 2.4.0
gurkanindibay c192594
Update CHANGELOG.md (#211)
gurkanindibay aa0e161
Bump urllib3 from 2.0.2 to 2.0.6 in /docs (#212)
dependabot[bot] 48e6a42
Remove beta1 from rails 7.1.0 (#213)
alpaca-tc de48c9f
Bump urllib3 from 2.0.6 to 2.0.7 in /docs (#214)
dependabot[bot] f1f043d
Fix rubocop warnings (#215)
serprex d23bc78
Use prepend instead of alias (#216)
alpaca-tc 3f719c6
Merge branch 'master' into users/amit909sin/issue_195
Amit909Singh c960138
Fix the tenant scoping for delete_all
Amit909Singh d2c62a6
Remove unused index.
Amit909Singh 02e4380
Fix rubocop error.
Amit909Singh File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
source 'https://rubygems.org' | ||
|
||
gemspec | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rubygems' | ||
require 'bundler/setup' | ||
require 'bundler/gem_tasks' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module MultiTenant | ||
module MigrationExtensions | ||
def create_distributed_table(table_name, partition_key) | ||
|
@@ -66,22 +68,19 @@ def citus_version | |
|
||
ActiveRecord::Migration.include MultiTenant::MigrationExtensions if defined?(ActiveRecord::Migration) | ||
|
||
module ActiveRecord | ||
module ConnectionAdapters # :nodoc: | ||
module SchemaStatements | ||
alias orig_create_table create_table | ||
|
||
def create_table(table_name, options = {}, &block) | ||
ret = orig_create_table(table_name, **options.except(:partition_key), &block) | ||
if options[:id] != false && options[:partition_key] && options[:partition_key].to_s != 'id' | ||
execute "ALTER TABLE #{table_name} DROP CONSTRAINT #{table_name}_pkey" | ||
execute "ALTER TABLE #{table_name} ADD PRIMARY KEY(\"#{options[:partition_key]}\", id)" | ||
end | ||
ret | ||
module MultiTenant | ||
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. I couldn't understand why this change is required. Could you clarify? |
||
module SchemaStatementsExtensions | ||
def create_table(table_name, options = {}, &block) | ||
ret = super(table_name, **options.except(:partition_key), &block) | ||
if options[:id] != false && options[:partition_key] && options[:partition_key].to_s != 'id' | ||
execute "ALTER TABLE #{table_name} DROP CONSTRAINT #{table_name}_pkey" | ||
execute "ALTER TABLE #{table_name} ADD PRIMARY KEY(\"#{options[:partition_key]}\", id)" | ||
end | ||
ret | ||
end | ||
end | ||
end | ||
ActiveRecord::ConnectionAdapters::SchemaStatements.prepend(MultiTenant::SchemaStatementsExtensions) | ||
|
||
module ActiveRecord | ||
class SchemaDumper | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why there are multiple empty lines here?