Skip to content

fix: replace SQLite DATETIME with PostgreSQL TIMESTAMP(3) in init migration - #1002

Open
OpensrcLord wants to merge 1 commit into
LabsCrypt:mainfrom
OpensrcLord:fix/init-migration-postgres-types
Open

fix: replace SQLite DATETIME with PostgreSQL TIMESTAMP(3) in init migration#1002
OpensrcLord wants to merge 1 commit into
LabsCrypt:mainfrom
OpensrcLord:fix/init-migration-postgres-types

Conversation

@OpensrcLord

@OpensrcLord OpensrcLord commented Jul 27, 2026

Copy link
Copy Markdown

Summary

The init migration (20260221132622_init/migration.sql) was written in SQLite DDL using DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP. Since migration_lock.toml and schema.prisma both declare provider = "postgresql", a fresh prisma migrate deploy against a PostgreSQL database fails immediately with:

type "datetime" does not exist

This blocks all table creation (User, Stream, StreamEvent) on a clean Postgres deploy.

Fix

Replaced all 5 occurrences of DATETIME with TIMESTAMP(3) in the init migration — the correct Prisma-generated column type for DateTime fields on PostgreSQL. No other columns, tables, or indexes were changed.

Changed file

  • backend/prisma/migrations/20260221132622_init/migration.sql

Verification

  • No DATETIME references remain in any migration file
  • Column types now match what Prisma generates for postgresql provider
  • Subsequent migrations (pause fields, IndexerState, unique constraint, indexes) are unaffected
  • Datasource provider remains postgresql

Fixes #828

…ration

The init migration used DATETIME (SQLite-only) which causes
prisma migrate deploy to fail on PostgreSQL with 'type datetime
does not exist'. Replace all DATETIME columns with TIMESTAMP(3)
to match the postgresql provider in migration_lock.toml and
schema.prisma.

Fixes LabsCrypt#828
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Backend] init migration uses SQLite DDL (DATETIME, inline PK) - prisma migrate deploy fails on PostgreSQL

2 participants