Skip to content

Commit 72c9963

Browse files
committed
add autoTenantActivation and update README
1 parent c44ecc6 commit 72c9963

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ Any schema can be multi-tenant
359359
```ruby
360360
client.schema.create(
361361
# Other keys...
362-
mutli_tenant: true, # passes { enabled: true } to weaviate
362+
multi_tenant: true, # passes { enabled: true } to weaviate
363363
)
364364
```
365365

@@ -368,7 +368,18 @@ You can also manually specify your multi tenancy configuration with a hash
368368
```ruby
369369
client.schema.create(
370370
# Other keys...
371-
mutli_tenant: { enabled: true, autoTenantCreation: true, autoTenantActivation: true },
371+
multi_tenant: { enabled: true, autoTenantCreation: true, autoTenantActivation: true },
372+
)
373+
```
374+
375+
Added shortcuts for `multiTenancyConfig`:
376+
377+
```ruby
378+
client.schema.create(
379+
# Other keys...
380+
multi_tenant: true,
381+
auto_tenant_creation: true,
382+
auto_tenant_activation: true
372383
)
373384
```
374385

lib/weaviate/schema.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def create(
2828
properties: nil,
2929
multi_tenant: nil,
3030
auto_tenant_creation: nil,
31+
auto_tenant_activation: nil,
3132
vector_index_type: nil,
3233
vector_index_config: nil,
3334
vectorizer: nil,
@@ -49,6 +50,7 @@ def create(
4950
elsif !multi_tenant.nil?
5051
req.body["multiTenancyConfig"] = { enabled: true }
5152
req.body["multiTenancyConfig"].merge!(autoTenantCreation: true) unless auto_tenant_creation.nil?
53+
req.body["multiTenancyConfig"].merge!(autoTenantActivation: true) unless auto_tenant_activation.nil?
5254
end
5355
req.body["invertedIndexConfig"] = inverted_index_config unless inverted_index_config.nil?
5456
req.body["replicationConfig"] = replication_config unless replication_config.nil?

spec/weaviate/schema_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,16 @@
8989
end
9090
end
9191

92-
it "sets up multiTenancyConfig with autoTenantCreation enabled" do
92+
it "sets up multiTenancyConfig with autoTenantCreation and autoTenantActivation enabled" do
9393
schema.create(
9494
class_name: "Question",
9595
description: "Information from a Jeopardy! question",
9696
multi_tenant: true,
97-
auto_tenant_creation: true
97+
auto_tenant_creation: true,
98+
auto_tenant_activation: true
9899
)
99100

100-
expect(@captured_request.body["multiTenancyConfig"]).to eq({ enabled: true, autoTenantCreation: true })
101+
expect(@captured_request.body["multiTenancyConfig"]).to eq({ enabled: true, autoTenantCreation: true, autoTenantActivation: true })
101102
end
102103
end
103104
end

0 commit comments

Comments
 (0)