I have the following table in mysql.
Users
CREATE TABLE users(
id INTEGER AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255) UNIQUE NOT NULL,
email VARCHAR(255) UNIQUE NOT NULL,
password VARCHAR(100) NOT NULL,
created_at TIMESTAMP DEFAULT NOW()
);
and Posts
CREATE TABLE posts(
id INTEGER AUTO_INCREMENT PRIMARY KEY,
created_by INTEGER NOT NULL,
created_at TIMESTAMP DEFAULT NOW(),
post_title VARCHAR(100) NOT NULL UNIQUE,
post_body VARCHAR(255) NOT NULL,
slug VARCHAR(100) NOT NULL UNIQUE,
FOREIGN KEY (created_by) REFERENCES users(id)
);
I am using nodejs and the mysql npm package. How can I make graphQL schema for the models?
I searched a lot but failed to find any solution to this. Mostly people are using sequelize for this purpose. Is it better than mysql package?