開発メモ

開発用のメモです。

MySQL 外部制約の追加 (FK)

ALTER TABLE `users` ADD CONSTRAINT FOREIGN KEY (`parent_id`)  REFERENCES `users`(`id`) ON DELETE SET NULL;
ALTER TABLE `users` ADD CONSTRAINT FOREIGN KEY (`created_id`)  REFERENCES `users`(`id`) ON DELETE SET NULL;
ALTER TABLE `users` ADD CONSTRAINT FOREIGN KEY (`modified_id`)  REFERENCES `users`(`id`) ON DELETE SET NULL;
Twitter: @asahina_alice