use sea_query::Iden;
#[derive(Iden)]
pub enum Workflows {
Table,
WorkflowId,
Version,
Name,
Description,
Priority,
Status,
RolloutPercentage,
ConditionJson,
TasksJson,
TagsJson,
LoopJson,
ContinueOnError,
CreatedAt,
UpdatedAt,
}
#[derive(Iden)]
pub enum Channels {
Table,
ChannelId,
Version,
Name,
Description,
ChannelType,
Protocol,
MethodsJson,
RoutePattern,
Topic,
ConsumerGroup,
TransportConfigJson,
WorkflowId,
ConfigJson,
Status,
Priority,
TagsJson,
CreatedAt,
UpdatedAt,
}
#[derive(Iden)]
pub enum Connectors {
Table,
Id,
Name,
ConnectorType,
ConfigJson,
Enabled,
TagsJson,
CreatedAt,
UpdatedAt,
}
#[derive(Iden)]
pub enum ConnectorOauthState {
Table,
ConnectorName,
Fingerprint,
StateJson,
UpdatedAt,
}
#[derive(Iden)]
pub enum Traces {
Table,
Id,
Channel,
ChannelId,
Mode,
Status,
InputJson,
ResultJson,
ErrorMessage,
DurationMs,
StartedAt,
CompletedAt,
CreatedAt,
UpdatedAt,
TaskTraceJson,
AccessTokenHash,
}
#[derive(Iden)]
pub enum TraceDlq {
Table,
Id,
TraceId,
Channel,
PayloadJson,
MetadataJson,
ErrorMessage,
RetryCount,
MaxRetries,
NextRetryAt,
CreatedAt,
UpdatedAt,
ClaimedBy,
ClaimedUntil,
}
#[derive(Iden, Clone, Copy)]
pub enum CronScheduleState {
Table,
ChannelId,
ChannelVersion,
ConfigHash,
NextFireAt,
PausedAt,
UpdatedAt,
}
#[derive(Iden, Clone, Copy)]
pub enum CronOccurrences {
Table,
Id,
ChannelId,
ChannelName,
ChannelVersion,
ExecutingVersion,
WorkflowId,
Trigger,
ScheduledFor,
Status,
Attempt,
ClaimedBy,
ClaimedUntil,
SingletonKey,
FencingToken,
TraceId,
ErrorMessage,
StartedAt,
CompletedAt,
CreatedAt,
UpdatedAt,
}
#[derive(Iden, Clone, Copy)]
pub enum CronSingletons {
Table,
SingletonKey,
OccurrenceId,
Holder,
FencingToken,
LeaseUntil,
UpdatedAt,
}
#[derive(Iden, Clone, Copy)]
pub enum ConfigEpoch {
Table,
Id,
Epoch,
EpochScope,
EpochScopeAt,
BreakerEpoch,
BreakerKey,
UpdatedAt,
}
#[derive(Iden)]
pub enum JobLeases {
Table,
JobName,
Holder,
ExpiresAt,
}
#[derive(Iden)]
pub enum Packages {
Table,
Name,
Version,
ContentHash,
State,
Principal,
CreatedAt,
UpdatedAt,
}
#[derive(Iden)]
pub enum AuditLogs {
Table,
Id,
Principal,
Action,
ResourceType,
ResourceId,
Details,
CreatedAt,
}
#[derive(Iden)]
pub enum CurrentWorkflows {
Table,
}
#[derive(Iden)]
pub enum Plugins {
Table,
PluginId,
Version,
Status,
Digest,
ManifestJson,
TagsJson,
Signature,
CreatedAt,
UpdatedAt,
}
#[derive(Iden)]
pub enum PluginArtifacts {
Table,
Digest,
Bytes,
Size,
CreatedAt,
}
#[derive(Iden)]
pub enum Models {
Table,
ModelId,
Version,
Status,
Digest,
ManifestJson,
ArtifactJson,
AdmissionJson,
StatsJson,
TagsJson,
Signature,
CreatedAt,
UpdatedAt,
}
#[derive(Iden)]
pub enum CurrentChannels {
Table,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn column_identifiers_are_pinned() {
let workflows: Vec<String> = [
Iden::to_string(&Workflows::WorkflowId),
Iden::to_string(&Workflows::Version),
Iden::to_string(&Workflows::Name),
Iden::to_string(&Workflows::Description),
Iden::to_string(&Workflows::Priority),
Iden::to_string(&Workflows::Status),
Iden::to_string(&Workflows::RolloutPercentage),
Iden::to_string(&Workflows::ConditionJson),
Iden::to_string(&Workflows::TasksJson),
Iden::to_string(&Workflows::TagsJson),
Iden::to_string(&Workflows::LoopJson),
Iden::to_string(&Workflows::ContinueOnError),
Iden::to_string(&Workflows::CreatedAt),
Iden::to_string(&Workflows::UpdatedAt),
]
.to_vec();
assert_eq!(
workflows,
[
"workflow_id",
"version",
"name",
"description",
"priority",
"status",
"rollout_percentage",
"condition_json",
"tasks_json",
"tags_json",
"loop_json",
"continue_on_error",
"created_at",
"updated_at",
]
);
let channels: Vec<String> = [
Iden::to_string(&Channels::ChannelId),
Iden::to_string(&Channels::Version),
Iden::to_string(&Channels::Name),
Iden::to_string(&Channels::Description),
Iden::to_string(&Channels::ChannelType),
Iden::to_string(&Channels::Protocol),
Iden::to_string(&Channels::MethodsJson),
Iden::to_string(&Channels::RoutePattern),
Iden::to_string(&Channels::Topic),
Iden::to_string(&Channels::ConsumerGroup),
Iden::to_string(&Channels::TransportConfigJson),
Iden::to_string(&Channels::WorkflowId),
Iden::to_string(&Channels::ConfigJson),
Iden::to_string(&Channels::Status),
Iden::to_string(&Channels::Priority),
Iden::to_string(&Channels::TagsJson),
Iden::to_string(&Channels::CreatedAt),
Iden::to_string(&Channels::UpdatedAt),
]
.to_vec();
let occurrences = [
Iden::to_string(&CronOccurrences::Id),
Iden::to_string(&CronOccurrences::ChannelId),
Iden::to_string(&CronOccurrences::ChannelName),
Iden::to_string(&CronOccurrences::ChannelVersion),
Iden::to_string(&CronOccurrences::ExecutingVersion),
Iden::to_string(&CronOccurrences::WorkflowId),
Iden::to_string(&CronOccurrences::Trigger),
Iden::to_string(&CronOccurrences::ScheduledFor),
Iden::to_string(&CronOccurrences::Status),
Iden::to_string(&CronOccurrences::Attempt),
Iden::to_string(&CronOccurrences::ClaimedBy),
Iden::to_string(&CronOccurrences::ClaimedUntil),
Iden::to_string(&CronOccurrences::SingletonKey),
Iden::to_string(&CronOccurrences::FencingToken),
Iden::to_string(&CronOccurrences::TraceId),
Iden::to_string(&CronOccurrences::ErrorMessage),
Iden::to_string(&CronOccurrences::StartedAt),
Iden::to_string(&CronOccurrences::CompletedAt),
Iden::to_string(&CronOccurrences::CreatedAt),
Iden::to_string(&CronOccurrences::UpdatedAt),
]
.to_vec();
assert_eq!(
occurrences,
[
"id",
"channel_id",
"channel_name",
"channel_version",
"executing_version",
"workflow_id",
"trigger",
"scheduled_for",
"status",
"attempt",
"claimed_by",
"claimed_until",
"singleton_key",
"fencing_token",
"trace_id",
"error_message",
"started_at",
"completed_at",
"created_at",
"updated_at",
]
);
assert_eq!(
[
Iden::to_string(&CronSingletons::SingletonKey),
Iden::to_string(&CronSingletons::OccurrenceId),
Iden::to_string(&CronSingletons::Holder),
Iden::to_string(&CronSingletons::FencingToken),
Iden::to_string(&CronSingletons::LeaseUntil),
]
.to_vec(),
[
"singleton_key",
"occurrence_id",
"holder",
"fencing_token",
"lease_until",
]
);
assert_eq!(
[
Iden::to_string(&CronScheduleState::ChannelId),
Iden::to_string(&CronScheduleState::ChannelVersion),
Iden::to_string(&CronScheduleState::ConfigHash),
Iden::to_string(&CronScheduleState::NextFireAt),
Iden::to_string(&CronScheduleState::PausedAt),
]
.to_vec(),
[
"channel_id",
"channel_version",
"config_hash",
"next_fire_at",
"paused_at",
]
);
assert_eq!(
[
Iden::to_string(&Models::ModelId),
Iden::to_string(&Models::Version),
Iden::to_string(&Models::Status),
Iden::to_string(&Models::Digest),
Iden::to_string(&Models::ManifestJson),
Iden::to_string(&Models::ArtifactJson),
Iden::to_string(&Models::AdmissionJson),
Iden::to_string(&Models::StatsJson),
Iden::to_string(&Models::TagsJson),
Iden::to_string(&Models::Signature),
Iden::to_string(&Models::CreatedAt),
Iden::to_string(&Models::UpdatedAt),
]
.to_vec(),
[
"model_id",
"version",
"status",
"digest",
"manifest_json",
"artifact_json",
"admission_json",
"stats_json",
"tags_json",
"signature",
"created_at",
"updated_at",
]
);
assert_eq!(
channels,
[
"channel_id",
"version",
"name",
"description",
"channel_type",
"protocol",
"methods_json",
"route_pattern",
"topic",
"consumer_group",
"transport_config_json",
"workflow_id",
"config_json",
"status",
"priority",
"tags_json",
"created_at",
"updated_at",
]
);
}
}