     name          text        NOT NULL UNIQUE,
     pass          bytea       NOT NULL,
     salt          bytea       NOT NULL,
-    rights        integer     NOT NULL DEFAULT 0,
-    vote_weight   integer     NOT NULL DEFAULT 1,
+    rights        int         NOT NULL DEFAULT 0,
+    vote_weight   int         NOT NULL DEFAULT 1,
     summary       text,
     register_date timestamptz NOT NULL DEFAULT now(),
     last_active   timestamptz NOT NULL DEFAULT 'epoch'::timestamptz,

    title        text        NOT NULL,
    native_title text        NOT NULL,
    other_titles text[],
    kind         integer     NOT NULL DEFAULT 0,
    summary      text,
    vintage      integer     NOT NULL, -- year
    date_added   timestamptz NOT NULL,
    last_updated timestamptz NOT NULL,
    finished     boolean     NOT NULL DEFAULT false,
    nsfw         boolean     NOT NULL DEFAULT false,
    avg_rating   real, -- NULL means not rated (as opposed to a zero rating)
    rating_count integer     NOT NULL DEFAULT 0,
    demographic  integer     NOT NULL,
    magazine_id  integer     REFERENCES magazines,
    has_cover    boolean     NOT NULL DEFAULT false
);

-- This table glues book_series and publishers to indicate if a series is
-- officially licensed in countries outside of the original
CREATE TABLE series_licenses (
    id            serial  PRIMARY KEY,
    series_id     integer NOT NULL REFERENCES book_series,
    publisher_id  integer NOT NULL REFERENCES publishers,
    country       text    NOT NULL,
    date_licensed date
);


--

CREATE TABLE translation_groups (
    id               serial PRIMARY KEY,
    name             text   NOT NULL UNIQUE,
    summary          text,
    avg_rating       real,
    rating_count     int    NOT NULL DEFAULT 0,
    avg_release_rate bigint -- seconds
);

CREATE TABLE chapters (
    id           serial      PRIMARY KEY,
    release_date timestamptz NOT NULL DEFAULT 'epoch'::timestamptz,
    series_id    int         NOT NULL REFERENCES book_series,
    num          int         NOT NULL,
    volume       int,
    notes        text
);

CREATE TABLE releases (
    id              serial      PRIMARY KEY,
    series_id       int         NOT NULL REFERENCES book_series,
    language        text        NOT NULL DEFAULT 'en',
    release_date    timestamptz NOT NULL DEFAULT now(),
    notes           text,
