|
| 1 | +/* |
| 2 | + * Graphile Migrate configuration. |
| 3 | + * |
| 4 | + * If you decide to commit this file (recommended) please ensure that it does |
| 5 | + * not contain any secrets (passwords, etc) - we recommend you manage these |
| 6 | + * with environmental variables instead. |
| 7 | + * |
| 8 | + * This file is in JSON5 format, in VSCode you can use "JSON with comments" as |
| 9 | + * the file format. |
| 10 | + */ |
| 11 | + |
| 12 | +{ |
| 13 | + /* |
| 14 | + * connectionString: this tells Graphile Migrate where to find the database |
| 15 | + * to run the migrations against. |
| 16 | + * |
| 17 | + * RECOMMENDATION: use `DATABASE_URL` envvar instead. |
| 18 | + */ |
| 19 | + // "connectionString": "postgres://appuser:apppassword@host:5432/appdb", |
| 20 | + |
| 21 | + /* |
| 22 | + * shadowConnectionString: like connectionString, but this is used for the |
| 23 | + * shadow database (which will be reset frequently). |
| 24 | + * |
| 25 | + * RECOMMENDATION: use `SHADOW_DATABASE_URL` envvar instead. |
| 26 | + */ |
| 27 | + // "shadowConnectionString": "postgres://appuser:apppassword@host:5432/appdb_shadow", |
| 28 | + |
| 29 | + /* |
| 30 | + * rootConnectionString: like connectionString, but this is used for |
| 31 | + * dropping/creating the database in `graphile-migrate reset`. This isn't |
| 32 | + * necessary, shouldn't be used in production, but helps during development. |
| 33 | + * |
| 34 | + * RECOMMENDATION: use `ROOT_DATABASE_URL` envvar instead. |
| 35 | + */ |
| 36 | + // "rootConnectionString": "postgres://adminuser:adminpassword@host:5432/postgres", |
| 37 | + |
| 38 | + /* |
| 39 | + * pgSettings: key-value settings to be automatically loaded into PostgreSQL |
| 40 | + * before running migrations, using an equivalent of `SET LOCAL <key> TO |
| 41 | + * <value>` |
| 42 | + */ |
| 43 | + "pgSettings": { |
| 44 | + // "search_path": "app_public,app_private,app_hidden,public", |
| 45 | + }, |
| 46 | + |
| 47 | + /* |
| 48 | + * placeholders: substituted in SQL files when compiled/executed. Placeholder |
| 49 | + * keys should be prefixed with a colon and in all caps, like |
| 50 | + * `:COLON_PREFIXED_ALL_CAPS`. Placeholder values should be strings. They |
| 51 | + * will be replaced verbatim with NO ESCAPING AT ALL (this differs from how |
| 52 | + * psql handles placeholders) so should only be used with "safe" values. This |
| 53 | + * is useful for committing migrations where certain parameters can change |
| 54 | + * between environments (development, staging, production) but you wish to |
| 55 | + * use the same signed migration files for all. |
| 56 | + * |
| 57 | + * The special value "!ENV" can be used to indicate an environmental variable |
| 58 | + * of the same name should be used. |
| 59 | + * |
| 60 | + * Graphile Migrate automatically sets the `:DATABASE_NAME` and |
| 61 | + * `:DATABASE_OWNER` placeholders, and you should not attempt to override |
| 62 | + * these. |
| 63 | + */ |
| 64 | + "placeholders": { |
| 65 | + // ":DATABASE_VISITOR": "!ENV", // Uses process.env.DATABASE_VISITOR |
| 66 | + }, |
| 67 | + |
| 68 | + /* |
| 69 | + * Actions allow you to run scripts or commands at certain points in the |
| 70 | + * migration lifecycle. SQL files are ran against the database directly. |
| 71 | + * "command" actions are ran with the following environmental variables set: |
| 72 | + * |
| 73 | + * - GM_DBURL: the PostgreSQL URL of the database being migrated |
| 74 | + * - GM_DBNAME: the name of the database from GM_DBURL |
| 75 | + * - GM_DBUSER: the user from GM_DBURL |
| 76 | + * - GM_SHADOW: set to 1 if the shadow database is being migrated, left unset |
| 77 | + * otherwise |
| 78 | + * |
| 79 | + * If "shadow" is unspecified, the actions will run on events to both shadow |
| 80 | + * and normal databases. If "shadow" is true the action will only run on |
| 81 | + * actions to the shadow DB, and if false only on actions to the main DB. |
| 82 | + */ |
| 83 | + |
| 84 | + /* |
| 85 | + * afterReset: actions executed after a `graphile-migrate reset` command. |
| 86 | + */ |
| 87 | + "afterReset": [ |
| 88 | + // "afterReset.sql", |
| 89 | + // { "_": "command", "command": "graphile-worker --schema-only" }, |
| 90 | + ], |
| 91 | + |
| 92 | + /* |
| 93 | + * afterAllMigrations: actions executed once all migrations are complete. |
| 94 | + */ |
| 95 | + "afterAllMigrations": [ |
| 96 | + // { |
| 97 | + // "_": "command", |
| 98 | + // "shadow": true, |
| 99 | + // "command": "if [ \"$IN_TESTS\" != \"1\" ]; then ./scripts/dump-db; fi", |
| 100 | + // }, |
| 101 | + ], |
| 102 | + |
| 103 | + /* |
| 104 | + * afterCurrent: actions executed once the current migration has been |
| 105 | + * evaluated (i.e. in watch mode). |
| 106 | + */ |
| 107 | + "afterCurrent": [ |
| 108 | + // { |
| 109 | + // "_": "command", |
| 110 | + // "shadow": true, |
| 111 | + // "command": "if [ \"$IN_TESTS\" = \"1\" ]; then ./scripts/test-seed; fi", |
| 112 | + // }, |
| 113 | + ], |
| 114 | + |
| 115 | + /* |
| 116 | + * blankMigrationContent: content to be written to the current migration |
| 117 | + * after commit. NOTE: this should only contain comments. |
| 118 | + */ |
| 119 | + // "blankMigrationContent": "-- Write your migration here\n", |
| 120 | + |
| 121 | + /****************************************************************************\ |
| 122 | + *** *** |
| 123 | + *** You probably don't want to edit anything below here. *** |
| 124 | + *** *** |
| 125 | + \****************************************************************************/ |
| 126 | + |
| 127 | + /* |
| 128 | + * manageGraphileMigrateSchema: if you set this false, you must be sure to |
| 129 | + * keep the graphile_migrate schema up to date yourself. We recommend you |
| 130 | + * leave it at its default. |
| 131 | + */ |
| 132 | + // "manageGraphileMigrateSchema": true, |
| 133 | + |
| 134 | + /* |
| 135 | + * migrationsFolder: path to the folder in which to store your migrations. |
| 136 | + */ |
| 137 | + // migrationsFolder: "./migrations", |
| 138 | + |
| 139 | + "//generatedWith": "1.0.2" |
| 140 | +} |
0 commit comments