The Ecto migration’s documentation about primary keys states:
By default, all :identity column will be bigints. You may provide optional
parameters for:start_value
and:increment
to customize the created
sequence. Config example:
config :app, App.Repo, migration_primary_key: [type: :identity]
However, when I define a table like this:
create table(:sample_type, primary_key: false) do
add :type, :bigserial, primary_key: true
add :name, :string
end
and in the config set:
config :myapp, MyApp.Repo,
migration_primary_key: [start_value: 1, increment: 1000],
migration_timestamps: [type: :utc_datetime]
it doesn’t seem to customize the sequence for the primary key with the start_value
and increment
.
Defining the primary key this way doesn’t help either:
create table(:sample_type, primary_key: false) do
add :type, :bigserial, primary_key: true, start_value: 1, increment: 1000
add :name, :string
Diving into the code reveals that those options are documented but not implemented. Am I looking in the wrong place? I can think of a workaround with altering the sequence after creation, but it appears a bit odd that the feature is documented but not implemented.