Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

policy: remove approval policy from environment table.

spinningbot5d5b63ee610f
diff --git a/store/environment.go b/store/environment.go
index eb5b80aa11..a82838bb2c 100644
--- a/store/environment.go
+++ b/store/environment.go
@@ -166,17 +166,15 @@ func (s *EnvironmentService) createEnvironment(ctx context.Context, tx *Tx, crea
creator_id,
updater_id,
name,
- `+"`order`"+`,
- approval_policy
+ `+"`order`"+`
)
- VALUES (?, ?, ?, ?, ?)
- RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, name, `+"`order`, approval_policy"+`
+ VALUES (?, ?, ?, ?)
+ RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, name, `+"`order`"+`
`,
create.CreatorId,
create.CreatorId,
create.Name,
order+1,
- create.ApprovalPolicy,
)
if err2 != nil {
@@ -195,7 +193,6 @@ func (s *EnvironmentService) createEnvironment(ctx context.Context, tx *Tx, crea
&environment.UpdatedTs,
&environment.Name,
&environment.Order,
- &environment.ApprovalPolicy,
); err != nil {
return nil, FormatError(err)
}
@@ -222,8 +219,7 @@ func (s *EnvironmentService) findEnvironmentList(ctx context.Context, tx *Tx, fi
updater_id,
updated_ts,
name,
- `+"`order`"+`,
- approval_policy
+ `+"`order`"+`
FROM environment
WHERE `+strings.Join(where, " AND "),
args...,
@@ -246,7 +242,6 @@ func (s *EnvironmentService) findEnvironmentList(ctx context.Context, tx *Tx, fi
&environment.UpdatedTs,
&environment.Name,
&environment.Order,
- &environment.ApprovalPolicy,
); err != nil {
return nil, FormatError(err)
}
@@ -273,9 +268,6 @@ func (s *EnvironmentService) patchEnvironment(ctx context.Context, tx *Tx, patch
if v := patch.Order; v != nil {
set, args = append(set, "`order` = ?"), append(args, *v)
}
- if v := patch.ApprovalPolicy; v != nil {
- set, args = append(set, "approval_policy = ?"), append(args, *v)
- }
args = append(args, patch.ID)
@@ -284,7 +276,7 @@ func (s *EnvironmentService) patchEnvironment(ctx context.Context, tx *Tx, patch
UPDATE environment
SET `+strings.Join(set, ", ")+`
WHERE id = ?
- RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, name, `+"`order`, approval_policy"+`
+ RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, name, `+"`order`"+`
`,
args...,
)
@@ -304,7 +296,6 @@ func (s *EnvironmentService) patchEnvironment(ctx context.Context, tx *Tx, patch
&environment.UpdatedTs,
&environment.Name,
&environment.Order,
- &environment.ApprovalPolicy,
); err != nil {
return nil, FormatError(err)
}
diff --git a/store/migration/10001__init_schema.sql b/store/migration/10001__init_schema.sql
index a35e403656..fbc1a6ce2d 100644
--- a/store/migration/10001__init_schema.sql
+++ b/store/migration/10001__init_schema.sql
@@ -138,13 +138,7 @@ CREATE TABLE environment (
updater_id INTEGER NOT NULL REFERENCES principal (id),
updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),
name TEXT NOT NULL UNIQUE,
- `order` INTEGER NOT NULL,
- approval_policy TEXT NOT NULL CHECK (
- approval_policy IN (
- 'MANUAL_APPROVAL_NEVER',
- 'MANUAL_APPROVAL_ALWAYS'
- )
- )
+ `order` INTEGER NOT NULL
);
INSERT INTO
diff --git a/store/seed/test/10050__environment.sql b/store/seed/test/10050__environment.sql
index e661ebacb6..871edff99f 100644
--- a/store/seed/test/10050__environment.sql
+++ b/store/seed/test/10050__environment.sql
@@ -4,8 +4,7 @@ INSERT INTO
creator_id,
updater_id,
name,
- `order`,
- approval_policy
+ `order`
)
VALUES
(
@@ -13,8 +12,7 @@ VALUES
101,
101,
'Dev',
- 0,
- 'MANUAL_APPROVAL_NEVER'
+ 0
);
INSERT INTO
@@ -23,8 +21,7 @@ INSERT INTO
creator_id,
updater_id,
name,
- `order`,
- approval_policy
+ `order`
)
VALUES
(
@@ -32,8 +29,7 @@ VALUES
101,
101,
'Integration',
- 1,
- 'MANUAL_APPROVAL_NEVER'
+ 1
);
INSERT INTO
@@ -42,8 +38,7 @@ INSERT INTO
creator_id,
updater_id,
name,
- `order`,
- approval_policy
+ `order`
)
VALUES
(
@@ -51,8 +46,7 @@ VALUES
101,
101,
'Staging',
- 2,
- 'MANUAL_APPROVAL_ALWAYS'
+ 2
);
INSERT INTO
@@ -61,8 +55,7 @@ INSERT INTO
creator_id,
updater_id,
name,
- `order`,
- approval_policy
+ `order`
)
VALUES
(
@@ -70,8 +63,7 @@ VALUES
101,
101,
'Prod',
- 3,
- 'MANUAL_APPROVAL_ALWAYS'
+ 3
);
INSERT INTO
@@ -81,8 +73,7 @@ INSERT INTO
creator_id,
updater_id,
name,
- `order`,
- approval_policy
+ `order`
)
VALUES
(
@@ -91,6 +82,5 @@ VALUES
101,
101,
'Archived Env 1',
- 4,
- 'MANUAL_APPROVAL_NEVER'
+ 4
);