如何将graphql服务器连接到postgres数据库?

时间:2018-11-21 12:26:17

标签: postgresql graphql

这是我的项目目录中的我的posgres.sql文件:

CREATE TABLE client (
  cli_id serial PRIMARY KEY,
  cli_name text NOT NULL,
  cli_birthyear smallint NOT NULL
);

CREATE TABLE product (
  pro_id serial PRIMARY KEY,
  pro_ean text UNIQUE NOT NULL,
  pro_name text NOT NULL,
  pro_description text NOT NULL,
  pro_weight_g smallint NOT NULL
);

CREATE TABLE command (
  com_id serial PRIMARY KEY,
  com_number text UNIQUE NOT NULL,
  cli_id integer NOT NULL REFERENCES client
);

CREATE TABLE command_line (
  lin_id serial PRIMARY KEY,
  com_id integer NOT NULL REFERENCES command,
  pro_id integer NOT NULL REFERENCES product,
  lin_quantity smallint NOT NULL
);

现在,如何使用此文件来connect the postges database to graphql?以及如何使用graphql查询postgres数据库?

0 个答案:

没有答案