PostgreSQL "type serial does not exist"
I'm getting an error when using serial and primary key. Just trying out postgres for the first time so its very possible I messed something up, the serial type works perfect on non primary key fields
7 Replies
Can you show the SQL migration that got generated?
ALTER TABLE "users" ALTER COLUMN "id" SET DATA TYPE serial;
Stack Overflow
Alter data type of a column to serial
In pgsql, is there a way to have a table of several values, and choose one of them (say, other_id), find out what its highest value is and make every new entry that is put in the table increment from
This is your problem
Can't do alter table with serial
we need to add some checks for that
I guess
I'll put it in backlog
Ahh okay that makes sense because I wiped all tables from my db and then re pushed it, and it worked after that! Thankfully I only had a few tables and had no real data yet
also I suggest to use push only for local development, where you are fine with data truncation
for all production cases please use generate command(you are free to modify sql files with migrations if needed)