pg_multitenant_schemas 0.1.3 ā 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.actrc +17 -0
- data/.env.local.example +21 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +86 -0
- data/LOCAL_TESTING_SUMMARY.md +141 -0
- data/README.md +269 -16
- data/TESTING_LOCALLY.md +208 -0
- data/docs/README.md +81 -0
- data/docs/configuration.md +340 -0
- data/docs/context.md +292 -0
- data/docs/errors.md +498 -0
- data/docs/github_actions_permissions_fix.md +136 -0
- data/docs/github_actions_setup.md +181 -0
- data/docs/integration_testing.md +454 -0
- data/docs/local_workflow_testing.md +314 -0
- data/docs/migrator.md +291 -0
- data/docs/rails_integration.md +468 -0
- data/docs/schema_switcher.md +182 -0
- data/docs/tenant_resolver.md +394 -0
- data/docs/testing.md +358 -0
- data/examples/context_management.rb +198 -0
- data/examples/migration_workflow.rb +50 -0
- data/examples/rails_integration/controller_examples.rb +368 -0
- data/examples/schema_operations.rb +124 -0
- data/lib/pg_multitenant_schemas/configuration.rb +4 -4
- data/lib/pg_multitenant_schemas/migration_display_reporter.rb +30 -0
- data/lib/pg_multitenant_schemas/migration_executor.rb +81 -0
- data/lib/pg_multitenant_schemas/migration_schema_operations.rb +54 -0
- data/lib/pg_multitenant_schemas/migration_status_reporter.rb +65 -0
- data/lib/pg_multitenant_schemas/migrator.rb +89 -0
- data/lib/pg_multitenant_schemas/schema_switcher.rb +40 -66
- data/lib/pg_multitenant_schemas/tasks/advanced_tasks.rake +21 -0
- data/lib/pg_multitenant_schemas/tasks/basic_tasks.rake +20 -0
- data/lib/pg_multitenant_schemas/tasks/pg_multitenant_schemas.rake +53 -143
- data/lib/pg_multitenant_schemas/tasks/tenant_tasks.rake +65 -0
- data/lib/pg_multitenant_schemas/tenant_task_helpers.rb +102 -0
- data/lib/pg_multitenant_schemas/version.rb +1 -1
- data/lib/pg_multitenant_schemas.rb +10 -5
- data/pg_multitenant_schemas.gemspec +10 -9
- data/pre-push-check.sh +95 -0
- data/rails_integration/app/controllers/application_controller.rb +6 -0
- data/rails_integration/app/models/tenant.rb +6 -0
- data/test-github-setup.sh +85 -0
- data/validate-github-commands.sh +47 -0
- metadata +49 -17
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Tenant task helper methods
|
|
4
|
+
module TenantTaskHelpers
|
|
5
|
+
class << self
|
|
6
|
+
def list_tenant_schemas
|
|
7
|
+
puts "š Available tenant schemas:"
|
|
8
|
+
|
|
9
|
+
schemas = PgMultitenantSchemas::Migrator.send(:tenant_schemas)
|
|
10
|
+
|
|
11
|
+
if schemas.any?
|
|
12
|
+
schemas.each { |schema| puts " - #{schema}" }
|
|
13
|
+
puts "\nš Total: #{schemas.count} tenant schemas"
|
|
14
|
+
else
|
|
15
|
+
puts " No tenant schemas found"
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def migrate_specific_tenant(schema_name)
|
|
20
|
+
if schema_name.blank?
|
|
21
|
+
puts "Usage: rails tenants:migrate_tenant[schema_name]"
|
|
22
|
+
puts "Example: rails tenants:migrate_tenant[acme_corp]"
|
|
23
|
+
exit 1
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
PgMultitenantSchemas::Migrator.migrate_tenant(schema_name)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def create_tenant_with_schema(schema_name)
|
|
30
|
+
if schema_name.blank?
|
|
31
|
+
puts "Usage: rails tenants:create[schema_name]"
|
|
32
|
+
puts "Example: rails tenants:create[acme_corp]"
|
|
33
|
+
exit 1
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
PgMultitenantSchemas::Migrator.setup_tenant(schema_name)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def create_tenant_with_attributes(attributes_json)
|
|
40
|
+
if attributes_json.blank?
|
|
41
|
+
puts "Usage: rails tenants:new['{\"subdomain\":\"acme\",\"name\":\"ACME Corp\"}']"
|
|
42
|
+
exit 1
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
begin
|
|
46
|
+
attributes = JSON.parse(attributes_json)
|
|
47
|
+
tenant = PgMultitenantSchemas::Migrator.create_tenant_with_schema(attributes)
|
|
48
|
+
puts "š Created tenant: #{tenant.subdomain}"
|
|
49
|
+
rescue JSON::ParserError
|
|
50
|
+
puts "ā Invalid JSON format"
|
|
51
|
+
exit 1
|
|
52
|
+
rescue StandardError => e
|
|
53
|
+
puts "ā Error creating tenant: #{e.message}"
|
|
54
|
+
exit 1
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def drop_tenant_schema(schema_name)
|
|
59
|
+
if schema_name.blank?
|
|
60
|
+
puts "Usage: rails tenants:drop[schema_name]"
|
|
61
|
+
exit 1
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
if schema_name == "public"
|
|
65
|
+
puts "ā Cannot drop public schema"
|
|
66
|
+
exit 1
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
confirm_schema_drop(schema_name)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def rollback_tenant_migrations(schema_name, steps)
|
|
73
|
+
if schema_name.blank?
|
|
74
|
+
puts "Usage: rails tenants:rollback[schema_name,steps]"
|
|
75
|
+
puts "Example: rails tenants:rollback[acme_corp,2]"
|
|
76
|
+
exit 1
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
PgMultitenantSchemas::Migrator.rollback_tenant(schema_name, steps: steps)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
private
|
|
83
|
+
|
|
84
|
+
def confirm_schema_drop(schema_name)
|
|
85
|
+
print "ā ļø This will permanently delete all data in schema '#{schema_name}'. Continue? (y/N): "
|
|
86
|
+
response = $stdin.gets.chomp.downcase
|
|
87
|
+
|
|
88
|
+
unless %w[y yes].include?(response)
|
|
89
|
+
puts "ā Operation cancelled"
|
|
90
|
+
exit 0
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
begin
|
|
94
|
+
PgMultitenantSchemas::SchemaSwitcher.drop_schema(schema_name)
|
|
95
|
+
puts "ā
Dropped schema: #{schema_name}"
|
|
96
|
+
rescue StandardError => e
|
|
97
|
+
puts "ā Error dropping schema #{schema_name}: #{e.message}"
|
|
98
|
+
exit 1
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
# frozen_string_li# PgMultitenantSchemas provides modern PostgreSQL schema-based multitenancy functionality.
|
|
4
|
+
# Built for Rails 8+ and Ruby 3.4+, it allows switching between different PostgreSQL schemas
|
|
5
|
+
# to achieve secure tenant isolation while maintaining high performance and developer experience.al: true
|
|
6
|
+
|
|
3
7
|
require "active_support/core_ext/module/delegation"
|
|
4
8
|
require "active_support/core_ext/object/blank"
|
|
5
9
|
require_relative "pg_multitenant_schemas/version"
|
|
6
10
|
require_relative "pg_multitenant_schemas/errors"
|
|
7
11
|
require_relative "pg_multitenant_schemas/configuration"
|
|
8
|
-
require_relative "pg_multitenant_schemas/schema_switcher"
|
|
9
12
|
require_relative "pg_multitenant_schemas/context"
|
|
13
|
+
require_relative "pg_multitenant_schemas/schema_switcher"
|
|
10
14
|
require_relative "pg_multitenant_schemas/tenant_resolver"
|
|
15
|
+
require_relative "pg_multitenant_schemas/migrator"
|
|
11
16
|
|
|
12
|
-
# Rails integration (
|
|
17
|
+
# Rails integration (Rails 8+ required)
|
|
13
18
|
if defined?(Rails)
|
|
14
19
|
require_relative "pg_multitenant_schemas/rails/controller_concern"
|
|
15
20
|
require_relative "pg_multitenant_schemas/rails/model_concern"
|
|
16
21
|
require_relative "pg_multitenant_schemas/rails/railtie"
|
|
17
22
|
end
|
|
18
23
|
|
|
19
|
-
# PgMultitenantSchemas provides PostgreSQL schema-based multitenancy functionality.
|
|
20
|
-
#
|
|
21
|
-
#
|
|
24
|
+
# PgMultitenantSchemas provides modern PostgreSQL schema-based multitenancy functionality.
|
|
25
|
+
# Built for Rails 8+ and Ruby 3.3+, it allows switching between different PostgreSQL schemas
|
|
26
|
+
# to achieve secure tenant isolation while maintaining high performance and developer experience.
|
|
22
27
|
module PgMultitenantSchemas
|
|
23
28
|
class << self
|
|
24
29
|
# Delegate common methods to Context for convenience
|
|
@@ -8,13 +8,14 @@ Gem::Specification.new do |spec|
|
|
|
8
8
|
spec.authors = ["Ruben Paz"]
|
|
9
9
|
spec.email = ["rubenpazchuspe@outlook.com"]
|
|
10
10
|
|
|
11
|
-
spec.summary = "PostgreSQL schema-based multitenancy for Rails applications"
|
|
12
|
-
spec.description = "A Ruby gem that provides PostgreSQL schema-based multitenancy with automatic tenant " \
|
|
13
|
-
"resolution
|
|
14
|
-
"Perfect for SaaS applications requiring
|
|
11
|
+
spec.summary = "Modern PostgreSQL schema-based multitenancy for Rails 8+ applications"
|
|
12
|
+
spec.description = "A modern Ruby gem that provides PostgreSQL schema-based multitenancy with automatic tenant " \
|
|
13
|
+
"resolution and schema switching. Built for Rails 8+ and Ruby 3.3+, focusing on security, " \
|
|
14
|
+
"performance, and developer experience. Perfect for modern SaaS applications requiring " \
|
|
15
|
+
"secure tenant isolation."
|
|
15
16
|
spec.homepage = "https://github.com/rubenpazch/pg_multitenant_schemas"
|
|
16
17
|
spec.license = "MIT"
|
|
17
|
-
spec.required_ruby_version = ">= 3.
|
|
18
|
+
spec.required_ruby_version = ">= 3.0.0"
|
|
18
19
|
|
|
19
20
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
20
21
|
spec.metadata["homepage_uri"] = spec.homepage
|
|
@@ -33,8 +34,8 @@ Gem::Specification.new do |spec|
|
|
|
33
34
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
34
35
|
spec.require_paths = ["lib"]
|
|
35
36
|
|
|
36
|
-
# Runtime dependencies - Rails
|
|
37
|
-
spec.add_dependency "activerecord", ">=
|
|
38
|
-
spec.add_dependency "activesupport", ">=
|
|
39
|
-
spec.add_dependency "pg", "~> 1.
|
|
37
|
+
# Runtime dependencies - Modern Rails only
|
|
38
|
+
spec.add_dependency "activerecord", ">= 8.0", "< 9.0"
|
|
39
|
+
spec.add_dependency "activesupport", ">= 8.0", "< 9.0"
|
|
40
|
+
spec.add_dependency "pg", "~> 1.5"
|
|
40
41
|
end
|
data/pre-push-check.sh
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Pre-push check script for pg_multitenant_schemas gem
|
|
3
|
+
# Run this before pushing to GitHub to catch issues early
|
|
4
|
+
|
|
5
|
+
set -e # Exit on any error
|
|
6
|
+
|
|
7
|
+
echo "š Running pre-push checks for pg_multitenant_schemas..."
|
|
8
|
+
echo ""
|
|
9
|
+
|
|
10
|
+
# Color codes for output
|
|
11
|
+
RED='\033[0;31m'
|
|
12
|
+
GREEN='\033[0;32m'
|
|
13
|
+
YELLOW='\033[1;33m'
|
|
14
|
+
NC='\033[0m' # No Color
|
|
15
|
+
|
|
16
|
+
# Function to print colored output
|
|
17
|
+
print_status() {
|
|
18
|
+
echo -e "${2}${1}${NC}"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
# Function to run a check
|
|
22
|
+
run_check() {
|
|
23
|
+
local name="$1"
|
|
24
|
+
local command="$2"
|
|
25
|
+
local optional="$3"
|
|
26
|
+
|
|
27
|
+
echo "š $name..."
|
|
28
|
+
if eval "$command"; then
|
|
29
|
+
print_status "ā
$name passed" "$GREEN"
|
|
30
|
+
else
|
|
31
|
+
if [ "$optional" = "true" ]; then
|
|
32
|
+
print_status "ā ļø $name failed (optional)" "$YELLOW"
|
|
33
|
+
else
|
|
34
|
+
print_status "ā $name failed" "$RED"
|
|
35
|
+
exit 1
|
|
36
|
+
fi
|
|
37
|
+
fi
|
|
38
|
+
echo ""
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
# 1. Check if we're in the right directory
|
|
42
|
+
if [ ! -f "pg_multitenant_schemas.gemspec" ]; then
|
|
43
|
+
print_status "ā Not in pg_multitenant_schemas directory" "$RED"
|
|
44
|
+
exit 1
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
# 2. Install dependencies
|
|
48
|
+
run_check "Bundle install" "bundle install --quiet"
|
|
49
|
+
|
|
50
|
+
# 3. RuboCop
|
|
51
|
+
run_check "RuboCop (code style)" "bundle exec rubocop"
|
|
52
|
+
|
|
53
|
+
# 4. RSpec unit tests
|
|
54
|
+
run_check "RSpec unit tests" "bundle exec rspec --exclude-pattern '**/integration/**/*_spec.rb'"
|
|
55
|
+
|
|
56
|
+
# 5. Security audit
|
|
57
|
+
run_check "Security audit" "bundle audit" "true"
|
|
58
|
+
|
|
59
|
+
# 6. Gem build test
|
|
60
|
+
run_check "Gem build test" "gem build pg_multitenant_schemas.gemspec > /dev/null 2>&1 && rm -f pg_multitenant_schemas-*.gem"
|
|
61
|
+
|
|
62
|
+
# 7. Check for PostgreSQL and run integration tests
|
|
63
|
+
if command -v psql &> /dev/null && pg_isready &> /dev/null; then
|
|
64
|
+
# Check if test database exists, create if not
|
|
65
|
+
if ! psql -lqt | cut -d \| -f 1 | grep -qw pg_multitenant_test; then
|
|
66
|
+
echo "š Creating test database..."
|
|
67
|
+
createdb pg_multitenant_test || true
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
run_check "Integration tests" "PGDATABASE=pg_multitenant_test bundle exec rspec --tag integration" "true"
|
|
71
|
+
else
|
|
72
|
+
print_status "ā ļø PostgreSQL not available, skipping integration tests" "$YELLOW"
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
# 8. Check for uncommitted changes
|
|
76
|
+
if [ -n "$(git status --porcelain)" ]; then
|
|
77
|
+
print_status "ā ļø You have uncommitted changes" "$YELLOW"
|
|
78
|
+
git status --short
|
|
79
|
+
echo ""
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
# 9. Check current branch
|
|
83
|
+
current_branch=$(git branch --show-current)
|
|
84
|
+
if [ "$current_branch" = "main" ]; then
|
|
85
|
+
print_status "ā ļø You're on the main branch" "$YELLOW"
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
echo "š All checks completed successfully!"
|
|
89
|
+
echo ""
|
|
90
|
+
echo "š Your code is ready to push to GitHub!"
|
|
91
|
+
echo ""
|
|
92
|
+
echo "š” Pro tip: You can test GitHub Actions locally using 'act':"
|
|
93
|
+
echo " brew install act"
|
|
94
|
+
echo " act push # Test CI workflow"
|
|
95
|
+
echo ""
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Test GitHub Actions permissions and setup locally
|
|
3
|
+
|
|
4
|
+
echo "š Testing GitHub Actions setup and permissions..."
|
|
5
|
+
echo ""
|
|
6
|
+
|
|
7
|
+
# Check if we're in a Git repository
|
|
8
|
+
if ! git rev-parse --git-dir > /dev/null 2>&1; then
|
|
9
|
+
echo "ā Not in a Git repository"
|
|
10
|
+
exit 1
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
# Check if we're on the right branch
|
|
14
|
+
current_branch=$(git branch --show-current)
|
|
15
|
+
echo "š Current branch: $current_branch"
|
|
16
|
+
|
|
17
|
+
# Check if we have the workflow files
|
|
18
|
+
if [ -f ".github/workflows/main.yml" ]; then
|
|
19
|
+
echo "ā
CI workflow file exists"
|
|
20
|
+
else
|
|
21
|
+
echo "ā CI workflow file missing"
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
if [ -f ".github/workflows/release.yml" ]; then
|
|
25
|
+
echo "ā
Release workflow file exists"
|
|
26
|
+
else
|
|
27
|
+
echo "ā Release workflow file missing"
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
# Check version file
|
|
31
|
+
if [ -f "lib/pg_multitenant_schemas/version.rb" ]; then
|
|
32
|
+
version=$(grep -E "VERSION = ['\"]" lib/pg_multitenant_schemas/version.rb | cut -d'"' -f2 | cut -d"'" -f2)
|
|
33
|
+
echo "ā
Version file exists: $version"
|
|
34
|
+
else
|
|
35
|
+
echo "ā Version file missing"
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# Check if gemspec exists
|
|
39
|
+
if [ -f "pg_multitenant_schemas.gemspec" ]; then
|
|
40
|
+
echo "ā
Gemspec file exists"
|
|
41
|
+
else
|
|
42
|
+
echo "ā Gemspec file missing"
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
# Check remote origin
|
|
46
|
+
remote_url=$(git remote get-url origin 2>/dev/null || echo "No remote")
|
|
47
|
+
echo "š Remote origin: $remote_url"
|
|
48
|
+
|
|
49
|
+
# Test Git config (what GitHub Actions would use)
|
|
50
|
+
echo ""
|
|
51
|
+
echo "š§Ŗ Testing Git configuration..."
|
|
52
|
+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
53
|
+
git config --local user.name "github-actions[bot]"
|
|
54
|
+
echo "ā
Git config set for GitHub Actions bot"
|
|
55
|
+
|
|
56
|
+
# Test gem build
|
|
57
|
+
echo ""
|
|
58
|
+
echo "š§Ŗ Testing gem build..."
|
|
59
|
+
if gem build pg_multitenant_schemas.gemspec > /dev/null 2>&1; then
|
|
60
|
+
echo "ā
Gem builds successfully"
|
|
61
|
+
rm -f pg_multitenant_schemas-*.gem
|
|
62
|
+
else
|
|
63
|
+
echo "ā Gem build failed"
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
# Check for uncommitted changes
|
|
67
|
+
if [ -n "$(git status --porcelain)" ]; then
|
|
68
|
+
echo ""
|
|
69
|
+
echo "ā ļø You have uncommitted changes:"
|
|
70
|
+
git status --short
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
echo ""
|
|
74
|
+
echo "šÆ Next Steps:"
|
|
75
|
+
echo "1. Ensure repository has proper permissions set in GitHub:"
|
|
76
|
+
echo " - Go to Settings > Actions > General"
|
|
77
|
+
echo " - Set 'Workflow permissions' to 'Read and write permissions'"
|
|
78
|
+
echo " - Enable 'Allow GitHub Actions to create and approve pull requests'"
|
|
79
|
+
echo ""
|
|
80
|
+
echo "2. To trigger a release:"
|
|
81
|
+
echo " - Update version in lib/pg_multitenant_schemas/version.rb"
|
|
82
|
+
echo " - Commit and push to main branch"
|
|
83
|
+
echo " - GitHub Actions will automatically create a release"
|
|
84
|
+
echo ""
|
|
85
|
+
echo "š For more details, see: docs/github_actions_setup.md"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Validate GitHub workflow commands locally
|
|
3
|
+
# This script tests the exact commands used in GitHub Actions
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
echo "š§Ŗ Testing GitHub Actions commands locally..."
|
|
8
|
+
echo ""
|
|
9
|
+
|
|
10
|
+
# Test RuboCop (exact command from workflow)
|
|
11
|
+
echo "š Testing: bundle exec rubocop"
|
|
12
|
+
if bundle exec rubocop > /dev/null 2>&1; then
|
|
13
|
+
echo "ā
RuboCop passed"
|
|
14
|
+
else
|
|
15
|
+
echo "ā RuboCop failed"
|
|
16
|
+
exit 1
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
# Test unit tests (exact command from workflow)
|
|
20
|
+
echo "š Testing: bundle exec rspec --exclude-pattern '**/integration/**/*_spec.rb'"
|
|
21
|
+
if bundle exec rspec --exclude-pattern '**/integration/**/*_spec.rb' > /dev/null 2>&1; then
|
|
22
|
+
echo "ā
Unit tests passed"
|
|
23
|
+
else
|
|
24
|
+
echo "ā Unit tests failed"
|
|
25
|
+
exit 1
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# Test integration tests (exact command from workflow)
|
|
29
|
+
echo "š Testing: bundle exec rspec --tag integration"
|
|
30
|
+
if bundle exec rspec --tag integration > /dev/null 2>&1; then
|
|
31
|
+
echo "ā
Integration tests passed"
|
|
32
|
+
else
|
|
33
|
+
echo "ā ļø Integration tests failed (may need PostgreSQL setup)"
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# Test security audit (exact command from workflow)
|
|
37
|
+
echo "š Testing: bundle audit"
|
|
38
|
+
if bundle audit > /dev/null 2>&1; then
|
|
39
|
+
echo "ā
Security audit passed"
|
|
40
|
+
else
|
|
41
|
+
echo "ā ļø Security audit failed (may have vulnerabilities)"
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
echo ""
|
|
45
|
+
echo "š GitHub Actions command validation complete!"
|
|
46
|
+
echo ""
|
|
47
|
+
echo "š” These are the exact commands that run in GitHub Actions CI"
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pg_multitenant_schemas
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ruben Paz
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: activerecord
|
|
@@ -16,7 +15,7 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
18
|
+
version: '8.0'
|
|
20
19
|
- - "<"
|
|
21
20
|
- !ruby/object:Gem::Version
|
|
22
21
|
version: '9.0'
|
|
@@ -26,7 +25,7 @@ dependencies:
|
|
|
26
25
|
requirements:
|
|
27
26
|
- - ">="
|
|
28
27
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: '
|
|
28
|
+
version: '8.0'
|
|
30
29
|
- - "<"
|
|
31
30
|
- !ruby/object:Gem::Version
|
|
32
31
|
version: '9.0'
|
|
@@ -36,7 +35,7 @@ dependencies:
|
|
|
36
35
|
requirements:
|
|
37
36
|
- - ">="
|
|
38
37
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '
|
|
38
|
+
version: '8.0'
|
|
40
39
|
- - "<"
|
|
41
40
|
- !ruby/object:Gem::Version
|
|
42
41
|
version: '9.0'
|
|
@@ -46,7 +45,7 @@ dependencies:
|
|
|
46
45
|
requirements:
|
|
47
46
|
- - ">="
|
|
48
47
|
- !ruby/object:Gem::Version
|
|
49
|
-
version: '
|
|
48
|
+
version: '8.0'
|
|
50
49
|
- - "<"
|
|
51
50
|
- !ruby/object:Gem::Version
|
|
52
51
|
version: '9.0'
|
|
@@ -56,46 +55,81 @@ dependencies:
|
|
|
56
55
|
requirements:
|
|
57
56
|
- - "~>"
|
|
58
57
|
- !ruby/object:Gem::Version
|
|
59
|
-
version: '1.
|
|
58
|
+
version: '1.5'
|
|
60
59
|
type: :runtime
|
|
61
60
|
prerelease: false
|
|
62
61
|
version_requirements: !ruby/object:Gem::Requirement
|
|
63
62
|
requirements:
|
|
64
63
|
- - "~>"
|
|
65
64
|
- !ruby/object:Gem::Version
|
|
66
|
-
version: '1.
|
|
67
|
-
description: A Ruby gem that provides PostgreSQL schema-based multitenancy
|
|
68
|
-
tenant resolution
|
|
69
|
-
|
|
65
|
+
version: '1.5'
|
|
66
|
+
description: A modern Ruby gem that provides PostgreSQL schema-based multitenancy
|
|
67
|
+
with automatic tenant resolution and schema switching. Built for Rails 8+ and Ruby
|
|
68
|
+
3.3+, focusing on security, performance, and developer experience. Perfect for modern
|
|
69
|
+
SaaS applications requiring secure tenant isolation.
|
|
70
70
|
email:
|
|
71
71
|
- rubenpazchuspe@outlook.com
|
|
72
72
|
executables: []
|
|
73
73
|
extensions: []
|
|
74
74
|
extra_rdoc_files: []
|
|
75
75
|
files:
|
|
76
|
+
- ".actrc"
|
|
77
|
+
- ".env.local.example"
|
|
76
78
|
- ".rspec"
|
|
77
79
|
- ".rubocop.yml"
|
|
78
80
|
- ".rubocop_simple.yml"
|
|
81
|
+
- ".ruby-version"
|
|
79
82
|
- CHANGELOG.md
|
|
80
83
|
- CODE_OF_CONDUCT.md
|
|
81
84
|
- LICENSE.txt
|
|
85
|
+
- LOCAL_TESTING_SUMMARY.md
|
|
82
86
|
- README.md
|
|
83
87
|
- Rakefile
|
|
88
|
+
- TESTING_LOCALLY.md
|
|
89
|
+
- docs/README.md
|
|
90
|
+
- docs/configuration.md
|
|
91
|
+
- docs/context.md
|
|
92
|
+
- docs/errors.md
|
|
93
|
+
- docs/github_actions_permissions_fix.md
|
|
94
|
+
- docs/github_actions_setup.md
|
|
95
|
+
- docs/integration_testing.md
|
|
96
|
+
- docs/local_workflow_testing.md
|
|
97
|
+
- docs/migrator.md
|
|
98
|
+
- docs/rails_integration.md
|
|
99
|
+
- docs/schema_switcher.md
|
|
100
|
+
- docs/tenant_resolver.md
|
|
101
|
+
- docs/testing.md
|
|
102
|
+
- examples/context_management.rb
|
|
103
|
+
- examples/migration_workflow.rb
|
|
104
|
+
- examples/rails_integration/controller_examples.rb
|
|
105
|
+
- examples/schema_operations.rb
|
|
84
106
|
- lib/pg_multitenant_schemas.rb
|
|
85
107
|
- lib/pg_multitenant_schemas/configuration.rb
|
|
86
108
|
- lib/pg_multitenant_schemas/context.rb
|
|
87
109
|
- lib/pg_multitenant_schemas/errors.rb
|
|
110
|
+
- lib/pg_multitenant_schemas/migration_display_reporter.rb
|
|
111
|
+
- lib/pg_multitenant_schemas/migration_executor.rb
|
|
112
|
+
- lib/pg_multitenant_schemas/migration_schema_operations.rb
|
|
113
|
+
- lib/pg_multitenant_schemas/migration_status_reporter.rb
|
|
114
|
+
- lib/pg_multitenant_schemas/migrator.rb
|
|
88
115
|
- lib/pg_multitenant_schemas/rails/controller_concern.rb
|
|
89
116
|
- lib/pg_multitenant_schemas/rails/model_concern.rb
|
|
90
117
|
- lib/pg_multitenant_schemas/rails/railtie.rb
|
|
91
118
|
- lib/pg_multitenant_schemas/schema_switcher.rb
|
|
119
|
+
- lib/pg_multitenant_schemas/tasks/advanced_tasks.rake
|
|
120
|
+
- lib/pg_multitenant_schemas/tasks/basic_tasks.rake
|
|
92
121
|
- lib/pg_multitenant_schemas/tasks/pg_multitenant_schemas.rake
|
|
122
|
+
- lib/pg_multitenant_schemas/tasks/tenant_tasks.rake
|
|
93
123
|
- lib/pg_multitenant_schemas/tenant_resolver.rb
|
|
124
|
+
- lib/pg_multitenant_schemas/tenant_task_helpers.rb
|
|
94
125
|
- lib/pg_multitenant_schemas/version.rb
|
|
95
126
|
- pg_multitenant_schemas.gemspec
|
|
127
|
+
- pre-push-check.sh
|
|
96
128
|
- rails_integration/app/controllers/application_controller.rb
|
|
97
129
|
- rails_integration/app/models/tenant.rb
|
|
98
130
|
- sig/pg_multitenant_schemas.rbs
|
|
131
|
+
- test-github-setup.sh
|
|
132
|
+
- validate-github-commands.sh
|
|
99
133
|
homepage: https://github.com/rubenpazch/pg_multitenant_schemas
|
|
100
134
|
licenses:
|
|
101
135
|
- MIT
|
|
@@ -104,7 +138,6 @@ metadata:
|
|
|
104
138
|
homepage_uri: https://github.com/rubenpazch/pg_multitenant_schemas
|
|
105
139
|
source_code_uri: https://github.com/rubenpazch/pg_multitenant_schemas
|
|
106
140
|
changelog_uri: https://github.com/rubenpazch/pg_multitenant_schemas/blob/main/CHANGELOG.md
|
|
107
|
-
post_install_message:
|
|
108
141
|
rdoc_options: []
|
|
109
142
|
require_paths:
|
|
110
143
|
- lib
|
|
@@ -112,15 +145,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
112
145
|
requirements:
|
|
113
146
|
- - ">="
|
|
114
147
|
- !ruby/object:Gem::Version
|
|
115
|
-
version: 3.
|
|
148
|
+
version: 3.0.0
|
|
116
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
150
|
requirements:
|
|
118
151
|
- - ">="
|
|
119
152
|
- !ruby/object:Gem::Version
|
|
120
153
|
version: '0'
|
|
121
154
|
requirements: []
|
|
122
|
-
rubygems_version: 3.
|
|
123
|
-
signing_key:
|
|
155
|
+
rubygems_version: 3.6.7
|
|
124
156
|
specification_version: 4
|
|
125
|
-
summary: PostgreSQL schema-based multitenancy for Rails applications
|
|
157
|
+
summary: Modern PostgreSQL schema-based multitenancy for Rails 8+ applications
|
|
126
158
|
test_files: []
|