I have an existing table called schools and trying to add a teachers
column as follows; however, I want to add teachers
columns right before the updated_at
column; therefore, my script is as follows. But when I run my script it does not do anything, wondering if I am doing something wrong.
ALTER TABLE schools rename to old_schools;
CREATE TABLE schools
(
user_id character varying(50) PRIMARY KEY,
status character varying(100) NOT NULL,
teachers text [] NOT NULL DEFAULT '{}'
updated_at bigint NOT NULL,
);
INSERT INTO schools
(user_id, owner_id, status, updated_at)
select user_id, owner_id, status, updated_at
from old_schools;