Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть Part 2: Update table with Migration - Laravel 5.6 Migrations

  • Stack Developers
  • 2018-03-25
  • 6118
Part 2: Update table with Migration - Laravel 5.6 Migrations
  • ok logo

Скачать Part 2: Update table with Migration - Laravel 5.6 Migrations бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно Part 2: Update table with Migration - Laravel 5.6 Migrations или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку Part 2: Update table with Migration - Laravel 5.6 Migrations бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео Part 2: Update table with Migration - Laravel 5.6 Migrations

Previous Video | Migrations Part 1:    • Part 1: Create table with Migration - Lara...  

Most of the time, we require to update the table like adding new columns to the table, update the existing one, increase or decrease the data type length or change the data type itself or add null to column, make any column auto increment and so on. So all we can do easily with Migrations.

So first of all, we will add column to our existing table 'members'. Like if we want to add state column to our members table then we need to take following steps :-

Run below command :-

php artisan make:migration add_state_to_members

This command will create migration file of add_state_to_members name in which we are going to add "state" column that we want to add. By default, our column will be added at the end if we don't pass any option to it.

See in video, our file has been created. Now we will make changes to add state column to members table.

See now in up function, we have added state column as data type 'string' and drop function as well we have modified.

Now we will run "php artisan migrate" command again to check if state column added.

See in video, our state column has been added at last.

Now suppose if we want to add multiple columns "city" and "state" and also we want to add them after some particular column like "address" column then with few additional options, we can able to do all this. For adding after or before some particular column, we can use after or before option with string. And also we can specify the length of the data type like we can specify 100 length to string.

We can follow Laravel Migrations website for it. Check Available Column Types and Column Modifiers and you can experiment with all commands.

Ok now we will add multiple columns city and state after address. But first we will rollback our changes done so far. Rollback is the another command which rollback the changes to the last stage. Like if we give "php artisan migrate:rollback" command, it will rollback to the last point changes. So lets do it.

See now our earlier table without state has come back.

Also remove add_state_to_members file from migrations folder as we don't need it for now.

We will create new file like add_columns_to_members in which we will add multiple columns city and state.

We will run below command now :-

php artisan make:migration add_columns_to_members

See now in video, we have added now "state" and "city" columns after "address" column by using "after" option. After some changes, We have added City after address and State after City.

Also check their data types with length 100 and 150. Like this we can try other options as well and all the changes in your tables we can do with Migrations only.

We can follow below Laravel link to experiment with more options :-
https://laravel.com/docs/5.6/migrations

In the next video, we will try adding data to our table with Migrations. So stay tune for our next video..

Thanks for watching :)

Next Video | Migrations Part 3:    • Part 3: Insert data in table with Migratio...  

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]