You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b6af283
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/guide/database/mysql.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,13 @@ void db migrate
50
50
void deploy
51
51
```
52
52
53
-
Void generates Better Auth's date columns as `DATETIME(3)`. If your Drizzle snapshot still has them as `TIMESTAMP(3)`, `void deploy` stops on schema drift and asks you to run `void db generate` and commit the migration that converts them. Apply that migration with `void db migrate`, not `void db push`, which can offer to empty or drop auth tables. The dates keep their values, milliseconds included, when the migration connects with the same session time zone the app wrote them with.
53
+
### Auth date columns
54
+
55
+
New MySQL starters set `database.authDateType` to `"datetime"` in `void.config.ts`. Generated Better Auth columns then use `DATETIME(3)`, which supports dates before 1970, such as birthdays. Projects that omit the setting continue to generate `TIMESTAMP(3)`.
56
+
57
+
If your database already has `TIMESTAMP(3)` auth columns and you choose to switch, generate and review a migration with `void db generate`. Test it on a copy of your database and verify that stored dates, including session expirations, are preserved using the same session time zone as your app. Commit the migration and apply it with `void db migrate`.
58
+
59
+
### Applying migrations on Cloudflare
54
60
55
61
For direct Cloudflare deploys, export the production `DATABASE_URL` in the shell running `void deploy --platform cloudflare`. Void uses it to provision Hyperdrive and apply pending checked-in migrations before uploading the Worker; it is not written to the Worker config.
Copy file name to clipboardExpand all lines: docs/reference/config.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -144,7 +144,7 @@ Database backend. Omit for D1/SQLite (default). Set to `"pg"` or `"mysql"` for a
144
144
|`"pg"`| PostgreSQL via Hyperdrive; bring your own database |
145
145
|`"mysql"`| MySQL via Hyperdrive; bring your own database |
146
146
147
-
Use an object to also set how Drizzle names columns declared without a name:
147
+
Use an object to set database options:
148
148
149
149
```json
150
150
{
@@ -157,6 +157,7 @@ Use an object to also set how Drizzle names columns declared without a name:
157
157
|`dialect`|`"sqlite"` (default), `"pg"`, `"mysql"`| Database backend. `"sqlite"` is D1 |
158
158
|`casing`|`"snake_case"`, `"camelCase"`|[Drizzle casing](https://orm.drizzle.team/docs/sql-schema-declaration#camel-and-snake-casing) for `void/db` queries and `void db` commands. Omit to use each key as its column name |
159
159
|`readReplication`|`boolean` (optional) | D1 only. Enable (`true`) or disable (`false`) [read replication](../guide/database/d1.md#read-replication) on deployment. Omit to preserve existing settings; new databases default to off |
160
+
|`authDateType`|`"timestamp"`, `"datetime"`| MySQL only. Type used for generated [auth date columns](../guide/database/mysql.md#auth-date-columns). Omit to use `TIMESTAMP(3)`. New MySQL starters set `"datetime"`. |
Copy file name to clipboardExpand all lines: packages/void/schema.json
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -437,10 +437,21 @@
437
437
"readReplication": {
438
438
"type": "boolean",
439
439
"description": "Enable or disable D1 read replication during deployment. Omit to preserve existing settings; new databases default to replication off."
440
+
},
441
+
"authDateType": {
442
+
"type": "string",
443
+
"enum": ["timestamp", "datetime"],
444
+
"description": "MySQL column type for generated auth dates. Defaults to timestamp when omitted."
0 commit comments