Skip to content

Commit

Permalink
use enum and i32 array instead in the models
Browse files Browse the repository at this point in the history
  • Loading branch information
yezizp2012 committed Sep 20, 2023
1 parent 1166621 commit 7e35fb5
Show file tree
Hide file tree
Showing 24 changed files with 369 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ header:
- "**/*.d.ts"
- "src/sqlparser/**/*.rs"
- "java/connector-node/risingwave-source-cdc/src/main/java/com/risingwave/connector/cdc/debezium/internal/*.java"
- "src/meta/src/model_v2/**/*.rs"
- "src/meta/src/model_v2/migration/**/*.rs"

comment: on-failure
18 changes: 16 additions & 2 deletions src/meta/src/model_v2/actor.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
// Copyright 2023 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use sea_orm::entity::prelude::*;

use crate::model_v2::I32Array;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "actor")]
pub struct Model {
Expand All @@ -11,7 +25,7 @@ pub struct Model {
pub status: Option<String>,
pub splits: Option<Json>,
pub parallel_unit_id: i32,
pub upstream_actor_ids: Option<Json>,
pub upstream_actor_ids: Option<I32Array>,
pub dispatchers: Option<Json>,
pub vnode_bitmap: Option<String>,
}
Expand Down
14 changes: 13 additions & 1 deletion src/meta/src/model_v2/cluster.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
// Copyright 2023 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use sea_orm::entity::prelude::*;

Expand Down
14 changes: 13 additions & 1 deletion src/meta/src/model_v2/connection.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
// Copyright 2023 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use sea_orm::entity::prelude::*;

Expand Down
14 changes: 13 additions & 1 deletion src/meta/src/model_v2/database.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
// Copyright 2023 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use sea_orm::entity::prelude::*;

Expand Down
14 changes: 13 additions & 1 deletion src/meta/src/model_v2/election_leader.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
// Copyright 2023 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use sea_orm::entity::prelude::*;

Expand Down
14 changes: 13 additions & 1 deletion src/meta/src/model_v2/election_member.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
// Copyright 2023 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use sea_orm::entity::prelude::*;

Expand Down
24 changes: 19 additions & 5 deletions src/meta/src/model_v2/fragment.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
// Copyright 2023 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use sea_orm::entity::prelude::*;

use crate::model_v2::I32Array;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "fragment")]
pub struct Model {
Expand All @@ -12,11 +26,11 @@ pub struct Model {
pub distribution_type: String,
pub stream_node: Json,
pub vnode_mapping: Option<Json>,
pub state_table_ids: Option<Json>,
pub upstream_fragment_id: Option<Json>,
pub state_table_ids: Option<I32Array>,
pub upstream_fragment_id: Option<I32Array>,
pub dispatcher_type: Option<String>,
pub dist_key_indices: Option<Json>,
pub output_indices: Option<Json>,
pub dist_key_indices: Option<I32Array>,
pub output_indices: Option<I32Array>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
Expand Down
14 changes: 13 additions & 1 deletion src/meta/src/model_v2/function.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
// Copyright 2023 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use sea_orm::entity::prelude::*;

Expand Down
18 changes: 16 additions & 2 deletions src/meta/src/model_v2/index.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
// Copyright 2023 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use sea_orm::entity::prelude::*;

use crate::model_v2::I32Array;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "index")]
pub struct Model {
Expand All @@ -13,7 +27,7 @@ pub struct Model {
pub index_table_id: i32,
pub primary_table_id: i32,
pub index_items: Option<Json>,
pub original_columns: Option<Json>,
pub original_columns: Option<I32Array>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
Expand Down
20 changes: 19 additions & 1 deletion src/meta/src/model_v2/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
// Copyright 2023 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use sea_orm::FromJsonQueryResult;
use serde::{Deserialize, Serialize};

pub mod prelude;

Expand All @@ -23,3 +38,6 @@ pub mod user_privilege;
pub mod view;
pub mod worker;
pub mod worker_property;

#[derive(Clone, Debug, PartialEq, FromJsonQueryResult, Eq, Serialize, Deserialize, Default)]
pub struct I32Array(pub Vec<i32>);
14 changes: 13 additions & 1 deletion src/meta/src/model_v2/object.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
// Copyright 2023 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use sea_orm::entity::prelude::*;

Expand Down
14 changes: 13 additions & 1 deletion src/meta/src/model_v2/object_dependency.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
// Copyright 2023 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use sea_orm::entity::prelude::*;

Expand Down
14 changes: 13 additions & 1 deletion src/meta/src/model_v2/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
// Copyright 2023 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

pub use super::actor::Entity as Actor;
pub use super::cluster::Entity as Cluster;
Expand Down
14 changes: 13 additions & 1 deletion src/meta/src/model_v2/schema.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
// Copyright 2023 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use sea_orm::entity::prelude::*;

Expand Down
33 changes: 29 additions & 4 deletions src/meta/src/model_v2/sink.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
// Copyright 2023 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use sea_orm::entity::prelude::*;

use crate::model_v2::I32Array;

#[derive(Clone, Debug, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
#[sea_orm(rs_type = "String", db_type = "String(None)")]
pub enum SinkType {
#[sea_orm(string_value = "APPEND_ONLY")]
AppendOnly,
#[sea_orm(string_value = "FORCE_APPEND_ONLY")]
ForceAppendOnly,
#[sea_orm(string_value = "UPSERT")]
Upsert,
}

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "sink")]
pub struct Model {
Expand All @@ -12,9 +37,9 @@ pub struct Model {
pub database_id: i32,
pub columns: Option<Json>,
pub pk_column_ids: Option<Json>,
pub distribution_key: Option<Json>,
pub downstream_pk: Option<Json>,
pub sink_type: String,
pub distribution_key: Option<I32Array>,
pub downstream_pk: Option<I32Array>,
pub sink_type: SinkType,
pub properties: Option<Json>,
pub definition: String,
pub connection_id: Option<i32>,
Expand Down
14 changes: 13 additions & 1 deletion src/meta/src/model_v2/source.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
// Copyright 2023 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use sea_orm::entity::prelude::*;

Expand Down
Loading

0 comments on commit 7e35fb5

Please sign in to comment.