diff --git a/examples/minimal/prisma/schema.prisma b/examples/minimal/prisma/schema.prisma index 3b1dfe70..3b8d26e0 100644 --- a/examples/minimal/prisma/schema.prisma +++ b/examples/minimal/prisma/schema.prisma @@ -10,7 +10,7 @@ generator custom_generator { datasource db { provider = "mysql" - url = "mysql://root:@localhost:3306/accel_test_minimal" + url = "mysql://root:@localhost:3306/accel_test_minimal?timezone=Z" } model User { diff --git a/examples/minimal/src/models/_types.ts b/examples/minimal/src/models/_types.ts index 5c1248ca..b65a8742 100644 --- a/examples/minimal/src/models/_types.ts +++ b/examples/minimal/src/models/_types.ts @@ -75,7 +75,7 @@ export const dataSource = { activeProvider: "mysql", url: { fromEnvVar: null, - value: "mysql://root:@localhost:3306/accel_test_minimal", + value: "mysql://root:@localhost:3306/accel_test_minimal?timezone=Z", }, schemas: [], } as DataSource; diff --git a/packages/accel-record-core/src/database.ts b/packages/accel-record-core/src/database.ts index 26935589..c6f01490 100644 --- a/packages/accel-record-core/src/database.ts +++ b/packages/accel-record-core/src/database.ts @@ -56,7 +56,7 @@ export interface Config { * @example * ``` * sqlite: path.resolve(__dirname, `./prisma/test${process.env.VITEST_POOL_ID}.db`) - * mysql: `mysql://myuser:password@localhost:3306/test_database${process.env.VITEST_POOL_ID}` + * mysql: `mysql://myuser:password@localhost:3306/test_database${process.env.VITEST_POOL_ID}?timezone=Z` * pg: `postgresql://myuser:password@localhost:5432/test_database${process.env.VITEST_POOL_ID}` * ``` */ @@ -75,6 +75,7 @@ export interface Config { * user: "root", * password: "", * database: `accel_test${process.env.VITEST_POOL_ID}`, + * timezone: "Z", * } * } * ``` diff --git a/packages/accel-record/README-ja.md b/packages/accel-record/README-ja.md index a56aab31..7b6514c2 100644 --- a/packages/accel-record/README-ja.md +++ b/packages/accel-record/README-ja.md @@ -186,7 +186,7 @@ initAccelRecord(getDatabaseConfig()).then(() => { ``` ```sh -$ export DATABASE_URL="mysql://root:@localhost:3306/accel_test" +$ export DATABASE_URL="mysql://root:@localhost:3306/accel_test?timezone=Z" $ npx prisma migrate dev # tsxを使って.tsファイルを実行する例 $ npm i -D tsx @@ -854,7 +854,7 @@ beforeAll(async () => { // Vitestは通常マルチスレッドでテストが行われます。 // 各スレッドで異なるデータベースを利用するためには、VITEST_POOL_IDを利用してデータベースを分離します。 - datasourceUrl: `mysql://root:@localhost:3306/accel_test${process.env.VITEST_POOL_ID}`, + datasourceUrl: `mysql://root:@localhost:3306/accel_test${process.env.VITEST_POOL_ID}?timezone=Z`, }); // initAccelRecordでprismaDirを指定している場合、未反映のマイグレーションを実行することができます。 await Migration.migrate(); diff --git a/packages/accel-record/README.md b/packages/accel-record/README.md index ef247591..72d9c9c3 100644 --- a/packages/accel-record/README.md +++ b/packages/accel-record/README.md @@ -185,7 +185,7 @@ initAccelRecord(getDatabaseConfig()).then(() => { ``` ```sh -$ export DATABASE_URL="mysql://root:@localhost:3306/accel_test" +$ export DATABASE_URL="mysql://root:@localhost:3306/accel_test?timezone=Z" $ npx prisma migrate dev # Example of executing .ts files using tsx $ npm i -D tsx @@ -853,7 +853,7 @@ beforeAll(async () => { // Vitest usually performs tests in a multi-threaded manner. // To use different databases in each thread, separate the databases using VITEST_POOL_ID. - datasourceUrl: `mysql://root:@localhost:3306/accel_test${process.env.VITEST_POOL_ID}`, + datasourceUrl: `mysql://root:@localhost:3306/accel_test${process.env.VITEST_POOL_ID}?timezone=Z`, }); // If prismaDir is specified in initAccelRecord, you can execute pending migrations. await Migration.migrate(); diff --git a/tests/models/_types.ts b/tests/models/_types.ts index db718a9b..856e0a9f 100644 --- a/tests/models/_types.ts +++ b/tests/models/_types.ts @@ -777,7 +777,7 @@ export const dataSource = { "activeProvider": "mysql", "url": { "fromEnvVar": null, - "value": "mysql://root:@localhost:3306/accel_test1" + "value": "mysql://root:@localhost:3306/accel_test1?timezone=Z" }, "schemas": [] } as DataSource; diff --git a/tests/models/dataSource.test.ts b/tests/models/dataSource.test.ts index 0dac47f5..4adb4d71 100644 --- a/tests/models/dataSource.test.ts +++ b/tests/models/dataSource.test.ts @@ -11,7 +11,7 @@ test("dataSource", () => { activeProvider: "mysql", url: { fromEnvVar: null, - value: "mysql://root:@localhost:3306/accel_test1", + value: "mysql://root:@localhost:3306/accel_test1?timezone=Z", }, schemas: [], }); @@ -51,7 +51,7 @@ test("getDatabaseConfig()", () => { case "mysql": expect(config).toMatchObject({ type: "mysql", - datasourceUrl: "mysql://root:@localhost:3306/accel_test1", + datasourceUrl: "mysql://root:@localhost:3306/accel_test1?timezone=Z", prismaDir: new RegExp("/.+/tests/prisma_mysql"), }); break; diff --git a/tests/prisma_mysql/schema.prisma b/tests/prisma_mysql/schema.prisma index 9d8923ac..aeca0819 100644 --- a/tests/prisma_mysql/schema.prisma +++ b/tests/prisma_mysql/schema.prisma @@ -10,7 +10,7 @@ generator custom_generator { datasource db { provider = "mysql" - url = "mysql://root:@localhost:3306/accel_test1" + url = "mysql://root:@localhost:3306/accel_test1?timezone=Z" } model User {