pg_rls 0.2.5 → 1.0.1

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.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +55 -17
  3. data/.ruby-version +1 -0
  4. data/CHANGELOG.md +19 -2
  5. data/CODE_OF_CONDUCT.md +77 -29
  6. data/Guardfile +44 -0
  7. data/README.md +247 -83
  8. data/Rakefile +5 -12
  9. data/Steepfile +29 -0
  10. data/UPGRADE.md +106 -0
  11. data/app/models/pg_rls/admin.rb +24 -0
  12. data/app/models/pg_rls/current.rb +48 -0
  13. data/app/models/pg_rls/record.rb +13 -0
  14. data/app/models/pg_rls/tenant/searchable.rb +60 -0
  15. data/app/models/pg_rls/tenant/securable.rb +67 -0
  16. data/app/models/pg_rls/tenant/switchable.rb +40 -0
  17. data/app/models/pg_rls/tenant.rb +9 -0
  18. data/assets/logo.svg +8 -0
  19. data/docker-compose.yml +14 -0
  20. data/lib/generators/pg_rls/active_record/active_record_generator.rb +62 -65
  21. data/lib/generators/pg_rls/install/install_generator.rb +38 -0
  22. data/lib/generators/pg_rls/pg_rls_generator.rb +2 -1
  23. data/lib/generators/pg_rls/templates/USAGE +28 -0
  24. data/lib/generators/pg_rls/{active_record/templates → templates/app/models}/abstract_base_class.rb.tt +1 -3
  25. data/lib/generators/pg_rls/{active_record/templates → templates/app/models}/model.rb.tt +0 -2
  26. data/lib/generators/pg_rls/templates/config/initializers/pg_rls.rb.tt +58 -0
  27. data/lib/generators/pg_rls/templates/db/migrate/backport_pg_rls_table.rb.tt +14 -0
  28. data/lib/generators/pg_rls/templates/db/migrate/convert_to_pg_rls_table.rb.tt +5 -0
  29. data/lib/generators/pg_rls/templates/db/migrate/convert_to_pg_rls_tenant_table.rb.tt +5 -0
  30. data/lib/generators/pg_rls/templates/db/migrate/create_pg_rls_table.rb.tt +29 -0
  31. data/lib/generators/pg_rls/templates/db/migrate/create_pg_rls_tenant_table.rb.tt +29 -0
  32. data/lib/pg_rls/active_record/connection_adapters/connection_pool.rb +31 -0
  33. data/lib/pg_rls/active_record/connection_adapters/postgre_sql/check_rls_user_privileges.rb +207 -0
  34. data/lib/pg_rls/active_record/connection_adapters/postgre_sql/errors.rb +17 -0
  35. data/lib/pg_rls/active_record/connection_adapters/postgre_sql/grant_rls_user_privileges.rb +167 -0
  36. data/lib/pg_rls/active_record/connection_adapters/postgre_sql/rls_functions.rb +91 -0
  37. data/lib/pg_rls/active_record/connection_adapters/postgre_sql/rls_policies.rb +56 -0
  38. data/lib/pg_rls/active_record/connection_adapters/postgre_sql/rls_triggers.rb +95 -0
  39. data/lib/pg_rls/active_record/connection_adapters/postgre_sql/rls_user_statements.rb +127 -0
  40. data/lib/pg_rls/active_record/connection_adapters/postgre_sql/schema_dumper.rb +71 -0
  41. data/lib/pg_rls/active_record/connection_adapters/postgre_sql/schema_statements.rb +120 -0
  42. data/lib/pg_rls/active_record/connection_adapters/postgre_sql/sql_helper_method.rb +30 -0
  43. data/lib/pg_rls/active_record/connection_adapters/postgre_sql.rb +36 -0
  44. data/lib/pg_rls/active_record/connection_adapters.rb +12 -0
  45. data/lib/pg_rls/active_record/database_shards.rb +74 -0
  46. data/lib/pg_rls/active_record/migration/command_recorder.rb +28 -0
  47. data/lib/pg_rls/active_record/migration.rb +11 -0
  48. data/lib/pg_rls/active_record/test_databases.rb +19 -0
  49. data/lib/pg_rls/active_record.rb +11 -0
  50. data/lib/pg_rls/active_support/string_ext.rb +17 -0
  51. data/lib/pg_rls/active_support.rb +9 -0
  52. data/lib/pg_rls/connection_config.rb +61 -0
  53. data/lib/pg_rls/deprecation.rb +14 -0
  54. data/lib/pg_rls/engine.rb +8 -0
  55. data/lib/pg_rls/error.rb +10 -0
  56. data/lib/pg_rls/generators/.keep +0 -0
  57. data/lib/pg_rls/railtie.rb +1 -11
  58. data/lib/pg_rls/tasks/.keep +0 -0
  59. data/lib/pg_rls/version.rb +3 -1
  60. data/lib/pg_rls.rb +67 -151
  61. data/rbs_collection.lock.yaml +132 -0
  62. data/rbs_collection.yaml +127 -0
  63. data/review_code.sh +33 -0
  64. data/sig/generators/pg_rls/active_record/active_record_generator.rbs +43 -0
  65. data/sig/generators/pg_rls/install/install_generator.rbs +20 -0
  66. data/sig/generators/pg_rls/pg_rls_generator.rbs +9 -0
  67. data/sig/pg_rls/active_record/connection_adapters/postgre_sql/check_rls_user_privileges.rbs +53 -0
  68. data/sig/pg_rls/active_record/connection_adapters/postgre_sql/errors.rbs +24 -0
  69. data/sig/pg_rls/active_record/connection_adapters/postgre_sql/grant_rls_user_privileges.rbs +55 -0
  70. data/sig/pg_rls/active_record/connection_adapters/postgre_sql/rls_functions.rbs +31 -0
  71. data/sig/pg_rls/active_record/connection_adapters/postgre_sql/rls_policies.rbs +28 -0
  72. data/sig/pg_rls/active_record/connection_adapters/postgre_sql/rls_triggers.rbs +35 -0
  73. data/sig/pg_rls/active_record/connection_adapters/postgre_sql/rls_user_statements.rbs +48 -0
  74. data/sig/pg_rls/active_record/connection_adapters/postgre_sql/schema_dumper.rbs +38 -0
  75. data/sig/pg_rls/active_record/connection_adapters/postgre_sql/schema_statements.rbs +67 -0
  76. data/sig/pg_rls/active_record/connection_adapters/postgre_sql/sql_helper_method.rbs +21 -0
  77. data/sig/pg_rls/active_record/connection_adapters/postgresql.rbs +10 -0
  78. data/sig/pg_rls/active_record/connection_adapters.rbs +50 -0
  79. data/sig/pg_rls/active_record/database_shards.rbs +34 -0
  80. data/sig/pg_rls/active_record/migration/command_recorder.rbs +14 -0
  81. data/sig/pg_rls/active_record/migration.rbs +8 -0
  82. data/sig/pg_rls/active_record.rbs +7 -0
  83. data/sig/pg_rls/active_support/hash_ext.rbs +11 -0
  84. data/sig/pg_rls/active_support/string_ext.rbs +27 -0
  85. data/sig/pg_rls/active_support.rbs +7 -0
  86. data/sig/pg_rls/app/models/pg_rls/record.rbs +4 -0
  87. data/sig/pg_rls/connection_config.rbs +16 -0
  88. data/sig/pg_rls/deprecation.rbs +9 -0
  89. data/sig/pg_rls/engine.rbs +7 -0
  90. data/sig/pg_rls/errors.rbs +14 -0
  91. data/sig/pg_rls/railtie.rbs +6 -0
  92. data/sig/pg_rls/tenant_test_helper.rbs +14 -0
  93. data/sig/pg_rls.rbs +60 -0
  94. data/sig/support/active_record.rbs +86 -0
  95. data/sig/support/active_support.rbs +7 -0
  96. data/sig/support/fowardable.rbs +2 -0
  97. data/sig/support/pg.rbs +12 -0
  98. data/sig/support/rails.rbs +38 -0
  99. data/start.sh +30 -0
  100. metadata +167 -48
  101. data/.rspec +0 -3
  102. data/Gemfile +0 -21
  103. data/Gemfile.lock +0 -300
  104. data/LICENSE.txt +0 -21
  105. data/bin/console +0 -15
  106. data/bin/setup +0 -8
  107. data/lib/generators/pg_rls/active_record/templates/convert_migration.rb.tt +0 -11
  108. data/lib/generators/pg_rls/active_record/templates/convert_migration_backport.rb.tt +0 -12
  109. data/lib/generators/pg_rls/active_record/templates/init_convert_migration.rb.tt +0 -11
  110. data/lib/generators/pg_rls/active_record/templates/init_migration.rb.tt +0 -25
  111. data/lib/generators/pg_rls/active_record/templates/init_model.rb.tt +0 -24
  112. data/lib/generators/pg_rls/active_record/templates/migration.rb.tt +0 -17
  113. data/lib/generators/pg_rls/base.rb +0 -36
  114. data/lib/generators/pg_rls/install_generator.rb +0 -90
  115. data/lib/generators/pg_rls.rb +0 -19
  116. data/lib/generators/templates/README +0 -22
  117. data/lib/generators/templates/pg_rls.rb.tt +0 -48
  118. data/lib/pg_rls/Rakefile +0 -7
  119. data/lib/pg_rls/current/context.rb +0 -10
  120. data/lib/pg_rls/database/admin_statements.rb +0 -28
  121. data/lib/pg_rls/database/configurations.rb +0 -46
  122. data/lib/pg_rls/database/prepared.rb +0 -40
  123. data/lib/pg_rls/database/tasks/admin_database.rake +0 -40
  124. data/lib/pg_rls/errors/index.rb +0 -4
  125. data/lib/pg_rls/errors/rake_only_error.rb +0 -12
  126. data/lib/pg_rls/errors/tenant_not_found.rb +0 -13
  127. data/lib/pg_rls/logger.rb +0 -31
  128. data/lib/pg_rls/middleware/set_reset_connection.rb +0 -93
  129. data/lib/pg_rls/middleware/sidekiq/client.rb +0 -22
  130. data/lib/pg_rls/middleware/sidekiq/server.rb +0 -19
  131. data/lib/pg_rls/middleware/sidekiq.rb +0 -11
  132. data/lib/pg_rls/middleware.rb +0 -8
  133. data/lib/pg_rls/multi_tenancy.rb +0 -32
  134. data/lib/pg_rls/schema/down_statements.rb +0 -54
  135. data/lib/pg_rls/schema/dumper.rb +0 -36
  136. data/lib/pg_rls/schema/statements.rb +0 -72
  137. data/lib/pg_rls/schema/up_statements.rb +0 -104
  138. data/lib/pg_rls/tenant.rb +0 -153
data/sig/pg_rls.rbs ADDED
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PgRls
4
+ VERSION: String
5
+ DEFAULT_CONFIG_MAP: Hash[Symbol, (Symbol | Array[Symbol] | Array[untyped] | String)]
6
+
7
+ def self.setup: () { (untyped) -> untyped } -> untyped
8
+
9
+ def self.reset_config!: () -> void
10
+
11
+ def self.main_model: () -> untyped
12
+
13
+ def self.connection_config?: () -> bool
14
+
15
+ def self.freeze_config!: () -> void
16
+
17
+ def self.invalid_connection_config: () -> bot
18
+
19
+ @@search_methods: Array[Symbol]
20
+ def self.search_methods: () -> Array[Symbol]
21
+ def self.search_methods=: (Array[Symbol]) -> Array[Symbol]
22
+
23
+ @@table_name: String | Symbol
24
+ def self.table_name: () -> (String | Symbol)
25
+ def self.table_name=: (String | Symbol) -> (String | Symbol)
26
+
27
+ @@class_name: String | Symbol
28
+ def self.class_name: () -> (String | Symbol)
29
+ def self.class_name=: (String | Symbol) -> (String | Symbol)
30
+
31
+ @@username: String | Symbol
32
+ def self.username: () -> (String | Symbol)
33
+ def self.username=: (String | Symbol) -> (String | Symbol)
34
+
35
+ @@password: String | Symbol
36
+ def self.password: () -> (String | Symbol)
37
+ def self.password=: (String | Symbol) -> (String | Symbol)
38
+
39
+ @@schema: String | Symbol
40
+ def self.schema: () -> (String | Symbol)
41
+ def self.schema=: (String | Symbol) -> (String | Symbol)
42
+
43
+ @@rls_role_group: String | Symbol
44
+ def self.rls_role_group: () -> (String | Symbol)
45
+ def self.rls_role_group=: (String | Symbol) -> (String | Symbol)
46
+
47
+ @@connects_to: nil | Hash[Symbol, Hash[Symbol, Symbol]]
48
+ def self.connects_to: () -> (Hash[Symbol, Hash[Symbol, Symbol]] | nil)
49
+ def self.connects_to=: (Hash[Symbol, Hash[Symbol, Symbol]] | nil) -> (Hash[Symbol, Hash[Symbol, Symbol]] | nil)
50
+
51
+ @@current_attributes: Array[untyped]
52
+ def self.current_attributes: () -> Array[untyped]
53
+ def self.current_attributes=: (Array[untyped]) -> Array[untyped]
54
+
55
+ @@abstract_base_record_class: String | Symbol
56
+ def self.abstract_base_record_class: () -> (String | Symbol)
57
+ def self.abstract_base_record_class=: (String | Symbol) -> (String | Symbol)
58
+
59
+ def self.mattr_accessor: (Symbol) -> untyped
60
+ end
@@ -0,0 +1,86 @@
1
+ module ActiveRecord
2
+ class StatementInvalid < StandardError
3
+ end
4
+
5
+ class Base
6
+ def self.ignored_columns=: (Array[(Symbol | String)]) -> Array[Symbol]
7
+
8
+ def self.ignored_columns: () -> Array[Symbol]
9
+
10
+ def self.connection: () -> ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
11
+
12
+ def self.transaction: (requires_new: bool?) { () -> untyped } -> untyped
13
+
14
+ def self.connection_db_config: () -> ActiveRecord::DatabaseConfigurations::HashConfig
15
+ end
16
+
17
+ class DatabaseConfigurations
18
+ class HashConfig
19
+ def configuration_hash: () -> Hash[Symbol, untyped]
20
+
21
+ def name: () -> String
22
+ end
23
+ end
24
+
25
+ module Migration
26
+ class CommandRecorder
27
+ def self.included: (Class) -> void
28
+ end
29
+ end
30
+
31
+ module Generators
32
+ class ModelGenerator < ::Rails::Generators::Base
33
+ def self.class_option: (Symbol, ?Hash[Symbol, untyped]) -> void
34
+
35
+ def check_class_collision: () -> void
36
+
37
+ @class_coalescing: bool
38
+
39
+ def destination_root: () -> String
40
+
41
+ def attributes: () -> Array[ActiveRecord::Generators::Attribute]
42
+
43
+ def options: () -> Hash[Symbol, untyped]
44
+
45
+ def database: () -> String
46
+
47
+ def file_name: () -> String
48
+
49
+ def class_path: () -> String
50
+
51
+ def migration_template: (String, ?String) -> void
52
+
53
+ def table_name: () -> String
54
+
55
+ def skip_migration_creation?: () -> bool
56
+
57
+ def custom_parent?: () -> bool
58
+ end
59
+
60
+ class Attribute
61
+ # a.attr_options.delete(:index) if a.reference? && !a.has_index?
62
+ def has_index?: () -> bool
63
+
64
+ def attr_options: () -> Hash[Symbol, untyped]
65
+
66
+ def reference?: () -> bool
67
+ end
68
+ end
69
+
70
+ module ConnectionAdapters
71
+ class AbstractAdapter
72
+ def rollback_db_transaction: () -> void
73
+ end
74
+
75
+ class PostgreSQLAdapter < AbstractAdapter
76
+ def execute: (String) -> untyped
77
+ end
78
+ module PostgreSQL
79
+ class SchemaStatements
80
+ end
81
+
82
+ class SchemaDumper
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,7 @@
1
+ module ActiveSupport
2
+ class Deprecation
3
+ def warn: (String) -> void
4
+
5
+ def initialize: (String, String) -> void
6
+ end
7
+ end
@@ -0,0 +1,2 @@
1
+ module Forwardable
2
+ end
@@ -0,0 +1,12 @@
1
+ module PG
2
+ class Result
3
+ # Define methods that you are using from PG::Result, for example:
4
+ def each: () { (Hash[String, untyped]) -> void } -> void
5
+ def getvalue: (Integer, Integer) -> String
6
+ def ntuples: () -> Integer
7
+ def nfields: () -> Integer
8
+ def any?: () -> bool
9
+ def present?: () -> bool
10
+ # You can add more methods as needed
11
+ end
12
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rails
4
+ def self.application: () -> untyped
5
+
6
+ def self.env: () -> untyped
7
+
8
+ class Engine
9
+ # Define isolate_namespace to accept a Module and return untyped
10
+ def self.isolate_namespace: (Module) -> untyped
11
+ end
12
+
13
+ class Railtie
14
+ end
15
+
16
+ module Generators
17
+ class Error < StandardError
18
+ end
19
+
20
+ class NamedBase
21
+ def self.hook_for: (Symbol, required: bool) -> void
22
+ end
23
+
24
+ class Base
25
+ def self.hook_for: (Symbol, required: bool) -> void
26
+
27
+ def self.source_root: (String) -> void
28
+
29
+ def behavior: -> Symbol
30
+
31
+ def readme: (String) -> void
32
+
33
+ def template: (String, ?String) -> void
34
+
35
+ def gsub_file: (String, Regexp, String) -> void
36
+ end
37
+ end
38
+ end
data/start.sh ADDED
@@ -0,0 +1,30 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+ set -x
5
+
6
+ if [[ $@ =~ (.*(clean)){1} ]]; then
7
+ docker stop $(docker ps -aq)
8
+ fi
9
+
10
+ docker_compose() {
11
+ if docker-compose version >/dev/null 2>&1; then
12
+ docker-compose $@
13
+ else
14
+ docker compose $@
15
+ fi
16
+ }
17
+
18
+ if [[ $@ =~ (.*(pull)){1} ]]; then
19
+ if [[ $@ =~ (.*(no-cache)){1} ]]; then
20
+ docker_compose pull --no-cache
21
+ else
22
+ docker_compose pull
23
+ fi
24
+ fi
25
+
26
+ if [[ $@ =~ (.*(dev)){1} ]]; then
27
+ docker_compose up
28
+ else
29
+ docker_compose up -d
30
+ fi
metadata CHANGED
@@ -1,15 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_rls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Laloush
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-09 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2025-06-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activerecord
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 7.2.2
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '9.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 7.2.2
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '9.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: pg
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.2'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.2'
47
+ - !ruby/object:Gem::Dependency
48
+ name: railties
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '7.2'
54
+ - - "<"
55
+ - !ruby/object:Gem::Version
56
+ version: '9.0'
57
+ type: :runtime
58
+ prerelease: false
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '7.2'
64
+ - - "<"
65
+ - !ruby/object:Gem::Version
66
+ version: '9.0'
67
+ - !ruby/object:Gem::Dependency
68
+ name: warden
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: '1.2'
74
+ type: :runtime
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '1.2'
13
81
  description: |2
14
82
  This gem will help you to integrate PostgreSQL RLS to help you develop a great multitenancy application
15
83
  checkout the repository at https://github.com/Dandush03/pg_rls
@@ -19,70 +87,121 @@ executables: []
19
87
  extensions: []
20
88
  extra_rdoc_files: []
21
89
  files:
22
- - ".rspec"
23
90
  - ".rubocop.yml"
91
+ - ".ruby-version"
24
92
  - CHANGELOG.md
25
93
  - CODE_OF_CONDUCT.md
26
- - Gemfile
27
- - Gemfile.lock
28
- - LICENSE.txt
94
+ - Guardfile
29
95
  - README.md
30
96
  - Rakefile
31
- - bin/console
32
- - bin/setup
33
- - lib/generators/pg_rls.rb
97
+ - Steepfile
98
+ - UPGRADE.md
99
+ - app/models/pg_rls/admin.rb
100
+ - app/models/pg_rls/current.rb
101
+ - app/models/pg_rls/record.rb
102
+ - app/models/pg_rls/tenant.rb
103
+ - app/models/pg_rls/tenant/searchable.rb
104
+ - app/models/pg_rls/tenant/securable.rb
105
+ - app/models/pg_rls/tenant/switchable.rb
106
+ - assets/logo.svg
107
+ - docker-compose.yml
34
108
  - lib/generators/pg_rls/active_record/active_record_generator.rb
35
- - lib/generators/pg_rls/active_record/templates/abstract_base_class.rb.tt
36
- - lib/generators/pg_rls/active_record/templates/convert_migration.rb.tt
37
- - lib/generators/pg_rls/active_record/templates/convert_migration_backport.rb.tt
38
- - lib/generators/pg_rls/active_record/templates/init_convert_migration.rb.tt
39
- - lib/generators/pg_rls/active_record/templates/init_migration.rb.tt
40
- - lib/generators/pg_rls/active_record/templates/init_model.rb.tt
41
- - lib/generators/pg_rls/active_record/templates/migration.rb.tt
42
- - lib/generators/pg_rls/active_record/templates/model.rb.tt
43
- - lib/generators/pg_rls/base.rb
44
- - lib/generators/pg_rls/install_generator.rb
109
+ - lib/generators/pg_rls/install/install_generator.rb
45
110
  - lib/generators/pg_rls/pg_rls_generator.rb
46
- - lib/generators/templates/README
47
- - lib/generators/templates/pg_rls.rb.tt
111
+ - lib/generators/pg_rls/templates/USAGE
112
+ - lib/generators/pg_rls/templates/app/models/abstract_base_class.rb.tt
113
+ - lib/generators/pg_rls/templates/app/models/model.rb.tt
114
+ - lib/generators/pg_rls/templates/config/initializers/pg_rls.rb.tt
115
+ - lib/generators/pg_rls/templates/db/migrate/backport_pg_rls_table.rb.tt
116
+ - lib/generators/pg_rls/templates/db/migrate/convert_to_pg_rls_table.rb.tt
117
+ - lib/generators/pg_rls/templates/db/migrate/convert_to_pg_rls_tenant_table.rb.tt
118
+ - lib/generators/pg_rls/templates/db/migrate/create_pg_rls_table.rb.tt
119
+ - lib/generators/pg_rls/templates/db/migrate/create_pg_rls_tenant_table.rb.tt
48
120
  - lib/pg_rls.rb
49
- - lib/pg_rls/Rakefile
50
- - lib/pg_rls/current/context.rb
51
- - lib/pg_rls/database/admin_statements.rb
52
- - lib/pg_rls/database/configurations.rb
53
- - lib/pg_rls/database/prepared.rb
54
- - lib/pg_rls/database/tasks/admin_database.rake
55
- - lib/pg_rls/errors/index.rb
56
- - lib/pg_rls/errors/rake_only_error.rb
57
- - lib/pg_rls/errors/tenant_not_found.rb
58
- - lib/pg_rls/logger.rb
59
- - lib/pg_rls/middleware.rb
60
- - lib/pg_rls/middleware/set_reset_connection.rb
61
- - lib/pg_rls/middleware/sidekiq.rb
62
- - lib/pg_rls/middleware/sidekiq/client.rb
63
- - lib/pg_rls/middleware/sidekiq/server.rb
64
- - lib/pg_rls/multi_tenancy.rb
121
+ - lib/pg_rls/active_record.rb
122
+ - lib/pg_rls/active_record/connection_adapters.rb
123
+ - lib/pg_rls/active_record/connection_adapters/connection_pool.rb
124
+ - lib/pg_rls/active_record/connection_adapters/postgre_sql.rb
125
+ - lib/pg_rls/active_record/connection_adapters/postgre_sql/check_rls_user_privileges.rb
126
+ - lib/pg_rls/active_record/connection_adapters/postgre_sql/errors.rb
127
+ - lib/pg_rls/active_record/connection_adapters/postgre_sql/grant_rls_user_privileges.rb
128
+ - lib/pg_rls/active_record/connection_adapters/postgre_sql/rls_functions.rb
129
+ - lib/pg_rls/active_record/connection_adapters/postgre_sql/rls_policies.rb
130
+ - lib/pg_rls/active_record/connection_adapters/postgre_sql/rls_triggers.rb
131
+ - lib/pg_rls/active_record/connection_adapters/postgre_sql/rls_user_statements.rb
132
+ - lib/pg_rls/active_record/connection_adapters/postgre_sql/schema_dumper.rb
133
+ - lib/pg_rls/active_record/connection_adapters/postgre_sql/schema_statements.rb
134
+ - lib/pg_rls/active_record/connection_adapters/postgre_sql/sql_helper_method.rb
135
+ - lib/pg_rls/active_record/database_shards.rb
136
+ - lib/pg_rls/active_record/migration.rb
137
+ - lib/pg_rls/active_record/migration/command_recorder.rb
138
+ - lib/pg_rls/active_record/test_databases.rb
139
+ - lib/pg_rls/active_support.rb
140
+ - lib/pg_rls/active_support/string_ext.rb
141
+ - lib/pg_rls/connection_config.rb
142
+ - lib/pg_rls/deprecation.rb
143
+ - lib/pg_rls/engine.rb
144
+ - lib/pg_rls/error.rb
145
+ - lib/pg_rls/generators/.keep
65
146
  - lib/pg_rls/railtie.rb
66
- - lib/pg_rls/schema/down_statements.rb
67
- - lib/pg_rls/schema/dumper.rb
68
- - lib/pg_rls/schema/statements.rb
69
- - lib/pg_rls/schema/up_statements.rb
70
- - lib/pg_rls/tenant.rb
147
+ - lib/pg_rls/tasks/.keep
71
148
  - lib/pg_rls/version.rb
149
+ - rbs_collection.lock.yaml
150
+ - rbs_collection.yaml
151
+ - review_code.sh
152
+ - sig/generators/pg_rls/active_record/active_record_generator.rbs
153
+ - sig/generators/pg_rls/install/install_generator.rbs
154
+ - sig/generators/pg_rls/pg_rls_generator.rbs
155
+ - sig/pg_rls.rbs
156
+ - sig/pg_rls/active_record.rbs
157
+ - sig/pg_rls/active_record/connection_adapters.rbs
158
+ - sig/pg_rls/active_record/connection_adapters/postgre_sql/check_rls_user_privileges.rbs
159
+ - sig/pg_rls/active_record/connection_adapters/postgre_sql/errors.rbs
160
+ - sig/pg_rls/active_record/connection_adapters/postgre_sql/grant_rls_user_privileges.rbs
161
+ - sig/pg_rls/active_record/connection_adapters/postgre_sql/rls_functions.rbs
162
+ - sig/pg_rls/active_record/connection_adapters/postgre_sql/rls_policies.rbs
163
+ - sig/pg_rls/active_record/connection_adapters/postgre_sql/rls_triggers.rbs
164
+ - sig/pg_rls/active_record/connection_adapters/postgre_sql/rls_user_statements.rbs
165
+ - sig/pg_rls/active_record/connection_adapters/postgre_sql/schema_dumper.rbs
166
+ - sig/pg_rls/active_record/connection_adapters/postgre_sql/schema_statements.rbs
167
+ - sig/pg_rls/active_record/connection_adapters/postgre_sql/sql_helper_method.rbs
168
+ - sig/pg_rls/active_record/connection_adapters/postgresql.rbs
169
+ - sig/pg_rls/active_record/database_shards.rbs
170
+ - sig/pg_rls/active_record/migration.rbs
171
+ - sig/pg_rls/active_record/migration/command_recorder.rbs
172
+ - sig/pg_rls/active_support.rbs
173
+ - sig/pg_rls/active_support/hash_ext.rbs
174
+ - sig/pg_rls/active_support/string_ext.rbs
175
+ - sig/pg_rls/app/models/pg_rls/record.rbs
176
+ - sig/pg_rls/connection_config.rbs
177
+ - sig/pg_rls/deprecation.rbs
178
+ - sig/pg_rls/engine.rbs
179
+ - sig/pg_rls/errors.rbs
180
+ - sig/pg_rls/railtie.rbs
181
+ - sig/pg_rls/tenant_test_helper.rbs
182
+ - sig/support/active_record.rbs
183
+ - sig/support/active_support.rbs
184
+ - sig/support/fowardable.rbs
185
+ - sig/support/pg.rbs
186
+ - sig/support/rails.rbs
187
+ - start.sh
72
188
  homepage: https://github.com/Dandush03/pg_rls
73
189
  licenses:
74
190
  - MIT
75
191
  metadata:
192
+ homepage_uri: https://github.com/Dandush03/pg_rls
193
+ source_code_uri: https://github.com/Dandush03/pg_rls
194
+ changelog_uri: https://github.com/Dandush03/pg_rls/releases
76
195
  rubygems_mfa_required: 'true'
77
- post_install_message:
196
+ post_install_message:
78
197
  rdoc_options: []
79
198
  require_paths:
80
199
  - lib
81
200
  required_ruby_version: !ruby/object:Gem::Requirement
82
201
  requirements:
83
- - - "~>"
202
+ - - ">="
84
203
  - !ruby/object:Gem::Version
85
- version: '3.2'
204
+ version: 3.0.0
86
205
  required_rubygems_version: !ruby/object:Gem::Requirement
87
206
  requirements:
88
207
  - - ">="
@@ -90,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
209
  version: '0'
91
210
  requirements: []
92
211
  rubygems_version: 3.5.16
93
- signing_key:
212
+ signing_key:
94
213
  specification_version: 4
95
214
  summary: Write a short summary, because RubyGems requires one.
96
215
  test_files: []
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/Gemfile DELETED
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- # Specify your gem's dependencies in pg_rls.gemspec
6
- gemspec
7
- ruby '3.2.2'
8
-
9
- gem 'rails', '~> 7.0', '>= 7.0.4'
10
-
11
- gem 'rake'
12
-
13
- gem 'rspec'
14
-
15
- gem 'rubocop'
16
- gem 'rubocop-performance'
17
- gem 'rubocop-rails'
18
- gem 'rubocop-rake'
19
- gem 'rubocop-rspec'
20
- gem 'sidekiq'
21
- gem 'solargraph'