Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
Тогда у нас получится ситуация, когда часть изменений будет сделана, а часть нет.
postgres=# begin;
BEGIN
postgres=# create table test(id serial, name varchar);
NOTICE: CREATE TABLE will create implicit sequence «test_id_seq» for serial column «test.id»
CREATE TABLE
postgres=# insert into test(name) values('foo');
INSERT 0 1
postgres=# insert into test(name) values('bar');
INSERT 0 1
postgres=# select * from test;
id | name
----+------
1 | foo
2 | bar
(2 rows)
postgres=# rollback;
ROLLBACK
postgres=# select * from test;
ERROR: relation «test» does not exist
postgres=# create table test(id serial, name varchar);
NOTICE: CREATE TABLE will create implicit sequence «test_id_seq» for serial column «test.id»
CREATE TABLE
postgres=# begin;
BEGIN
postgres=# alter table test drop column name;
ALTER TABLE
postgres=# select * from test;
id
— (0 rows)
postgres=# rollback;
ROLLBACK
postgres=# select * from test;
id | name
----+------
(0 rows)
Doctrine: Опыт работы с миграциями в symfony