Skip to content

Commit d6b1a93

Browse files
committed
drop: removed persistance of flow signature
1 parent e5d1bde commit d6b1a93

16 files changed

Lines changed: 86 additions & 38 deletions

File tree

app/graphql/types/flow_type.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ class FlowType < Types::BaseObject
2323
null: false,
2424
method: :flow_settings,
2525
description: 'The settings of the flow'
26-
field :signature, String,
27-
null: false,
28-
description: 'The signature of the flow'
2926
field :starting_node_id, Types::GlobalIdType[::NodeFunction],
3027
null: true,
3128
description: 'The ID of the starting node of the flow'

app/graphql/types/input/flow_input_type.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ class FlowInputType < Types::BaseInputObject
1717

1818
argument :type, Types::GlobalIdType[::FlowType], required: true,
1919
description: 'The identifier of the flow type'
20-
21-
argument :signature, String, required: false, description: 'The signature of the flow'
2220
end
2321
end
2422
end

app/models/flow.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ class Flow < ApplicationRecord
4141
allow_blank: false,
4242
uniqueness: { case_sensitive: false, scope: :project_id }
4343

44-
validates :signature, presence: true, length: { maximum: 500 }
45-
4644
scope :enabled, -> { where(disabled_reason: nil) }
4745
scope :disabled, -> { where.not(disabled_reason: nil) }
4846

@@ -61,7 +59,7 @@ def to_grpc
6159
settings: flow_settings.map(&:to_grpc),
6260
starting_node_id: starting_node&.id,
6361
node_functions: node_functions.map(&:to_grpc),
64-
signature: signature
62+
signature: flow_type.signature
6563
)
6664
end
6765

app/services/namespaces/projects/flows/create_service.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ def execute
3838
flow = Flow.new(
3939
project: namespace_project,
4040
name: flow_input.name,
41-
flow_type: flow_type,
42-
signature: flow_input.signature.presence || flow_type.signature
41+
flow_type: flow_type
4342
)
4443

4544
unless flow.save

app/services/namespaces/projects/flows/update_service.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ def update_flow(t)
4848

4949
def update_flow_attributes
5050
flow.name = flow_input.name
51-
flow.signature = flow_input.signature if flow_input.signature.present?
5251
flow.validation_status = :unvalidated
5352
end
5453

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
class RemoveSignatureFromFlows < Code0::ZeroTrack::Database::Migration[1.0]
4+
def change
5+
remove_column :flows, :signature, :text, if_exists: true
6+
end
7+
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
68074a1fb7f8bdf3087c3b6823eaef35175c480f05d4bc73c190ef7b2811cf68

db/structure.sql

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1+
CREATE FUNCTION delete_data_types_translations() RETURNS trigger
2+
LANGUAGE plpgsql
3+
AS $$ BEGIN DELETE FROM "translations" WHERE "owner_type" = 'DataType' AND "owner_id" IN (SELECT id FROM old_rows); RETURN NULL; END; $$;
4+
5+
CREATE FUNCTION delete_flow_type_settings_translations() RETURNS trigger
6+
LANGUAGE plpgsql
7+
AS $$ BEGIN DELETE FROM "translations" WHERE "owner_type" = 'FlowTypeSetting' AND "owner_id" IN (SELECT id FROM old_rows); RETURN NULL; END; $$;
8+
9+
CREATE FUNCTION delete_flow_types_translations() RETURNS trigger
10+
LANGUAGE plpgsql
11+
AS $$ BEGIN DELETE FROM "translations" WHERE "owner_type" = 'FlowType' AND "owner_id" IN (SELECT id FROM old_rows); RETURN NULL; END; $$;
12+
13+
CREATE FUNCTION delete_function_definitions_translations() RETURNS trigger
14+
LANGUAGE plpgsql
15+
AS $$ BEGIN DELETE FROM "translations" WHERE "owner_type" = 'FunctionDefinition' AND "owner_id" IN (SELECT id FROM old_rows); RETURN NULL; END; $$;
16+
17+
CREATE FUNCTION delete_module_configuration_definitions_translations() RETURNS trigger
18+
LANGUAGE plpgsql
19+
AS $$ BEGIN DELETE FROM "translations" WHERE "owner_type" = 'ModuleConfigurationDefinition' AND "owner_id" IN (SELECT id FROM old_rows); RETURN NULL; END; $$;
20+
21+
CREATE FUNCTION delete_parameter_definitions_translations() RETURNS trigger
22+
LANGUAGE plpgsql
23+
AS $$ BEGIN DELETE FROM "translations" WHERE "owner_type" = 'ParameterDefinition' AND "owner_id" IN (SELECT id FROM old_rows); RETURN NULL; END; $$;
24+
25+
CREATE FUNCTION delete_runtime_flow_type_settings_translations() RETURNS trigger
26+
LANGUAGE plpgsql
27+
AS $$ BEGIN DELETE FROM "translations" WHERE "owner_type" = 'RuntimeFlowTypeSetting' AND "owner_id" IN (SELECT id FROM old_rows); RETURN NULL; END; $$;
28+
29+
CREATE FUNCTION delete_runtime_flow_types_translations() RETURNS trigger
30+
LANGUAGE plpgsql
31+
AS $$ BEGIN DELETE FROM "translations" WHERE "owner_type" = 'RuntimeFlowType' AND "owner_id" IN (SELECT id FROM old_rows); RETURN NULL; END; $$;
32+
33+
CREATE FUNCTION delete_runtime_function_definitions_translations() RETURNS trigger
34+
LANGUAGE plpgsql
35+
AS $$ BEGIN DELETE FROM "translations" WHERE "owner_type" = 'RuntimeFunctionDefinition' AND "owner_id" IN (SELECT id FROM old_rows); RETURN NULL; END; $$;
36+
37+
CREATE FUNCTION delete_runtime_modules_translations() RETURNS trigger
38+
LANGUAGE plpgsql
39+
AS $$ BEGIN DELETE FROM "translations" WHERE "owner_type" = 'RuntimeModule' AND "owner_id" IN (SELECT id FROM old_rows); RETURN NULL; END; $$;
40+
41+
CREATE FUNCTION delete_runtime_parameter_definitions_translations() RETURNS trigger
42+
LANGUAGE plpgsql
43+
AS $$ BEGIN DELETE FROM "translations" WHERE "owner_type" = 'RuntimeParameterDefinition' AND "owner_id" IN (SELECT id FROM old_rows); RETURN NULL; END; $$;
44+
145
CREATE TABLE active_storage_attachments (
246
id bigint NOT NULL,
347
name character varying NOT NULL,
@@ -361,9 +405,7 @@ CREATE TABLE flows (
361405
created_at timestamp with time zone NOT NULL,
362406
updated_at timestamp with time zone NOT NULL,
363407
validation_status integer DEFAULT 0 NOT NULL,
364-
disabled_reason integer,
365-
signature text DEFAULT ''::text NOT NULL,
366-
CONSTRAINT check_8c731c24ec CHECK ((char_length(signature) <= 500))
408+
disabled_reason integer
367409
);
368410

369411
CREATE SEQUENCE flows_id_seq
@@ -1698,6 +1740,28 @@ CREATE UNIQUE INDEX "index_users_on_LOWER_username" ON users USING btree (lower(
16981740

16991741
CREATE UNIQUE INDEX index_users_on_totp_secret ON users USING btree (totp_secret) WHERE (totp_secret IS NOT NULL);
17001742

1743+
CREATE TRIGGER trigger_delete_data_types_translations AFTER DELETE ON data_types REFERENCING OLD TABLE AS old_rows FOR EACH STATEMENT EXECUTE FUNCTION delete_data_types_translations();
1744+
1745+
CREATE TRIGGER trigger_delete_flow_type_settings_translations AFTER DELETE ON flow_type_settings REFERENCING OLD TABLE AS old_rows FOR EACH STATEMENT EXECUTE FUNCTION delete_flow_type_settings_translations();
1746+
1747+
CREATE TRIGGER trigger_delete_flow_types_translations AFTER DELETE ON flow_types REFERENCING OLD TABLE AS old_rows FOR EACH STATEMENT EXECUTE FUNCTION delete_flow_types_translations();
1748+
1749+
CREATE TRIGGER trigger_delete_function_definitions_translations AFTER DELETE ON function_definitions REFERENCING OLD TABLE AS old_rows FOR EACH STATEMENT EXECUTE FUNCTION delete_function_definitions_translations();
1750+
1751+
CREATE TRIGGER trigger_delete_module_configuration_definitions_translations AFTER DELETE ON module_configuration_definitions REFERENCING OLD TABLE AS old_rows FOR EACH STATEMENT EXECUTE FUNCTION delete_module_configuration_definitions_translations();
1752+
1753+
CREATE TRIGGER trigger_delete_parameter_definitions_translations AFTER DELETE ON parameter_definitions REFERENCING OLD TABLE AS old_rows FOR EACH STATEMENT EXECUTE FUNCTION delete_parameter_definitions_translations();
1754+
1755+
CREATE TRIGGER trigger_delete_runtime_flow_type_settings_translations AFTER DELETE ON runtime_flow_type_settings REFERENCING OLD TABLE AS old_rows FOR EACH STATEMENT EXECUTE FUNCTION delete_runtime_flow_type_settings_translations();
1756+
1757+
CREATE TRIGGER trigger_delete_runtime_flow_types_translations AFTER DELETE ON runtime_flow_types REFERENCING OLD TABLE AS old_rows FOR EACH STATEMENT EXECUTE FUNCTION delete_runtime_flow_types_translations();
1758+
1759+
CREATE TRIGGER trigger_delete_runtime_function_definitions_translations AFTER DELETE ON runtime_function_definitions REFERENCING OLD TABLE AS old_rows FOR EACH STATEMENT EXECUTE FUNCTION delete_runtime_function_definitions_translations();
1760+
1761+
CREATE TRIGGER trigger_delete_runtime_modules_translations AFTER DELETE ON runtime_modules REFERENCING OLD TABLE AS old_rows FOR EACH STATEMENT EXECUTE FUNCTION delete_runtime_modules_translations();
1762+
1763+
CREATE TRIGGER trigger_delete_runtime_parameter_definitions_translations AFTER DELETE ON runtime_parameter_definitions REFERENCING OLD TABLE AS old_rows FOR EACH STATEMENT EXECUTE FUNCTION delete_runtime_parameter_definitions_translations();
1764+
17011765
ALTER TABLE ONLY node_parameters
17021766
ADD CONSTRAINT fk_rails_0d79310cfa FOREIGN KEY (node_function_id) REFERENCES node_functions(id) ON DELETE CASCADE;
17031767

docs/graphql/input_object/flowinput.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ Input type for creating or updating a flow
1111
| `name` | [`String!`](../scalar/string.md) | The name of the flow |
1212
| `nodes` | [`[NodeFunctionInput!]!`](../input_object/nodefunctioninput.md) | The node functions of the flow |
1313
| `settings` | [`[FlowSettingInput!]`](../input_object/flowsettinginput.md) | The settings of the flow |
14-
| `signature` | [`String`](../scalar/string.md) | The signature of the flow |
1514
| `startingNodeId` | [`NodeFunctionID`](../scalar/nodefunctionid.md) | The starting node of the flow |
1615
| `type` | [`FlowTypeID!`](../scalar/flowtypeid.md) | The identifier of the flow type |

docs/graphql/object/flow.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ Represents a flow
1717
| `nodes` | [`NodeFunctionConnection!`](../object/nodefunctionconnection.md) | Nodes of the flow |
1818
| `project` | [`NamespaceProject!`](../object/namespaceproject.md) | The project the flow belongs to |
1919
| `settings` | [`FlowSettingConnection!`](../object/flowsettingconnection.md) | The settings of the flow |
20-
| `signature` | [`String!`](../scalar/string.md) | The signature of the flow |
2120
| `startingNodeId` | [`NodeFunctionID`](../scalar/nodefunctionid.md) | The ID of the starting node of the flow |
2221
| `type` | [`FlowType!`](../object/flowtype.md) | The flow type of the flow |
2322
| `updatedAt` | [`Time!`](../scalar/time.md) | Time when this Flow was last updated |

0 commit comments

Comments
 (0)