CREATE TABLE cms.[_TABLE_] (
  id SERIAL, 
  title VARCHAR(256), 
  description TEXT, 
  _user INTEGER NOT NULL, 
  _update TIMESTAMP WITHOUT TIME ZONE DEFAULT now() NOT NULL,
  _create TIMESTAMP WITHOUT TIME ZONE DEFAULT now() NOT NULL,
  CONSTRAINT [_TABLE_]_pkey PRIMARY KEY(id), 
  CONSTRAINT [_TABLE_]_user_fk FOREIGN KEY (_user)
    REFERENCES _user(_id)
    ON DELETE RESTRICT
    ON UPDATE CASCADE
    NOT DEFERRABLE
) WITHOUT OIDS;

CREATE TABLE cms.[_TABLE_]_file (
  _item INTEGER NOT NULL, 
  _file INTEGER NOT NULL, 
  CONSTRAINT [_TABLE_]_file_idx PRIMARY KEY("_file", "_item"), 
  CONSTRAINT [_TABLE_]_file_file_fk FOREIGN KEY ("_file")
    REFERENCES _file(_id)
    ON DELETE RESTRICT
    ON UPDATE CASCADE
    NOT DEFERRABLE, 
  CONSTRAINT [_TABLE_]_file_item_fk FOREIGN KEY ("_item")
    REFERENCES [_TABLE_]("id")
    ON DELETE CASCADE
    ON UPDATE CASCADE
    NOT DEFERRABLE
) WITHOUT OIDS;