4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

記事投稿キャンペーン 「2024年!初アウトプットをしよう」

【備忘録】Supabaseでcreated_atを日本時間にする

Last updated at Posted at 2024-01-11

Supabaseを使ってcreated_atを日本時間にする

きかっけ

prismaを使ってschemaでcreated_atしたら日本時間じゃなかった

したこと

timezoneをAsia/Tokyoに変更

-- SQL Editorで
alter database postgres
set timezone to 'Asia/Tokyo';

Supabaseもしくはschemaで変更

Supabase

スクリーンショット 2024-01-11 204759.png
DefaultValueをCURRENT_TIMESTAP

prisma

schema.prisma
model ◯◯◯{
// それぞれのカラム
  createAt DateTime  @default(now()) @map("created_at") @db.Timestamptz()
}
terminal
npx prisma migrate dev

参考

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?