-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
534 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,30 @@ | ||
## DBのマイグレーションを作成する | ||
開発時にDrizzleのスキーマの変更が生じた場合は、\ | ||
以下のコマンドを実行してDBのマイグレーションを作成・適用してください。 | ||
## 開発時: DBをリセットする | ||
現在あるDBを削除し、DBをマイグレーションが適用された状態まで進めます。 | ||
``` | ||
pnpm migration:generate --name [このマイグレーションの名前] | ||
pnpm migration:apply | ||
pnpm db:reset | ||
``` | ||
|
||
例: | ||
まだマイグレーションが作成されていないスキーマの変更をDBに適用します。\ | ||
マイグレーションとスキーマが同じ状態であればこの操作は必要ありません。 | ||
``` | ||
pnpm migration:generate --name honi | ||
pnpm migration:apply | ||
pnpm db:push | ||
``` | ||
|
||
DBに初期データを作成します。 | ||
``` | ||
pnpm db:seed | ||
``` | ||
|
||
## 開発時: スキーマ変更を適用する | ||
開発時は、基本的にマイグレーションの作成を行わず、 | ||
DBのスキーマ変更だけを行います。 | ||
``` | ||
pnpm db:push | ||
``` | ||
|
||
## マイグレーションの作成 | ||
DBに適用するスキーマの変更が確定したら、マイグレーションを作成します。 | ||
``` | ||
pnpm db:push | ||
pnpm db:create-migration | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
backend/prisma/migrations/20240907002954_relations/migration.sql
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.