Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Migration_Add_f_k_user_friends extends CI_Migration {
- public function __construct()
- {
- $this->load->database();
- }
- public function up() {
- $this->db->query('ALTER TABLE friends
- ADD CONSTRAINT fk_UserFriends
- FOREIGN KEY (user_id)
- REFERENCES user(id)');
- $this->db->query('ALTER TABLE friends
- ADD CONSTRAINT fk_FriendsUser
- FOREIGN KEY (friend_id)
- REFERENCES user(id)');
- }
- public function down() {
- $this->db->query('ALTER TABLE friends
- DROP FOREIGN KEY fk_UserFriends');
- $this->db->query('ALTER TABLE friends
- DROP FOREIGN KEY fk_FriendsUser');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement