|
| 1 | +--- |
| 2 | +status: new |
| 3 | +--- |
| 4 | + |
| 5 | +# Scripts |
| 6 | + |
| 7 | +## General |
| 8 | + |
| 9 | +### `db.dump` |
| 10 | + |
| 11 | +Converts the database into JSON and writes it to a file in `user/dumps/`. |
| 12 | +This is not an efficient backup method; it is intended for converting between databases (e.g. SQLite to MySQL). |
| 13 | + |
| 14 | +=== "npm" |
| 15 | + ```bash linenums="0" |
| 16 | + npm run db.dump |
| 17 | + ``` |
| 18 | +=== "pnpm" |
| 19 | + ```bash linenums="0" |
| 20 | + pnpm db.dump |
| 21 | + ``` |
| 22 | + |
| 23 | +### `db.prune` |
| 24 | + |
| 25 | +Deletes all data from guilds in the database where the bot was first added |
| 26 | +**more than `a` days ago** **and** there has not been a ticket created |
| 27 | +**less than `t` days ago.** |
| 28 | + |
| 29 | +=== "npm" |
| 30 | + ```bash linenums="0" |
| 31 | + npm run db.prune -- [options] |
| 32 | + ``` |
| 33 | +=== "pnpm" |
| 34 | + ```bash linenums="0" |
| 35 | + pnpm db.dump [options] |
| 36 | + ``` |
| 37 | + |
| 38 | +!!! example |
| 39 | + ```bash linenums="0" |
| 40 | + $ pnpm db.prune -h |
| 41 | + Usage: prune [options] |
| 42 | + |
| 43 | + Options: |
| 44 | + -y, --yes ARE YOU SURE? |
| 45 | + -a, --age <number> delete guilds older than <a> days (default: 90) |
| 46 | + -t, --ticket <number> where the most recent ticket was created over <t> days ago (default: 365) |
| 47 | + -h, --help display help for command |
| 48 | + ``` |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | +### `db.restore` |
| 53 | + |
| 54 | +Reset the database, then import data from a dump file. |
| 55 | + |
| 56 | +=== "npm" |
| 57 | + ```bash linenums="0" |
| 58 | + npm run db.restore -- [options] |
| 59 | + ``` |
| 60 | +=== "pnpm" |
| 61 | + ```bash linenums="0" |
| 62 | + pnpm db.restore [options] |
| 63 | + ``` |
| 64 | + |
| 65 | +!!! example |
| 66 | + ```bash linenums="0" |
| 67 | + $ pnpm db.restore -h |
| 68 | + Usage: restore [options] |
| 69 | + |
| 70 | + Options: |
| 71 | + -f, --file <path> the path of the dump to import |
| 72 | + -y, --yes yes, DELETE EVERYTHING in the database |
| 73 | + -h, --help display help for command |
| 74 | + ``` |
| 75 | + |
| 76 | +### `keygen` |
| 77 | + |
| 78 | +Generates and outputs a new encryption key. |
| 79 | + |
| 80 | +### `preinstall` |
| 81 | + |
| 82 | +This should run automatically when you run `npm install`. |
| 83 | +Creates a `.env` file with a generated encryption key, except in CI environments. |
| 84 | + |
| 85 | +### `postinstall` |
| 86 | + |
| 87 | +This should run automatically when you run `npm install`. |
| 88 | +If `DB_PROVIDER` is set, copies the appropriate database schema and migration files, |
| 89 | +then generates the prisma client and deploys migrations. |
| 90 | + |
| 91 | +### `start` |
| 92 | + |
| 93 | +Starts the bot. |
| 94 | + |
| 95 | +### `studio` |
| 96 | + |
| 97 | +Starts a web server running Prisma Studio, a web-based GUI for viewing and editing records in your database. |
| 98 | + |
| 99 | +## Development |
| 100 | + |
| 101 | +### `changelog` |
| 102 | +### `contributors:add` |
| 103 | + |
| 104 | +Add yourself as a contributor. |
| 105 | + |
| 106 | +[Documentation](https://allcontributors.org/docs/en/cli/usage#all-contributors-add){.md-button .md-button--primary} |
| 107 | + |
| 108 | +### `contributors:generate` |
| 109 | + |
| 110 | +Regenerate `CONTRIBUTORS.md`, shouldn't be necessary. |
| 111 | + |
| 112 | +### `lint` |
| 113 | + |
| 114 | +Check for and automatically fix formatting errors. |
| 115 | + |
| 116 | +### `test` |
| 117 | + |
| 118 | +Check the i18n files are valid. |
0 commit comments