Skip to content

Commit

Permalink
primary autoincrement key as bigserial
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfDan committed Apr 12, 2021
1 parent 8637891 commit 71c0877
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/migration_generator/operation.ex
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ defmodule AshPostgres.MigrationGenerator.Operation do
def up(%{attribute: %{type: :integer, default: "nil", generated?: true} = attribute}) do
[
"add #{inspect(attribute.name)}",
":serial",
":bigserial",
maybe_add_null(attribute.allow_nil?),
maybe_add_primary_key(attribute.primary_key?)
]
Expand Down
4 changes: 2 additions & 2 deletions test/migration_generator_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -411,11 +411,11 @@ defmodule AshPostgres.MigrationGeneratorTest do
:ok
end

test "when an integer is generated and default nil, it is a serial" do
test "when an integer is generated and default nil, it is a bigserial" do
assert [file] = Path.wildcard("test_migration_path/**/*_migrate_resources*.exs")

assert File.read!(file) =~
~S[add :id, :serial, null: false, primary_key: true]
~S[add :id, :bigserial, null: false, primary_key: true]

assert File.read!(file) =~
~S[add :views, :integer]
Expand Down

0 comments on commit 71c0877

Please sign in to comment.