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

Allow bigint columns in sqlite #143

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

greystare
Copy link

What is being done in this PR?

Currently, having a bigint column in a fizz file causes the migration to fail against sqlite with an error like could not call create_table function: can not use bigint as a primary key, but actually sqlite supports 8 bytes integers in its INTEGER type.

From the Sqlite docs:

INTEGER. The value is a signed integer, stored in 0, 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value.

Rails uses sqlite's integer as a subsititue for bigint in its schema convention:

Primary keys - By default, Active Record will use an integer column named id as the table's primary key (bigint for PostgreSQL and MySQL, integer for SQLite). When using Active Record Migrations to create your tables, this column will be automatically created.

What are the main choices made to get to this solution?

Rather than raising an error for bigint columns in sqlite, add an integer column, which supports 8 byte integer values.

List the manual test cases you've covered before sending this PR:

Using the soda CLI that's built with the changes in this PR, I ran a migration that creates a table with a bigint primary key in sqlite and another migration that adds a bigint column to an existing table.

@greystare greystare requested review from a team as code owners December 11, 2023 04:40
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.

1 participant