{"name":"graphql-migrations","version":"0.14.0","description":"Create & migrate Databases from GraphQL Schema","main":"dist/index.js","types":"types/index.d.ts","typescript":{"definition":"types/index.d.ts"},"scripts":{"clean":"rimraf coverage dist types","build":"tsc","watch":"tsc -w","lint":"eslint -t stylish --project \"tsconfig.json\"","test":"jest"},"dependencies":{"@graphback/core":"0.14.0","@graphql-inspector/core":"2.1.0","@types/jest":"26.0.4","case":"1.6.3","chalk":"3.0.0","glob":"7.1.6","graphql-metadata":"0.7.0","knex":"0.21.2","lodash":"4.17.19","lodash-es":"4.17.15","node-emoji":"1.10.0","pino":"6.3.2","ts-jest":"26.1.2"},"devDependencies":{"@types/jest":"26.0.4","@types/lodash":"4.14.157","@types/node":"12.12.50","graphql":"15.3.0","graphql-tools":"6.0.10","jest":"26.1.0","pg":"8.3.0","rimraf":"3.0.2","sqlite3":"4.2.0","ts-node":"8.10.2","tsutils":"3.17.1","typescript":"3.9.6"},"peerDependencies":{"graphql":"^14.0.0 || ^15.0.0"},"engines":{"node":">=10.15.3"},"_id":"graphql-migrations@0.14.0","_nodeVersion":"12.18.2","_npmVersion":"6.14.5","dist":{"integrity":"sha512-mrAK8uqHjjv0q9RE1+6kbbTy5x/xYEWCYUQl9nXMszpzuODCPcoxLmckLlqAdL7AWoHhJ2tIKFWiMHO7tgeZww==","shasum":"7beb4d759079bc651ca94a30695dd2f294466126","tarball":"http://registry-npm.ywwl.com/graphql-migrations/download/graphql-migrations-0.14.0.tgz","fileCount":126,"unpackedSize":283879,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfFW64CRA9TVsSAnZWagAAzBQP/Ra/oVXA05n4F/YRU6cC\n6CY3ODE+idl7lUnyKmwVU/FlPIV8bbU+HZruXSC86A81SWVeXD80JHJokPpH\n58wpG4ZEUUmKiQdPjQtISmSnVZAt0W4psMee1fOOokHmrRBHXGBB2rV6RzK8\nD9AYjaN8wiUQf2bV01HVVvQmkz7gdEySotKttApN5QHoUmKue3/9+SI0J9UT\n0681PyKZEjKIxHy9vmEuOgDObP+WLAp4oi82P8xrQJMQrvQV/jbnjnDAhZOW\nexu9YAVwnV2H7uOLg0qLjh1mo8lN3c9cBsycgb5B2L2MFWfiU++1fCBWQny6\neHwVoRgVF7I7IwfINTBDHUIKtWhpexbaqSrE70n10Yg9y2TXAGIu1lPiw1vp\ndfFhRz4kakpPkrBMPBaZAfi5+BobKoeFdjhvdg5xG8ISPi1eAX3t24M1myMO\ncbN8SwL7B4V7rAIUqQDqMEIs4j4QicuxoQ5Z5NHC7a8YsqwCw2qcF3mcV+2a\n0fDEpIHTPDkheRETNZOz7gAJb1PQKFEADFsNqbjrDJyuqaszSPKe0XMiUd6t\nrK2zb60tb8PGZa05hgyBJH/KDRPdCfS8wrAjU8XEUMNRmlFydKw/m8kwhhqF\n+H4E1L0UhCzxn0WaKm3devVwTvzHL8DiGv78po6w+k+kkts4ZWoTsc20Ri/T\n3u7b\r\n=tnFf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF1Cu7Ehi0cYnyRlzsUmxcbIQv5G3NeoxSUkGZ9tMS77AiEA5SOxnk4Jf6TZqM5yo0gv/QY6YN+R/V7FkKHW892iTRQ="}],"size":52661,"noattachment":false,"key":"/graphql-migrations/-/graphql-migrations-0.14.0.tgz"},"maintainers":[{"email":"dara.s.hayes@gmail.com","name":"aerogear-ci"},{"email":"ephelan@redhat.com","name":"ephelan"},{"email":"wtrocki@redhat.com","name":"wtrocki"}],"_npmUser":{"name":"aerogear-ci","email":"mziccard@redhat.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/graphql-migrations_0.14.0_1595240119789_0.023507437026397904"},"_hasShrinkwrap":false,"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","publish_time":1595240120018,"_cnpm_publish_time":1595240120018,"dist-tags":{"dev":"0.10.0-dev4","latest":"1.1.2","next":"1.1.0-alpha2"}}