graphile-meta-schema

graphile meta schema

Usage no npm install needed!

<script type="module">
  import graphileMetaSchema from 'https://cdn.skypack.dev/graphile-meta-schema';
</script>

README

graphile-meta-schema Build Status

npm install graphile-meta-schema 

example query

query MetaQuery {
  _meta {
    tables {
      name
      fields {
        name
        type {
          name
        }
      }
      constraints {
        ... on MetaschemaForeignKeyConstraint {
          fields {
            name
          }
          refTable {
            name
            fields {
              name
            }
          }
          refFields {
            name
          }
        }

        ... on MetaschemaPrimaryKeyConstraint {
          __typename
          fields {
            name
            type {
              name
            }
          }
          name
        }

        ... on MetaschemaUniqueConstraint {
          __typename
          name
          fields {
            name
            type {
              name
            }
          }
        }
        ... on MetaschemaCheckConstraint {
          __typename
          name
          fields {
            name
            type {
              name
            }
          }
        }
      }
    }
  }
}

testing

createdb metaschema_example
psql metaschema_example < sql/test.sql
psql metaschema_example < sql/types.sql