Skip to content

Commit

Permalink
fix view
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Nov 11, 2024
1 parent 3b2b2c3 commit c759981
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions datamodel/app/vw_validation.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ CREATE OR REPLACE VIEW signalo_app.vw_validation AS
greatest(su._last_modification_date, a._last_modification_date, f._last_modification_date, si._last_modification_date) AS last_modification_date,
su.needs_validation or a.needs_validation or f.needs_validation or si.needs_validation AS needs_validation
FROM signalo_db.support su
LEFT JOIN (SELECT id, fk_support, needs_validation, MAX(_last_modification_date) OVER (PARTITION BY fk_support) AS _last_modification_date FROM signalo_db.azimut ) a ON a.fk_support = su.id
LEFT JOIN (SELECT id, fk_azimut, needs_validation, MAX(_last_modification_date) OVER (PARTITION BY fk_azimut) AS _last_modification_date FROM signalo_db.frame) f ON f.fk_azimut = a.id
LEFT JOIN (SELECT id, fk_frame, needs_validation, MAX(_last_modification_date) OVER (PARTITION BY fk_frame) AS _last_modification_date FROM signalo_db.sign) si ON si.fk_frame = f.id;
LEFT JOIN (SELECT id, fk_support, needs_validation, MAX(_last_modification_date) OVER (PARTITION BY fk_support ORDER BY needs_validation DESC NULLS LAST) AS _last_modification_date FROM signalo_db.azimut ) a ON a.fk_support = su.id
LEFT JOIN (SELECT id, fk_azimut, needs_validation, MAX(_last_modification_date) OVER (PARTITION BY fk_azimut ORDER BY needs_validation DESC NULLS LAST) AS _last_modification_date FROM signalo_db.frame) f ON f.fk_azimut = a.id
LEFT JOIN (SELECT id, fk_frame, needs_validation, MAX(_last_modification_date) OVER (PARTITION BY fk_frame ORDER BY needs_validation DESC NULLS LAST) AS _last_modification_date FROM signalo_db.sign) si ON si.fk_frame = f.id;

CREATE FUNCTION signalo_app.ft_validation_update() RETURNS trigger
LANGUAGE plpgsql
Expand Down
8 changes: 4 additions & 4 deletions datamodel/changelogs/0102/0101_02_control.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ ALTER TABLE signalo_db.azimut DROP COLUMN _edited;
ALTER TABLE signalo_db.frame DROP COLUMN _edited;
ALTER TABLE signalo_db.sign DROP COLUMN _edited;

ALTER TABLE signalo_db.support ADD COLUMN needs_validation boolean default false;
ALTER TABLE signalo_db.azimut ADD COLUMN needs_validation boolean default false;
ALTER TABLE signalo_db.frame ADD COLUMN needs_validation boolean default false;
ALTER TABLE signalo_db.sign ADD COLUMN needs_validation boolean default false;
ALTER TABLE signalo_db.support ADD COLUMN needs_validation boolean not null default false;
ALTER TABLE signalo_db.azimut ADD COLUMN needs_validation boolean not null default false;
ALTER TABLE signalo_db.frame ADD COLUMN needs_validation boolean not null default false;
ALTER TABLE signalo_db.sign ADD COLUMN needs_validation boolean not null default false;

ALTER TABLE signalo_db.support ADD COLUMN _last_modification_platform text default null;
ALTER TABLE signalo_db.azimut ADD COLUMN _last_modification_platform text default null;
Expand Down

0 comments on commit c759981

Please sign in to comment.