Skip to content

Commit

Permalink
Update gortdb.night_log and gortdb.night_log_comment
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Sep 22, 2024
1 parent ac639d7 commit ee3030d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changelog
This document records the main changes to the ``sdssdb`` code.

* Add table and models for ``lvmopsdb.ln2_fill``.
* Add tables and models for ``gortdb.night_log`` and ``gortdb.night_log_command``.

* :release:`0.13.0 <2024-09-03>`
* :feature:`264` Add metadata for the ``sdss_id_to_catalog`` table.
Expand Down
6 changes: 5 additions & 1 deletion python/sdssdb/peewee/lvmdb/gortdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,13 @@ class Meta:
class NightLogComment(GortDBBase):
pk = AutoField(primary_key=True)
night_log = ForeignKeyField(
model=NightLog, column_name="night_log_pk", backref="comments"
model=NightLog,
column_name="night_log_pk",
backref="comments",
)
time = DateTimeField()
comment = TextField()
category = TextField()

class Meta:
table_name = "night_log_comment"
10 changes: 8 additions & 2 deletions schema/lvmdb/gortdb.sql
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ CREATE TABLE gortdb.night_log (
CREATE TABLE gortdb.night_log_comment (
pk SERIAL PRIMARY KEY NOT NULL,
night_log_pk INTEGER,
comment TEXT
time TIMESTAMPTZ,
comment TEXT,
category TEXT
);


Expand All @@ -86,6 +88,8 @@ CREATE INDEX ON gortdb.exposure (mjd);
CREATE INDEX ON gortdb.night_log (mjd);

CREATE INDEX ON gortdb.night_log_comment (night_log_pk);
CREATE INDEX ON gortdb.night_log_comment (time);
CREATE INDEX ON gortdb.night_log_comment (category);


ALTER TABLE ONLY gortdb.night_log_comment
Expand All @@ -96,6 +100,8 @@ ALTER TABLE ONLY gortdb.night_log_comment


GRANT USAGE ON SCHEMA gortdb TO sdss_user;

GRANT SELECT ON ALL TABLES IN SCHEMA gortdb TO sdss_user;
GRANT USAGE ON ALL SEQUENCES IN SCHEMA gortdb TO sdss_user;

GRANT INSERT ON gortdb.night_log TO sdss_user;
GRANT INSERT ON gortdb.night_log_comment TO sdss_user;

0 comments on commit ee3030d

Please sign in to comment.