{"bugs":{"url":"https://github.com/aerogear/graphback/issues"},"dist":{"shasum":"5430abb6df6ff2405c673a170dd0ba30b7607c42","tarball":"https://registry.npmjs.org/graphql-migrations/-/graphql-migrations-1.1.0-alpha2.tgz","fileCount":160,"integrity":"sha512-+fkdJ9sxUCJhNzQ6DHMRni01r9rEipHxSFfhbGyvsdnXOtFtsmulvSRTE+Z2zF6ct3m9Ug76ua6VwCfuvReggw==","signatures":[{"sig":"MEUCIQDQcIfsRnlUZ5jYSUJq5EWB07BJ2A+pBr9AZQQYYa/iQAIgYlSxq1YjIHUbYUS7Gt0TH0a1iEvfqHQIlxUPdnSpnjA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":308230,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfjqRsCRA9TVsSAnZWagAA8SgP/ilXJPxQMQ7QNTuqr59P\nseRf3X5VtxoRfPOsvxc9BSDCLnzV/jcA7I2lYb/ObiiRcHYpp2duT32eJK7Q\nbosx/Fadbse7/UCmGjDvaAEunIrxVjWA461An9EwBvLNF3X7uC8pdw4A5gU1\n2uKK+Qqex9mnz/go+GPINmojqoeyitGh3LoW3HOFPJRBHxzpOV+GYsGvt1nK\no2avGDo5mHvEFtPN3A5Y4KVgwSN3W5xyJo704U1wpHqPt+KX6MlsqFrXLi+j\ngrCOs7FYRK1sBMORwpDeDuzd2xLiy5RlLO0sN8NUTV1e7PZ3Iqt2YU1x5djN\nOGalcoGDPqYNdpC8jPtReOzXSPGiKcTWQvIeSnNp+2291ppzH1zLMDjxR5z6\nbyYiMUt1lL3WYDx4EM+fSBa+wNoS5J1DpSJYMxCmQAIj1pKqdt5MOO1Cwibc\n1IVOZMm7JKNIC/ULtGPZNTa2QvdV2DvwniqPJnSHT9bonFdGA9i3BnnugKl6\nIWKmFuGZvvu5eDHiRC1Eg4hQHzgoQGSiApYAKQc4G2DZe8KsYUiB5EsgDsCr\nos7DRHUACe9z4ijNc9W4C14EGjd9ff2GfCdZVbER/VYQDJjHzPbglOLmYW8a\nDRwi5OcBbm7rSIL1Rmudlc8l8W0d/4gx05jyD8h2BchGpppAR5a73Digalb5\nFOh/\r\n=IOQs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","name":"graphql-migrations","types":"types/index.d.ts","readme":"## Graphback\n\n<p align=\"center\">\n  <img width=\"400\" src=\"https://raw.githubusercontent.com/aerogear/graphback/master/website/static/img/logo.png\"/>\n  <br/>\n  Auto generate database structure, <br/>\n  GraphQL Resolvers and Queries from GraphQL types 🚀\n</p>\n\n**Documentation**: https://graphback.dev\n**Repository**: https://github.com/aerogear/graphback/\n\n## graphql-migrations\n\nAutomatically create and update your database tables from a GraphQL schema.\n\n### Usage\n\nThe `migrateDB` method creates and updates your tables and columns to match your GraphQL schema.\n\nAll the database operations are wrapped in a single transaction, so your database will be fully rolled back to its initial state if an error occurs.\n\n```ts\nimport { migrateDB } from 'graphql-migrations';\n\nconst dbConfig = {\n  client: 'pg',\n  connection: {\n    host: 'localhost',\n    user: 'your-user',\n    password: 'secret-password',\n    database: 'note-db',\n  },\n};\n\nconst schema = `\ntype Note {\n  id: ID!\n  title: String!\n  description: String\n  comments: [Comment]!\n}\n\ntype Comment {\n  id: ID!\n  description: String\n  note: Note!\n}\n`;\n\nmigrateDB(dbConfig, schema, {\n  // Additional options\n}).then(() => {\n  console.log('Database updated');\n});\n```\n\n### Migration Options\n\n- `config`: database configuration options.\n- `schema`: a GraphQL schema object.\n- `options`:\n  - `dbSchemaName` (default: `'public'`): table schema: `<schemaName>.<tableName>`.\n  - `dbTablePrefix` (default: ''): table name prefix: `<prefix><tableName>`.\n  - `dbColumnPrefix` (default: `''`): column name prefix: `<prefix><columnName>`.\n  - `updateComments`: overwrite comments on table and columns.\n  - `scalarMap` (default: `null`): Custom scalar mapping..\n  - `mapListToJson` (default: `true`): Map scalar lists to JSON column type by default.\n  - `plugins` (default: `[]`): List of graphql-migrations plugins.\n  - `debug` (default: `false`): display debugging information and SQL queries.\n\n### Model Definition\n\n```gql\n\"\"\"\nNotes table\n\"\"\"\ntype Note {\n  \"\"\"\n  Primary key\n  \"\"\"\n  id: ID!\n  \"\"\"\n  The note title\n  \"\"\"\n  title: String!\n}\n```\n\n### Skip table or field\n\n```gql\n\"\"\"\n@db.skip\n\"\"\"\ntype Error {\n  code: Int!\n  message: String!\n}\n\ntype Note {\n  id: ID!\n  title: String\n  \"\"\"\n  @db.skip: true\n  \"\"\"\n  computedField: Boolean\n}\n```\n\n### Rename\n\n```gql\n@db.oldNames: ['task']\ntype Note {\n  id: ID!\n  \"\"\"\n  @db.oldNames: ['text']\n  \"\"\"\n  title: String!\n}\n```\n\n### Nullable and non-nullable field\n\n```gql\ntype Note {\n  id: ID!\n  title: String! # not null\n}\n```\n\n```gql\ntype Note {\n  id: ID!\n  title: String # nullable\n}\n```\n\n### Default value\n\n```gql\ntype Note {\n  id: ID!\n  \"\"\"\n  default(value: 'Note title')\n  \"\"\"\n  title: String\n}\n```\n\n### Primary key\n\nEach type must have a primary key. The primary key field must be `id` and the type must be `ID`.\n\n```gql\ntype Note {\n  id: ID!\n  title: String!\n}\n```\n\n### Foreign key\n\nTo set a foreign key, set a field reference to the related type.\n\n```gql\ntype Comment {\n  id: ID!\n  note: Note! # this creates a `noteId` column in the `comment` table.\n}\n\ntype Note {\n  id: ID!\n  title: String!\n}\n```\n\n### Many-to-many\n\n```gql\ntype User {\n  id: ID!\n  \"\"\"\n  @db.manyToMany: 'users'\n  \"\"\"\n  messages: [Message]\n}\n\ntype Message {\n  id: ID!\n  \"\"\"\n  @db.manyToMany: 'messages'\n  \"\"\"\n  users: [User]\n}\n```\n\n### Many-to-many on same type\n\n```gql\ntype User {\n  id: ID!\n  friends: [User]\n}\n```\n\n### Simple index\n\n```gql\ntype User {\n  id: ID!\n  \"\"\"\n  @db.index\n  \"\"\"\n  email: String!\n}\n```\n\n### Multiple index\n\n```gql\ntype User {\n  \"\"\"\n  @db.index\n  \"\"\"\n  id: String!\n\n  \"\"\"\n  @db.index\n  \"\"\"\n  email: String!\n}\n```\n\n### Named index\n\n```gql\ntype User {\n  \"\"\"\n  @db.index: 'myIndex'\n  \"\"\"\n  email: String!\n\n  \"\"\"\n  @db.index: 'myIndex'\n  \"\"\"\n  name: String!\n}\n```\n\nYou can specify the index type on PostgreSQL.\n\n```gql\ntype User {\n  \"\"\"\n  @db.index: { name: 'myIndex', type: 'hash' }\n  \"\"\"\n  email: String!\n\n  \"\"\"\n  You don't need to specify the type again.\n  @db.index: 'myIndex'\n  \"\"\"\n  name: String!\n}\n```\n\n### Unique constraint\n\n```gql\ntype User {\n  id: ID!\n  \"\"\"\n  @db.unique\n  \"\"\"\n  email: String!\n}\n```\n\n### Custom name\n\n```gql\n\"\"\"\n@db.name: 'people'\n\"\"\"\ntype Note {\n  id: ID!\n  \"\"\"\n  @db.name: 'noteTitle'\n  \"\"\"\n  title: String!\n}\n```\n\n### Custom column type\n\n```gql\ntype Note {\n  id: ID!\n  \"\"\"\n  @db.type: 'string'\n  @db.length: 100\n  \"\"\"\n  title: String!\n}\n```\n\n### List\n\n```gql\ntype Note {\n  id: ID!\n  title: String!\n  \"\"\"\n  @db.types: 'json'\n  \"\"\"\n  comments: [String]\n}\n```\n\nYou can also set `mapListToJson` to `true` in the migrate options to automatically map scalar and enum lists to JSON.\n","engines":{"node":">=10.15.3"},"scripts":{"lint":"eslint -t stylish --project \"tsconfig.json\"","test":"jest","build":"tsc","clean":"rimraf coverage dist types","watch":"tsc -w"},"_npmUser":{"name":"aerogear-ci","email":"mziccard@redhat.com"},"homepage":"https://github.com/aerogear/graphback/tree/master/packages/graphql-migrations#readme","repository":{"url":"git+https://github.com/aerogear/graphback.git","type":"git"},"typescript":{"definition":"types/index.d.ts"},"_npmVersion":"6.14.8","description":"Create & migrate Databases from GraphQL Schema","directories":{},"maintainers":[{"name":"ephelan","email":"ephelan@redhat.com"},{"name":"wtrocki","email":"wtrocki@redhat.com"},{"name":"aerogear-ci","email":"mziccard@redhat.com"}],"_nodeVersion":"12.19.0","dependencies":{"case":"1.6.3","glob":"7.1.6","pino":"6.7.0","chalk":"3.0.0","lodash":"4.17.20","ts-jest":"26.4.1","lodash-es":"4.17.15","node-emoji":"1.10.0","@types/jest":"26.0.14","@graphback/core":"1.1.0-alpha2","graphql-metadata":"0.7.6","@graphql-inspector/core":"2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"pg":"8.4.0","jest":"26.5.2","rimraf":"3.0.2","graphql":"15.3.0","sqlite3":"5.0.0","ts-node":"9.0.0","tsutils":"3.17.1","typescript":"4.0.3","@types/jest":"26.0.14","@types/node":"12.12.64","@types/lodash":"4.14.161","graphql-tools":"6.2.3"},"peerDependencies":{"knex":"0.20.x || 0.21.x","graphql":"^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/graphql-migrations_1.1.0-alpha2_1603183723924_0.5410865731406136","host":"s3://npm-registry-packages"},"_id":"graphql-migrations@1.1.0-alpha2","version":"1.1.0-alpha2"}