Skip to content

Commit

Permalink
Add table and models for lvmopsdb.ln2_fill
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Sep 17, 2024
1 parent a5ea48b commit 56f590c
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
26 changes: 25 additions & 1 deletion python/sdssdb/peewee/lvmdb/lvmopsdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
FloatField,
ForeignKeyField,
IntegerField,
TextField
TextField,
)
from playhouse.postgres_ext import JSONField

from .. import BaseModel
from . import database # noqa
Expand Down Expand Up @@ -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'
33 changes: 33 additions & 0 deletions schema/lvmdb/lvmopsdb.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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);
Expand All @@ -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;

0 comments on commit 56f590c

Please sign in to comment.