Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

site: 'timestamp' instead of 'text' on migration example #746

Closed
wants to merge 2 commits into from

Conversation

endel
Copy link

@endel endel commented Oct 25, 2023

Small update on the SQLite migration example from the website: https://kysely.dev/docs/migrations#sqlite-migration-example

Replace this:

    .addColumn('created_at', 'text', (col) =>
      col.defaultTo(sql`CURRENT_TIMESTAMP`).notNull()
    )

With this:

    .addColumn('created_at', 'timestamp', (col) =>
      col.defaultTo(sql`CURRENT_TIMESTAMP`).notNull()
    )

@vercel
Copy link

vercel bot commented Oct 25, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
kysely ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 4, 2023 10:41pm

@igalklebanov igalklebanov added the documentation Improvements or additions to documentation label Nov 4, 2023
@igalklebanov
Copy link
Member

igalklebanov commented Nov 4, 2023

Hey 👋

Thank you! 💪

I'm not quite sure this should be encouraged:

a. there is no timestamp data type in sqlite.
b. timestamp has affinity type numeric (not documented), and numeric can store any data type (source). so having text there instead should be safer?

@igalklebanov igalklebanov added sqlite Related to sqlite migrations Related to migrations labels Nov 4, 2023
@endel
Copy link
Author

endel commented Nov 6, 2023

Wow, thank you for the explanation and for sharing the article 🤯 Closing...

@endel endel closed this Nov 6, 2023
@endel endel deleted the migrations-sqlite-timestamp branch November 6, 2023 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation migrations Related to migrations sqlite Related to sqlite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants