diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5442e8ef..eb1ce29f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,8 @@ Changelog This document records the main changes to the ``sdssdb`` code. +* Add table and models for ``lvmopsdb.ln2_fill``. + * :release:`0.13.0 <2024-09-03>` * :feature:`264` Add metadata for the ``sdss_id_to_catalog`` table. * :feature:`266` Support PEP 621. diff --git a/python/sdssdb/peewee/lvmdb/lvmopsdb.py b/python/sdssdb/peewee/lvmdb/lvmopsdb.py index 745f66b6..466390b2 100644 --- a/python/sdssdb/peewee/lvmdb/lvmopsdb.py +++ b/python/sdssdb/peewee/lvmdb/lvmopsdb.py @@ -17,8 +17,9 @@ FloatField, ForeignKeyField, IntegerField, - TextField + TextField, ) +from playhouse.postgres_ext import JSONField from .. import BaseModel from . import database # noqa @@ -324,3 +325,26 @@ class GuiderCoAdd(LVMOpsBase): class Meta: table_name = 'guider_coadd' + + +class LN2Fill(LVMOpsBase): + pk = AutoField() + action = TextField() + start_time = DateTimeField() + end_time = DateTimeField() + purge_start = DateTimeField() + purge_complete = DateTimeField() + fill_start = DateTimeField() + fill_complete = DateTimeField() + fail_time = DateTimeField() + abort_time = DateTimeField() + failed = BooleanField() + aborted = BooleanField() + error = TextField() + log_file = TextField() + json_file = TextField() + configuration = JSONField() + log_data = JSONField() + + class Meta: + table_name = 'ln2_fill' diff --git a/schema/lvmdb/lvmopsdb.sql b/schema/lvmdb/lvmopsdb.sql index f644b0d8..e575e402 100644 --- a/schema/lvmdb/lvmopsdb.sql +++ b/schema/lvmdb/lvmopsdb.sql @@ -214,6 +214,25 @@ CREATE TABLE lvmopsdb.guider_coadd ( exposure_no INTEGER ); +CREATE TABLE lvmopsdb.ln2_fill ( + pk SERIAL PRIMARY KEY NOT NULL, + action TEXT, + start_time TIMESTAMPTZ, + end_time TIMESTAMPTZ, + purge_start TIMESTAMPTZ, + purge_complete TIMESTAMPTZ, + fill_start TIMESTAMPTZ, + fill_complete TIMESTAMPTZ, + fail_time TIMESTAMPTZ, + abort_time TIMESTAMPTZ, + failed BOOLEAN, + aborted BOOLEAN, + error TEXT, + log_file TEXT, + json_file TEXT, + configuration JSONB, + log_data JSONB +); -- constraints @@ -349,6 +368,18 @@ CREATE INDEX CONCURRENTLY standard_qc3_index ON lvmopsdb.standard (q3c_ang2ipix(ra, dec)); +CREATE INDEX ON lvmopsdb.ln2_fill (action); +CREATE INDEX ON lvmopsdb.ln2_fill (start_time); +CREATE INDEX ON lvmopsdb.ln2_fill (end_time); +CREATE INDEX ON lvmopsdb.ln2_fill (purge_start); +CREATE INDEX ON lvmopsdb.ln2_fill (purge_complete); +CREATE INDEX ON lvmopsdb.ln2_fill (fill_start); +CREATE INDEX ON lvmopsdb.ln2_fill (fill_complete); +CREATE INDEX ON lvmopsdb.ln2_fill (fail_time); +CREATE INDEX ON lvmopsdb.ln2_fill (abort_time); +CREATE INDEX ON lvmopsdb.ln2_fill (failed); +CREATE INDEX ON lvmopsdb.ln2_fill (aborted); + CLUSTER standard_qc3_index ON lvmopsdb.standard; CREATE INDEX CONCURRENTLY ON lvmopsdb.guider_coadd (exposure_no); @@ -368,5 +399,7 @@ lvmopsdb.completion_status to sdss_user; grant select on all tables in schema lvmopsdb to sdss_user; grant usage on all sequences in schema lvmopsdb to sdss_user; +grant insert on TABLE lvmopsdb.ln2_fill to sdss_user; + alter table lvmopsdb.sky add column darkest_wham_flag bool; alter table lvmopsdb.sky add column valid bool;