Api v1.14.0 (#1407)

* fix(DB): fixed feature-flag's payload type
This commit is contained in:
Kraiem Taha Yassine 2023-07-11 17:46:00 +02:00 committed by GitHub
parent eec574d10c
commit 0b95d26b40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 8 deletions

View file

@ -327,10 +327,10 @@ def update_feature_flag(project_id: int, feature_flag_id: int,
)
params = {
**feature_flag.dict(),
"updated_by": user_id,
"feature_flag_id": feature_flag_id,
"project_id": project_id,
**feature_flag.dict(),
"payload": json.dumps(feature_flag.payload),
}
@ -455,7 +455,8 @@ def create_variants(feature_flag_id: int, variants: List[schemas.FeatureFlagVari
"""
with pg_client.PostgresClient() as cur:
params = [(feature_flag_id, v.value, v.description, json.dumps(v.payload), v.rollout_percentage) for v in variants]
params = [(feature_flag_id, v.value, v.description, json.dumps(v.payload), v.rollout_percentage) for v in
variants]
query = cur.mogrify(sql, params)
cur.execute(query)
rows = cur.fetchall()

View file

@ -25,7 +25,7 @@ CREATE TABLE IF NOT EXISTS public.feature_flags
project_id integer NOT NULL REFERENCES projects (project_id) ON DELETE CASCADE,
flag_key text NOT NULL,
description text DEFAULT NULL,
payload text DEFAULT NULL,
payload jsonb DEFAULT NULL,
flag_type text NOT NULL,
is_persist boolean NOT NULL DEFAULT FALSE,
is_active boolean NOT NULL DEFAULT FALSE,

View file

@ -903,7 +903,7 @@ $$
project_id integer NOT NULL REFERENCES projects (project_id) ON DELETE CASCADE,
flag_key text NOT NULL,
description text DEFAULT NULL,
payload text DEFAULT NULL,
payload jsonb DEFAULT NULL,
flag_type text NOT NULL,
is_persist boolean NOT NULL DEFAULT FALSE,
is_active boolean NOT NULL DEFAULT FALSE,

View file

@ -24,8 +24,8 @@ CREATE TABLE IF NOT EXISTS public.feature_flags
feature_flag_id integer generated BY DEFAULT AS IDENTITY PRIMARY KEY,
project_id integer NOT NULL REFERENCES projects (project_id) ON DELETE CASCADE,
flag_key text NOT NULL,
description text DEFAULT NULL::text,
payload text DEFAULT NULL::text,
description text DEFAULT NULL,
payload jsonb DEFAULT NULL,
flag_type text NOT NULL,
is_persist boolean NOT NULL DEFAULT FALSE,
is_active boolean NOT NULL DEFAULT FALSE,
@ -55,7 +55,7 @@ CREATE TABLE IF NOT EXISTS public.feature_flags_variants
variant_id integer generated BY DEFAULT AS IDENTITY PRIMARY KEY,
feature_flag_id integer NOT NULL REFERENCES feature_flags (feature_flag_id) ON DELETE CASCADE,
value text NOT NULL,
description text DEFAULT NULL::text,
description text DEFAULT NULL,
payload jsonb DEFAULT NULL,
rollout_percentage integer DEFAULT 0
);

View file

@ -983,7 +983,7 @@ $$
project_id integer NOT NULL REFERENCES projects (project_id) ON DELETE CASCADE,
flag_key text NOT NULL,
description text DEFAULT NULL,
payload text DEFAULT NULL,
payload jsonb DEFAULT NULL,
flag_type text NOT NULL,
is_persist boolean NOT NULL DEFAULT FALSE,
is_active boolean NOT NULL DEFAULT FALSE,