From 6f0deb57da9b0a2b975e7cf344e9d2476030dbde Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Mon, 19 May 2025 15:17:54 +0200 Subject: [PATCH] refactor(chalice): changed default scope state --- api/chalicelib/core/signup.py | 2 +- ee/api/chalicelib/core/signup.py | 2 +- ee/scripts/schema/db/init_dbs/postgresql/1.23.0/1.23.0.sql | 2 ++ ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql | 2 +- scripts/schema/db/init_dbs/postgresql/1.23.0/1.23.0.sql | 2 ++ scripts/schema/db/init_dbs/postgresql/init_schema.sql | 2 +- 6 files changed, 8 insertions(+), 4 deletions(-) diff --git a/api/chalicelib/core/signup.py b/api/chalicelib/core/signup.py index 2c8c850ef..3819784ad 100644 --- a/api/chalicelib/core/signup.py +++ b/api/chalicelib/core/signup.py @@ -87,7 +87,7 @@ async def create_tenant(data: schemas.UserSignupSchema): "spotRefreshToken": r.pop("spotRefreshToken"), "spotRefreshTokenMaxAge": r.pop("spotRefreshTokenMaxAge"), 'data': { - "scopeState": 0, + "scopeState": 2, "user": r } } diff --git a/ee/api/chalicelib/core/signup.py b/ee/api/chalicelib/core/signup.py index a2ee66d04..d7a031957 100644 --- a/ee/api/chalicelib/core/signup.py +++ b/ee/api/chalicelib/core/signup.py @@ -98,7 +98,7 @@ async def create_tenant(data: schemas.UserSignupSchema): "spotRefreshTokenMaxAge": r.pop("spotRefreshTokenMaxAge"), "tenantId": t["tenant_id"], 'data': { - "scopeState": 0, + "scopeState": 2, "user": r } } diff --git a/ee/scripts/schema/db/init_dbs/postgresql/1.23.0/1.23.0.sql b/ee/scripts/schema/db/init_dbs/postgresql/1.23.0/1.23.0.sql index f3c024fb5..718a6e693 100644 --- a/ee/scripts/schema/db/init_dbs/postgresql/1.23.0/1.23.0.sql +++ b/ee/scripts/schema/db/init_dbs/postgresql/1.23.0/1.23.0.sql @@ -20,6 +20,8 @@ $fn_def$, :'next_version') -- DROP SCHEMA IF EXISTS or_cache CASCADE; +ALTER TABLE public.tenants + ALTER COLUMN scope_state SET DEFAULT 2; COMMIT; diff --git a/ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql b/ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql index bc95e97d4..4701bc53f 100644 --- a/ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql +++ b/ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql @@ -104,7 +104,7 @@ CREATE TABLE public.tenants t_users integer NOT NULL DEFAULT 1, t_integrations integer NOT NULL DEFAULT 0, last_telemetry bigint NOT NULL DEFAULT CAST(EXTRACT(epoch FROM date_trunc('day', now())) * 1000 AS BIGINT), - scope_state smallint NOT NULL DEFAULT 0 + scope_state smallint NOT NULL DEFAULT 2 ); diff --git a/scripts/schema/db/init_dbs/postgresql/1.23.0/1.23.0.sql b/scripts/schema/db/init_dbs/postgresql/1.23.0/1.23.0.sql index 79076b23e..8003f6753 100644 --- a/scripts/schema/db/init_dbs/postgresql/1.23.0/1.23.0.sql +++ b/scripts/schema/db/init_dbs/postgresql/1.23.0/1.23.0.sql @@ -20,6 +20,8 @@ $fn_def$, :'next_version') -- DROP SCHEMA IF EXISTS or_cache CASCADE; +ALTER TABLE public.tenants + ALTER COLUMN scope_state SET DEFAULT 2; COMMIT; diff --git a/scripts/schema/db/init_dbs/postgresql/init_schema.sql b/scripts/schema/db/init_dbs/postgresql/init_schema.sql index 9db52343b..7c6eb396e 100644 --- a/scripts/schema/db/init_dbs/postgresql/init_schema.sql +++ b/scripts/schema/db/init_dbs/postgresql/init_schema.sql @@ -103,7 +103,7 @@ CREATE TABLE public.tenants t_users integer NOT NULL DEFAULT 1, t_integrations integer NOT NULL DEFAULT 0, last_telemetry bigint NOT NULL DEFAULT CAST(EXTRACT(epoch FROM date_trunc('day', now())) * 1000 AS BIGINT), - scope_state smallint NOT NULL DEFAULT 0, + scope_state smallint NOT NULL DEFAULT 2, CONSTRAINT onerow_uni CHECK (tenant_id = 1) );