A tool to migrate data from version 3.1 to 4.0.
- This tool only works with version 3.1 of the bot. If you are using an older version, you will need to update to version 3.1 first.
- This tool can't be used to change the database type (e.g. from SQLite to MySQL). This isn't a technical limitation, so you can open an issue if you want this to be supported.
- You need two databases.
- Clone this repository
$ git clone https://github.com/discord-tickets/migrate-v3-to-v4.git- Copy the Prisma schema for your database (replace
mysqlwithsqliteorpostgresqlif you're not using MySQL)
$ cp prisma/mysql.prisma prisma/schema.prisma- Install dependencies with (P)NPM or Yarn
$ npm installand one of the following:
$ npm install sqlite3 # for SQLite
# or
$ npm install mysql2 # for MySQL
# or
$ npm install pg pg-hstore # for PostgreSQL- Generate the Prisma client and baseline the database
$ npx prisma db pushNote
If you are using MySQL or PostgreSQL, you need to set the
V4_DBenvironment variable to the connection string of your new database.Linux example:
$ V4_DB=mysql://... npx prisma db pushWindows example:
$ set V4_DB=mysql://... $ npx prisma db push
- Run the migrator
$ node . <options>Usage: migrate-v3-to-v4 [options]
Options:
-s, --sqlite <file> v3 sqlite database file
--v3 <url> v3 database connection string
--v4 <url> v4 database connection string
-p, --prefix <prefix> v3 database table prefix (default: "dsctickets_")
-k, --key <encryption key> v3 encryption key (default: null)
-h, --help display help for command
$ node . --sqlite <path to v3 database>$ node . --v3 mysql://... --v4 mysql://... -k <encryption key>$ node . --v3 postgresql://... --v4 postgresql://... -k <encryption key>