question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sqlite Identity column is required to be int32

See original GitHub issue

Describe the bug

Sqlite code generator seems to require that Identity column must be Int32 - in which case it will be defined as autoincrement. I can’t find any reason for this in the documentation. In fact, the sqlite doc says that primary autoincrement key will be mapped to the hidden ROWID column, which is 64 bit. So there is no reason that the code generator shouldn’t accept Int64 at least. The relevant code line:

https://github.com/fluentmigrator/fluentmigrator/blob/9c87d698b161b3a1bb596a5624c02891a64459c5/src/FluentMigrator.Runner.SQLite/Generators/SQLite/SQLiteColumn.cs#L34

Sqlite doc:

https://sqlite.org/autoinc.html

To Reproduce In a migration define a column like this:

        this.Create.Table("TestTable")
            .WithColumn("Id").AsInt64().PrimaryKey().Identity()

And run a migration for Sqlite

Expected behavior

New table successfully generated.

Information (please complete the following information):

  • OS: Ubuntu 20.04
  • Platform .net5
  • FluentMigrator version latest
  • FluentMigrator runner [ FluentMigrator.Console ]
  • Database Management System [ SQLite ]
  • Database Management System Version [ N/A ]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
zelenijcommented, Apr 20, 2021

I’ll be happy to create a PR to address this problem.

0reactions
zelenijcommented, Jul 16, 2021

It’s not too urgent for me, so feel free to overhaul…

Read more comments on GitHub >

github_iconTop Results From Across the Web

SQLite Autoincrement
1. Summary · The AUTOINCREMENT keyword imposes extra CPU, memory, disk space, and disk I/O overhead and should be avoided if not strictly...
Read more >
Understanding the SQLite AUTOINCREMENT
The main purpose of using attribute AUTOINCREMENT is to prevent SQLite to reuse a value that has not been used or a value...
Read more >
How to create Autoincrement column in SQLite using EF ...
NET Standard app. My model has an entity of type Primary Key integer which should be served as auto increment according to SQLite...
Read more >
SQLite - AUTOINCREMENT
SQLite AUTOINCREMENT is a keyword used for auto incrementing a value of a field in the table. We can auto increment a field...
Read more >
Is it good practice to always have an autoincrement integer ...
I usually use an "identity" column (auto-incremennting integer) when defining new tables for "long-lived" data (records I expect to insert once ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found