Skip to content

Commit f1ea53c

Browse files
antiguruclaude
andcommitted
Use AclMode::CREATE_DATAFLOW from mz_repr in migration
Instead of defining a local constant, import and use the existing AclMode::CREATE_DATAFLOW constant from mz_repr. Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent cccf599 commit f1ea53c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/catalog/src/durable/upgrade/v80_to_v81.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
// the Business Source License, use of this software will be governed
88
// by the Apache License, Version 2.0.
99

10+
use mz_repr::adt::mz_acl_item::AclMode;
11+
1012
use crate::durable::upgrade::MigrationAction;
1113
use crate::durable::upgrade::objects_v80 as v80;
1214
use crate::durable::upgrade::objects_v81 as v81;
@@ -18,8 +20,7 @@ use crate::durable::upgrade::objects_v81 as v81;
1820
pub fn upgrade(
1921
snapshot: Vec<v80::StateUpdateKind>,
2022
) -> Vec<MigrationAction<v80::StateUpdateKind, v81::StateUpdateKind>> {
21-
// CREATE_DATAFLOW privilege bit (1 << 28)
22-
const CREATE_DATAFLOW_BIT: u64 = 1 << 28;
23+
let create_dataflow_bit = AclMode::CREATE_DATAFLOW.bits();
2324

2425
let mut migrations = Vec::new();
2526

@@ -28,7 +29,7 @@ pub fn upgrade(
2829
// Check if PUBLIC already has CREATEDATAFLOW
2930
let public_has_createdataflow = cluster.value.privileges.iter().any(|item| {
3031
matches!(item.grantee, v80::RoleId::Public)
31-
&& (item.acl_mode.bitflags & CREATE_DATAFLOW_BIT) != 0
32+
&& (item.acl_mode.bitflags & create_dataflow_bit) != 0
3233
});
3334

3435
if !public_has_createdataflow {
@@ -41,7 +42,7 @@ pub fn upgrade(
4142
grantee: v80::RoleId::Public,
4243
grantor: v80::RoleId::System(1),
4344
acl_mode: v80::AclMode {
44-
bitflags: CREATE_DATAFLOW_BIT,
45+
bitflags: create_dataflow_bit,
4546
},
4647
});
4748

0 commit comments

Comments
 (0)