From 71c0450ea35b1f8a1de244f9f8bded12557f4fe5 Mon Sep 17 00:00:00 2001 From: sk1982 Date: Tue, 16 Apr 2024 19:53:34 -0400 Subject: [PATCH] add message about db encoding --- README.md | 3 +++ db-migrate.cjs | 4 +++- package.json | 1 + scripts/README.md | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4c14fa8..3b04961 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,9 @@ An ARTEMiS frontend. # **WARNING: Back up your database** I am not responsible for misconfigurations that lead to database issues. **You should back up your database before making any changes to it.** +### **Important**: your default database encoding must be unicode +You can change the encoding by running `ALTER DATABASE aime CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;` + ## Creating Database Tables Before running the database importer script, you must create the tables in your database. This can be done by running the server once with `AUTOMIGRATE` enabled ([see below](#runtime-variables)), or by running `npm run migrate` (make sure you have run `npm i` first and have the [`DATABASE_URL`](#runtime-variables) environment variable set). diff --git a/db-migrate.cjs b/db-migrate.cjs index 3f1c666..1b589e2 100644 --- a/db-migrate.cjs +++ b/db-migrate.cjs @@ -8,7 +8,9 @@ const dbmigrate = DBMigrate.getInstance(true); if (process.argv[2] === 'up') dbmigrate.up(); -else if (process.argv[2] == 'down') +else if (process.argv[2] === 'down') dbmigrate.down(); +else if (process.argv[2] === 'reset') + dbmigrate.reset(); else console.error('Unknown action', argv[2]); diff --git a/package.json b/package.json index 8787f4c..3ee262a 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "migrate:up": "dotenvx run -f .env.local -- node db-migrate.cjs up", "migrate": "npm run migrate:up", "migrate:down": "dotenvx run -f .env.local -- node db-migrate.cjs down", + "migrate:reset": "dotenvx run -f .env.local -- node db-migrate.cjs reset", "migrate:create": "dotenvx run -f .env.local -- db-migrate create", "db:export": "dotenvx run -f .env.local -- kysely-codegen --exclude-pattern cozynet* --exclude-pattern alembic_version --exclude-pattern actaeon_migrations --out-file src/types/db.d.ts && node process-db.js" }, diff --git a/scripts/README.md b/scripts/README.md index 659db7c..b349d46 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -52,6 +52,9 @@ Usage: `py db-importer.py [options] [game_options]` The database importer requires the `DATABASE_URL` environment variable to be set, which can be set in an `.env` file in the format `DATABASE_URL=mysql://user:pass@host:port/db_name` (see the `--env` option) +### **Important**: your default database encoding must be unicode +You can change the encoding by running `ALTER DATABASE aime CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;` + # **WARNING: Back up your database** I am not responsible for misconfigurations that lead to database issues. **You should back up your database before making any changes to it.**