Skip to content

Commit

Permalink
add name to data model config
Browse files Browse the repository at this point in the history
  • Loading branch information
callicles committed Feb 23, 2025
1 parent 39730b5 commit deff532
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions apps/framework-cli/src/framework/data_model/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ pub struct StorageConfig {
pub order_by_fields: Vec<String>,
#[serde(default)]
pub deduplicate: bool,
#[serde(default)]
pub name: Option<String>,
}

impl Default for StorageConfig {
Expand All @@ -48,6 +50,7 @@ impl Default for StorageConfig {
enabled: true,
order_by_fields: vec![],
deduplicate: false,
name: None,
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion apps/framework-cli/src/framework/data_model/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ impl DataModel {
// multiple sources. The Aim will be to have DB Blocks provision some tables as well.
pub fn to_table(&self) -> Table {
Table {
name: format!("{}_{}", self.name, self.version.as_suffix()),
name: self
.config
.storage
.name
.clone()
.unwrap_or_else(|| format!("{}_{}", self.name, self.version.as_suffix())),
columns: self.columns.clone(),
order_by: self.config.storage.order_by_fields.clone(),
deduplicate: self.config.storage.deduplicate,
Expand Down
1 change: 1 addition & 0 deletions packages/ts-moose-lib/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export type DataModelConfig<T> = Partial<{
enabled?: boolean;
order_by_fields?: (keyof T)[];
deduplicate?: boolean;
name?: string;
};
parallelism?: number;
}>;
Expand Down

0 comments on commit deff532

Please sign in to comment.