{"name":"graphql-migrations","version":"0.0.1","description":"GraphQL database migrations package","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"","license":"ISC","_id":"graphql-migrations@0.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"wtrocki","email":"wtrocki@redhat.com"},"dist":{"integrity":"sha512-HD1Qbuiqj+wAPA0zxOGbV960mmtXyWTQFy1iv56ozxA20KkZmttGoQRwNS9NjX3AkBRhalX3Reh1CIOr3mb5RA==","shasum":"7d9390e1447e97d75c1a55c5dd76d09a2a31f9a1","tarball":"http://registry-npm.ywwl.com/graphql-migrations/download/graphql-migrations-0.0.1.tgz","fileCount":1,"unpackedSize":249,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdzAbVCRA9TVsSAnZWagAAtG4P/irtwManrai55aWG6OR5\n7v2arLAvjvZm8gLoK+ul+qUytFIkiIQk6nV7Drt0za23F6CQEoz85zi23bp2\nHVHXPO0Hp7KW3MGu1gqThAR81O0Nb1r9H5P7vv99UL/353iRd7E+5oXdUHIc\nwwOHjn5s3vzanwtgGrBKNrpYj68FtHcWnnFgr2LgPgiiMD5AhDqMFbWd7T5L\nHu9wPXXxrkcPDP6jz+mC1094fQYe3EqZRuAqrveJvA4CVkhn3RK6xgUh/HYA\npuenEHt591ohwVhyat87u2jhq+uk/ZudHu1MfdDqNECbN3AFR73RP7h44N6l\n93rSQ3s9UMNaqg8M432rJBgpuKsa1bFAU4uNVBc4pP3Y9NptVhZL/xAU0SUo\nUhZKAlJV3y0fR+R1T/1UbBGEtH73kCUphDhSOWXP7HzhbAg3h4j5qLdC0OnC\nPrUFgP59JsGpBQal5/C93NhGZKT+jn46FTbPj6F/Q8/BU5qECBV1XSDVb46h\nUsu+c1qg1VY/419IytRfZfWU07Y18txVbg4QtEpru7cjLj4EGfc2U/B2vUB4\nGf0giLoU8eIRV0k/hWScyAR+g9/Jy4Gx16lq/g5swQ7IIeJsFmB9yE3+8Gpf\nBkn4xOR14geak6C2fg+c5gzcF3AXYlGLivG8AcH8/q5q5YrWJAqX5jV+TTDF\nBETW\r\n=iJqN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF297JohuBrEJ7jy0yvKtH+CmJMP0PMeWt+etvuvegaSAiEAvCMVkAdTNTV4vjNJ7VoFIaG6F7gVFxZ//IfMLu0Lyw0="}],"size":269,"noattachment":false,"key":"/graphql-migrations/-/graphql-migrations-0.0.1.tgz"},"maintainers":[{"name":"wtrocki","email":"wtrocki@redhat.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/graphql-migrations_0.0.1_1573652181075_0.9321690687366617"},"_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":1573652181196,"_cnpm_publish_time":1573652181196,"dist-tags":{"dev":"0.10.0-dev4","latest":"1.1.2","next":"1.1.0-alpha2"}}