Drops the old event tables.
NOTE: consider not applying this patch until confident that
the migration has proceeded smoothly. Dougal can operate just
fine without it.
Resolve "Make event log entries for start and end of line upon import of final sequence, if the entries do not already exist"
Closes#57
See merge request wgp/dougal/software!11
These files contain the sequence of SQL commands needed to bring
a database or project schema up to date with the latest template
database or project schema.
These files must be applied manually. Check the comments at the top of
the file for instructions.
Adds:
* label_in_sequence (_sequence integer, _label text):
Returns events containing the specified label.
* handle_final_line_events (_seq integer, _label text, _column text):
- If _label does not exist in the events for sequence _seq:
it adds a new _label label at the shotpoint obtained from
final_lines_summary[_column].
- If _label does exist (and hasn't been auto-added by this function
in a previous run), it will add information about it to the final
line's metadata.
* final_line_post_import (_seq integer):
Calls handle_final_line_events() on the given sequence to check
for FSP, FGSP, LGSP and LSP labels.
* events_seq_labels_single ():
Trigger function to ensure that labels that have the attribute
`model.multiple` set to `false` occur at most only once per
sequence. If a new instance is added to a sequence, the previous
instance is deleted.
* Trigger on events_seq_labels that calls events_seq_labels_single().
* Trigger on events_timed_labels that calls events_seq_labels_single().
When final shots are inserted, updated or
deleted, the corresponding QC info (which
is always held in raw_shots.meta->'qc')
is deleted.
If applicable, it will be recreated on the
next QC run.
When inserting or updating a timed event, a trigger
searches the real time events table for a position
close (within one minute) of the event time and
adds it to the event's metadata.
When the database is recreated, the sequences
used in the events_timed and events_seq tables
will be at their initial values, which will
almost certainly conflict with existing data
when it is imported via COPY.
With this commit, we set the current value for
those sequences to something usable.
Fixes#33.