{"dist":{"shasum":"f90b51e713074f5aa8dc2521d5c2aa675e758cac","tarball":"https://registry.npmjs.org/graphql-migrations/-/graphql-migrations-0.14.0-dev3.tgz","fileCount":125,"integrity":"sha512-XqgJeE5Yez/ZHZ9ZzJC90z8aYChjoPYMqz3RmxiXXfgE4TpUBD+eT33kEXDf1ZxW7eQBBsNluYpxTfBEsCSzGA==","signatures":[{"sig":"MEUCIAjAM+CxehRhZoi69ZqVuunrW0z9+D0Nkas7M3sTfpunAiEAjO+nu97El8s491euuoNIMou071NaGwLgCaHk7TukJY4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":272520,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJey+KrCRA9TVsSAnZWagAACnwP/3VBjISLmTZfpJEpHEau\ne7Y18j/3K5wxUmCz6+AogRPMX12n28YsBJYfRF6KLtiM4ONhUercPDIccMJE\nAjsK4pBDq5rgLGGiFL+9rk4pXQePUjXi9zYNrsLWjBEJctb+Xd/g/gjep1KE\nHTmyqrf5uoUkGlSPdWK5Irncx3i/7+63H9XGf5sT8NbnqNOfLTaaD+QKbGzS\n1m1L+SaDdAx4hnYig7aMUC4QjScxnEdcMyn+a0DXhE0fB4DnDHdTXoEo77Jv\n0UMp9l+Bjs5h4pzN+2L/VJ/af3IJCpOjiiWbmPaoYNLdYgeL3hIfn1LVuCJk\nnw8wzf+esgDlKUwyrWWuDXxZYBoExgvnhn0uxWBGRzS8iubmWHwoeV3lbcQU\n59k+vM+yDo75BoG2uOaq2VtYB9hLeveyf1sMxKNRRQAzpSklHZYNEr5Gvud5\n1+JVwEwEXLTy95gDAN/I6Ue9HxqA2dE7zNMuSD+WQyVF1bTL7J7/jYW8xevG\nHwUAoAsZqARxo3RkM4Cqzt32rHbt1QUijHobVpaQXzMhUq8UdlTAVEMdhpOp\ngYE94BRpoSaN71GX4IN92UucRgrS/tA6FVk3tDPjZvVIV68ScaRQKH4K2sc8\n0OYhn5GttZ9fLlJrBFxY7m6QhnyPWSJnKzWwS+JPs+b11FBjWpwA0IoTc6VR\n8Zfj\r\n=JVTI\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://github.com/aerogear/graphback/raw/master/website/static/img/graphback.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  db.default: '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"},"typescript":{"definition":"types/index.d.ts"},"_npmVersion":"6.14.4","description":"Create & migrate Databases from GraphQL Schema","directories":{},"maintainers":[{"name":"aerogear-ci","email":"dara.s.hayes@gmail.com"},{"name":"ephelan","email":"ephelan@redhat.com"},{"name":"wtrocki","email":"wtrocki@redhat.com"}],"_nodeVersion":"12.16.3","dependencies":{"case":"1.6.3","glob":"7.1.6","knex":"0.21.1","pino":"6.3.0","chalk":"3.0.0","lodash":"4.17.15","ts-jest":"25.5.1","lodash-es":"4.17.15","node-emoji":"1.10.0","@types/jest":"25.2.3","@graphback/core":"0.14.0-dev3","graphql-metadata":"0.5.0","@graphql-inspector/core":"1.30.4"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"pg":"8.2.1","jest":"26.0.1","rimraf":"3.0.2","graphql":"14.6.0","sqlite3":"4.2.0","ts-node":"8.10.1","tsutils":"3.17.1","typescript":"3.9.3","@types/jest":"25.2.3","@types/node":"12.12.42","@types/lodash":"4.14.152","graphql-tools":"5.0.0","graphql-compose":"7.16.1"},"peerDependencies":{"graphql":"^0.12.0 || ^0.13.0 || ^14.0.0"},"_npmOperationalInternal":{"tmp":"tmp/graphql-migrations_0.14.0-dev3_1590420138975_0.4659158057266757","host":"s3://npm-registry-packages"},"_id":"graphql-migrations@0.14.0-dev3","version":"0.14.0-dev3"}