Changing field type in production

1
2
3
4
5
6
7
begin;
alter table web_child add column strnum varchar(10);
update web_child set strnum = to_char(schoolstd,'999');
alter table web_child alter column strnum set not null;
alter table web_child drop column schoolstd;
alter table web_child rename column strnum to schoolstd;
commit;

More like this

  1. Simple solution for model schema evolution / database changelog by kahless 5 years, 11 months ago
  2. PostgreSQL fulltext with language translations by diverman 2 years, 9 months ago
  3. Command to dump data as a python script by willhardy 4 years, 11 months ago
  4. automating twitter by lawgon 3 years, 10 months ago
  5. Dynamic Models Revisited by Ben 5 years, 7 months ago

Comments

(Forgotten your password?)