Migration insists on creating a primary key

Hello. I have roughly this migration

  def change do
    create table(:countries, pimary_key: false) do
      add :code, :string, size: 2, primary_key: true
      add :name, :string, null: false
    end

but this produces this sql

CREATE TABLE public.countries
(
  id integer NOT NULL DEFAULT nextval('countries_id_seq'::regclass),
  code character varying(2) NOT NULL,
  name character varying(255) NOT NULL,
  CONSTRAINT countries_pkey PRIMARY KEY (id, code)
)
WITH (
  OIDS=FALSE
);

and creates this table

                                 Table "public.countries"
 Column |          Type          |                       Modifiers                        
--------+------------------------+--------------------------------------------------------
 id     | integer                | not null default nextval('countries_id_seq'::regclass)
 code   | character varying(2)   | not null
 name   | character varying(255) | not null
Indexes:
    "countries_pkey" PRIMARY KEY, btree (id, code)

which is not my intention, I want no id column and the code column as a primary key.

You have a typo… It should be primary, not pimary

1 Like

Damn. I was fighting with this for the last 3 hours.

Sometime fresh eyes can fix it quickly :slight_smile: