I created a simple table:
Id serial key
material (enum) varchar255
But when Strapi goes to create the table, it added another column called “id” varchar 255, causing my server to go down.
[2022-03-20 19:45:51.139] error: create table "products" ("id" serial primary key, "id" varchar(255) null, "material" varchar(255) null, "created_at" timestamp(6) null, "updated_at" timestamp(6) null, "published_at" timestamp(6) null, "created_by_id" integer null, "updated_by_id" integer null) - column "id" specified more than once
error: create table "products" ("id" serial primary key, "id" varchar(255) null, "material" varchar(255) null, "created_at" timestamp(6) null, "updated_at" timestamp(6) null, "published_at" timestamp(6) null, "created_by_id" integer null, "updated_by_id" integer null) - column "id" specified more than once
How do I restore my server? I JUST finished spinning up a new app because the last one was corrupted when I renamed the primary key. This is the second time my app has completely broken because of primary keys.
What are the do’s and don’ts of primary keys?