Dmitriy Pleshevskiy
7ae5eec2c3
I didn't know that mysql doesn't support transactional ddl. It means that we cannot create table, alter table and etc. in transaction. At the moment migra supports only postgres client, that can be use transaction for ddl.
15 lines
477 B
SQL
15 lines
477 B
SQL
-- Your SQL goes here
|
|
|
|
CREATE TABLE persons (
|
|
id SERIAL PRIMARY KEY,
|
|
email text NOT NULL UNIQUE,
|
|
display_name text NOT NULL,
|
|
created_at timestamp NOT NULL DEFAULT current_timestamp
|
|
);
|
|
|
|
/* This table doesn't exist
|
|
↓↓↓↓↓↓↓ */
|
|
ALTER TABLE recipes
|
|
ADD COLUMN author_person_id int NULL
|
|
REFERENCES persons (id) ON UPDATE CASCADE ON DELETE CASCADE;
|