Skip to content

Commit

Permalink
Update definition for catalogdb.catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Apr 18, 2020
1 parent c56c3d0 commit df73a8f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
7 changes: 4 additions & 3 deletions python/sdssdb/peewee/sdss5db/catalogdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import warnings

from peewee import (BigAutoField, BigIntegerField, CharField,
from peewee import (BigAutoField, BigIntegerField, CharField, CompositeKey,
DeferredThroughModel, DoubleField, FloatField,
ForeignKeyField, IntegerField, ManyToManyField, TextField)

Expand All @@ -36,7 +36,7 @@ class Meta:

class Catalog(CatalogdbModel):

catalogid = BigIntegerField(primary_key=True, null=False)
catalogid = BigIntegerField(null=False)
iauname = TextField(null=True)
ra = DoubleField(null=False)
dec = DoubleField(null=False)
Expand All @@ -48,7 +48,8 @@ class Catalog(CatalogdbModel):

class Meta:
table_name = 'catalog'
use_reflection = True
use_reflection = False
primary_key = CompositeKey('catalogid', 'version')


class AllWise(CatalogdbModel):
Expand Down
24 changes: 16 additions & 8 deletions schema/sdss5db/catalogdb/catalog.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,21 @@ CREATE SCHEMA catalogdb;
SET search_path TO catalogdb;


-- Table Definition ----------------------------------------------

CREATE TABLE catalogdb.catalog (
catalogid BIGSERIAL PRIMARY KEY NOT NULL,
catalogid BIGINT,
iauname TEXT,
ra DOUBLE PRECISION,
dec DOUBLE PRECISION,
pmra REAL,
pmdec REAL,
epoch REAL,
parallax REAL,
version TEXT);
ra DOUBLE PRECISION NOT NULL,
dec DOUBLE PRECISION NOT NULL,
pmra REAL,
pmdec REAL,
parallax REAL,
lead TEXT NOT NULL,
version TEXT,
CONSTRAINT catalog_pkey PRIMARY KEY (catalogid, version)
);

-- Indices -------------------------------------------------------

CREATE UNIQUE INDEX catalog_pkey ON catalogdb.catalog(catalogid, version);

0 comments on commit df73a8f

Please sign in to comment.