jmafc/Pyrseas — Issue #8: faled to rename colums
Author: melezhik
Created: 2011-10-17 11:03:48+00:00
State: open

`cat schema.yaml`

schema public:
description: standard public schema
table t1:
columns:
- c1:
not_null: true
type: integer
- c2:
type: smallint
- c3:
default: 'false'
type: boolean
- c4:
type: text
foreign_keys:
t1_c2_fkey:
columns:
- c2
references:
columns:
- c21
schema: s1
table: t2
primary_key:
t1_pkey:
access_method: btree
columns:
- c1
schema s1:
table t2:
columns:
- c21:
not_null: true
type: integer
- c22:
type: character varying(16)
primary_key:
t2_pkey:
access_method: btree
columns:
- c21

---

`yamltodb -H melezhik.x --user test -1 test test.yml | psql --user=test -h melezhik.x test`

BEGIN
CREATE SCHEMA
CREATE TABLE
CREATE TABLE
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "t2_pkey" for table "t2"
ALTER TABLE
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "t1_pkey" for table "t1"
ALTER TABLE
ALTER TABLE
COMMIT

`alter table t1 rename column c4 to cc4;`
`yamltodb -H melezhik.x --user test -1 test test.yml`

BEGIN;
ALTER TABLE t1 DROP COLUMN cc4;
COMMIT;

which is wrong, because only drop column cc4, but also has to create column c4!