{"name":"graphql-migrations","version":"1.1.2","description":"Create & migrate Databases from GraphQL Schema","main":"dist/index.js","types":"types/index.d.ts","typescript":{"definition":"types/index.d.ts"},"repository":{"type":"git","url":"git+https://github.com/aerogear/graphback.git"},"bugs":{"url":"https://github.com/aerogear/graphback/issues"},"homepage":"https://github.com/aerogear/graphback/tree/master/packages/graphql-migrations#readme","scripts":{"clean":"rimraf coverage dist types","build":"tsc","watch":"tsc -w","lint":"eslint -t stylish --project \"tsconfig.json\"","test":"jest"},"dependencies":{"@graphback/core":"1.1.2","@graphql-inspector/core":"2.3.0","@types/jest":"26.0.19","case":"1.6.3","chalk":"3.0.0","glob":"7.1.6","graphql-metadata":"0.7.6","lodash":"4.17.20","lodash-es":"4.17.15","node-emoji":"1.10.0","pino":"6.8.0","ts-jest":"26.4.4"},"devDependencies":{"@types/jest":"26.0.19","@types/lodash":"4.14.165","@types/node":"12.19.9","graphql":"15.4.0","graphql-tools":"7.0.2","jest":"26.6.3","pg":"8.5.1","rimraf":"3.0.2","sqlite3":"5.0.0","ts-node":"9.1.1","tsutils":"3.17.1","typescript":"4.1.3"},"peerDependencies":{"graphql":"^14.0.0 || ^15.0.0","knex":"0.20.x || 0.21.x"},"engines":{"node":">=10.15.3"},"_id":"graphql-migrations@1.1.2","_nodeVersion":"12.20.2","_npmVersion":"6.14.11","dist":{"integrity":"sha512-E2t9MY+q1oKsMcJNrlGdvPWu94KwMuZRhvFZoekCDfQ4CWQhrvcPRNAMI9SqdIVE7DITFGhLNdFRwR1h18/ASA==","shasum":"5023338e7cdd0f2ac4e38a8a2edf43480b814ad4","tarball":"http://registry-npm.ywwl.com/graphql-migrations/download/graphql-migrations-1.1.2.tgz","fileCount":160,"unpackedSize":308362,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgNi4aCRA9TVsSAnZWagAAiDIQAIFXY51qj8s/vaCGoF7A\nkCh2381wxaC4VpQrQsqMfc3DHkBPsccYEj4Tg58ax3AdLz3CRAA3CqKADyk6\nAc82bFIUw61zBJ5ifg1Fa3FQTi9Mi3Ix5qXcMS4pezUgwyhMUKEzC0NteKve\neJWDEIba20Jy70tOXmlqsAhK0lLYDR6Pny9aVLagAHU5j5XNRpSOsIT8ij9L\nL6EbOFrbp2cxZfaf2sJp7S3N/lEj4axUsa4FWjKqabT41i/VhwmtFLT7nPeW\nyrVq49usFtxmEvhmaM2HXM3Qs6Q1UarKn+BhMPVFrf2cjZJM39SBsdKyV1hL\njeSzjN61Gry+hZ/f0mxWElWI8IsWPABLT96ikCW0weW5jtHkdv4JysAwAS1z\nFlZoBKv3cPFYeKxUNIYEevo0TkYIDoK4f7ibvkxmQmHT5nNtjNRyZPQaK2sm\nGdxVNNYYCyQchYJkmIvgSpW0uhcSwCK4QL+3LOts+FbpmTmHBn9Jm+Kh6rlN\nQ+offs1jIgR+PShEL6xlHJGDuEdGiU0RKXu3ojb8durse5hQIpWQZgk3gdBq\nay8tdpH/chnZMd+s021o2kaa2x5p5SuNE+fYeqZFxGeVkUFunYl5e3Snv431\nClSqcsnbHHt8/1yVPd7+vs3lzcZV1ppvq5jZ48fsF28VCyNTCZoVfnMeQItH\nLLXP\r\n=nILF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHSdF6k06rLs65groWCrxV6g3xv5x+8rl99ZFy1pc7wJAiAGFdyuJypfFFIracqzF9evGymUb40bjWYqGO1008tOdA=="}],"size":58183,"noattachment":false,"key":"/graphql-migrations/-/graphql-migrations-1.1.2.tgz"},"_npmUser":{"name":"aerogear-ci","email":"mziccard@redhat.com"},"directories":{},"maintainers":[{"name":"ephelan","email":"ephelan@redhat.com"},{"name":"wtrocki","email":"wtrocki@redhat.com"},{"name":"aerogear-ci","email":"mziccard@redhat.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/graphql-migrations_1.1.2_1614163481835_0.418104877446851"},"_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":1614163482101,"_cnpm_publish_time":1614163482101,"dist-tags":{"dev":"0.10.0-dev4","latest":"1.1.2","next":"1.1.0-alpha2"}}