lundi 30 janvier 2017

Adding a column with foreign key

My existing table is like below

Story
-------------------------------
| id | name | author_id | date |

Now I want to add one more foreign key column created_by how to add this without deleting the existing data. The existing data foreign key must be the admin id.

From this question I understood how to add a column without deleting all the existing data.

How to add column in a table using laravel 5 migration without losing the data in the table?

I want to do this modification in my PC, test machine, live server. So I have to add the foreign key and also I have to find out the admin id from users table and assign to it. How to do this?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2jOorit
via IFTTT

Aucun commentaire:

Enregistrer un commentaire