Giter Club home page Giter Club logo

sql-to-graphql-schema-generator's Introduction

SQL to Graphql Schema Generator

⚛️ Generate GraphQL Scheme Online From SQL Query

SQL to Graphql Schema Generator

Check live on https://sql-to-graphql.now.sh/

Made with ❤️ by Twitter Follow Twitter Follow

✨ Features

  • Convert SQL Table To GraphQL Schema

  • Copy Generated Code to Clipboard

  • Dark Mode

🗒 Docs

  • Paste SQL Query example.
CREATE TABLE `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(225) NOT NULL,
  `password` varchar(225) NOT NULL,
  `email` varchar(225) NOT NULL,
  `avatar` varchar(225) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `url` (`url`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
  • Click on the Run Button

🔌 Usage

git clone https://github.com/Devzstudio/SQL-to-Graphql-Schema-Generator.git
  • Install dependencies and start
npm install
npm run dev

🛣 ToDo

  • Add Keyboard Shortcut for Paste and Copy

🤝 Contributing

Contributions, issues and feature requests are welcome! 😍

Show your support

Give a ⭐️ if this project helped you! 🥰

sql-to-graphql-schema-generator's People

Contributors

dependabot[bot] avatar mamen avatar martinjackson avatar pjijin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

sql-to-graphql-schema-generator's Issues

Recognize `CONSTRAINT` as a SQL keyword

I tried generating GraphQL for my MySQL table at https://sql-to-graphql.now.sh/

This was the CREATE TABLE statement:

CREATE TABLE `client` (
  `client_id` int unsigned NOT NULL AUTO_INCREMENT,
  `active_product` int unsigned NOT NULL,
  `name` varchar(60) NOT NULL,
  `address` varchar(60) NOT NULL COMMENT 'company address: first line',
  `city` varchar(60) NOT NULL COMMENT 'company address: city',
  `state` varchar(60) NOT NULL COMMENT 'company address: state',
  `country` varchar(60) NOT NULL DEFAULT 'USA',
  `zip_code` varchar(60) NOT NULL COMMENT 'company address: zip_code',
  `rep_first_name` varchar(60) NOT NULL,
  `rep_last_name` varchar(60) NOT NULL,
  `rep_email` varchar(255) NOT NULL COMMENT 'The representative''s email address.',
  `rep_phone` varchar(25) NOT NULL,
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`client_id`),
  UNIQUE KEY `rep_email_UNIQUE` (`rep_email`),
  KEY `fk_product_idx` (`active_product`),
  CONSTRAINT `fk_client_product` FOREIGN KEY (`active_product`) REFERENCES `product` (`product_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

This was the output:

type Client {
        client_id: ID!
        active_product: Int!
        name: String!
        address: String!
        city: String!
        state: String!
        country: String!
        zip_code: String!
        rep_first_name: String!
        rep_last_name: String!
        rep_email: String!
        rep_phone: String!
        CONSTRAINT: Int
        }

However, CONSTRAINT is a SQL keyword, not a column! This should be fixed.

CLI addons

Do you have any CLI addons other than GUI solution? This could be useful for CI/CD purposes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.