1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use crate::common::generator_context::GeneratorContext;
use schema_model::model::table::Table;
pub trait TriggerGenerator {
fn output_triggers(&self);
/// Regenerates the full (idempotent) trigger set for a single table - used by the
/// migration generator when only that table's custom triggers changed, so it doesn't
/// have to re-derive the combined relation/aggregation/custom-trigger logic that
/// `output_triggers` already knows how to produce. No-op by default (SQLite has no
/// trigger support here, matching `output_triggers`).
fn output_triggers_for_table(&self, table: &Table);
}
pub struct DefaultTriggerGenerator {
context: GeneratorContext,
}
impl DefaultTriggerGenerator {
pub fn new(context: GeneratorContext) -> Self {
Self {
context,
}
}
pub fn context(&self) -> &GeneratorContext {
&self.context
}
}
impl TriggerGenerator for DefaultTriggerGenerator {
fn output_triggers(&self) {
}
fn output_triggers_for_table(&self, _table: &Table) {
}
}