<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Migration &#8211; The Eternal Path</title>
	<atom:link href="https://arasan.de/tag/migration/feed/" rel="self" type="application/rss+xml" />
	<link>https://arasan.de</link>
	<description>Arasan.de</description>
	<lastBuildDate>Sun, 11 Sep 2022 15:42:35 +0000</lastBuildDate>
	<language>de</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.2</generator>

<image>
	<url>https://arasan.de/wp-content/uploads/2024/10/triquetra-512x512-1.png</url>
	<title>Migration &#8211; The Eternal Path</title>
	<link>https://arasan.de</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Laravel TodoApp &#8211; Nur eigene Todos anzeigen und bearbeiten</title>
		<link>https://arasan.de/laravel-todoapp-nur-eigene-todos-anzeigen-und-bearbeiten/</link>
		
		<dc:creator><![CDATA[«Æ»]]></dc:creator>
		<pubDate>Sun, 11 Sep 2022 15:40:26 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Migration]]></category>
		<category><![CDATA[Tabelle]]></category>
		<category><![CDATA[TodoApp]]></category>
		<guid isPermaLink="false">https://arasan.de/?p=500</guid>

					<description><![CDATA[In diesem Schritt erweitern wir unseren Quelltext so, dass nur eigene Todo ListItems angezeigt und bearbeitet werden können.Dazu erstellen wir zuerst eine Migration für die ListItem-Tabelle &#8211; hier erweitern wir die Spalte &#8222;user_id&#8220;.In dieser Spalte wird unsere aktuelle UserId gesichert, wenn ein Todo ListItem angelegt wird. Nach Anlegen der Migration lassen wir diesen Code laufen&#8230;]]></description>
										<content:encoded><![CDATA[<ol style="margin: 20px"><li><a href="https://arasan.de/laravel-projekt-mit-git-github-erstellen/">Laravel TodoApp &#8211; Projekt mit Git + Github erstellen</a></li><li><a href="https://arasan.de/laravel-view-blade-template-in-atom-editor-bearbeiten/">Laravel TodoApp &#8211; View (Blade Template) in Atom Editor bearbeiten:</a></li><li><a href="https://arasan.de/laravel-mysql-datenbank-verbindung-konfigurieren/">Laravel TodoApp &#8211; MySQL Datenbank-Verbindung konfigurieren</a></li><li><a href="https://arasan.de/laravel-todoapp-model-migration-erstellen/">Laravel TodoApp &#8211; Model + Migration erstellen</a></li><li><a href="https://arasan.de/laravel-todoapp-listitem-form-route-controller-erstellen/">Laravel TodoApp &#8211; ListItem Form + Route + Controller erstellen</a></li><li><a href="https://arasan.de/laravel-todoapp-formulardaten-in-logdatei-ausgeben/">Laravel TodoApp &#8211; Formulardaten in Logdatei ausgeben</a></li><li><a href="https://arasan.de/laravel-todoapp-formulardaten-in-tabelle-speichern/">Laravel TodoApp &#8211; Formulardaten in Tabelle speichern</a></li><li><a href="https://arasan.de/laravel-todoapp-listitems-aus-tabelle-ausgeben/">Laravel TodoApp &#8211; ListItems aus Tabelle ausgeben</a></li><li><a href="https://arasan.de/laravel-todoapp-todo-listitem-als-erledigt-markieren/">Laravel TodoApp &#8211; Todo ListItem als erledigt markieren</a></li><li><a href="https://arasan.de/laravel-todoapp-layout-erstellen/">Laravel TodoApp &#8211; Layout erstellen</a></li><li><a href="https://arasan.de/laravel-todoapp-bootstrap-hinzufuegen/">Laravel TodoApp &#8211; Bootstrap hinzufügen</a></li><li><a href="https://arasan.de/laravel-todoapp-welcome-blade-template-umbenennen-in-todos/">Laravel TodoApp &#8211; Welcome Blade Template umbenennen in Todos</a></li><li><a href="https://arasan.de/laravel-todoapp-todo-nur-eintragen-wenn-user-angemeldet/">Laravel TodoApp &#8211; Todo nur eintragen wenn User angemeldet</a></li><li>Laravel TodoApp &#8211; Nur eigene Todos anzeigen und bearbeiten</li></ol>



<p class="wp-block-paragraph">In diesem Schritt erweitern wir unseren Quelltext so, dass nur eigene Todo ListItems angezeigt und bearbeitet werden können.<br>Dazu erstellen wir zuerst eine Migration für die ListItem-Tabelle &#8211; hier erweitern wir die Spalte &#8222;user_id&#8220;.<br>In dieser Spalte wird unsere aktuelle UserId gesichert, wenn ein Todo ListItem angelegt wird.</p>



<pre class="wp-block-code"><code>php artisan make:migration add_list_items_user_id</code></pre>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="1816" height="316" src="https://arasan.de/wp-content/uploads/2022/09/laravel-todoapp-listitem-nur-fuer-aktuellen-user-migration-add-listitems-user_id.png" alt="" class="wp-image-502"/></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="2704" height="1632" src="https://arasan.de/wp-content/uploads/2022/09/laravel-todoapp-listitem-nur-fuer-aktuellen-user-migration-schema-up-down.png" alt="" class="wp-image-506"/></figure>



<p class="wp-block-paragraph">Nach Anlegen der Migration lassen wir diesen Code laufen mit:</p>



<pre class="wp-block-code"><code>php artisan migrate</code></pre>



<figure class="wp-block-image size-full"><img decoding="async" width="1820" height="344" src="https://arasan.de/wp-content/uploads/2022/09/laravel-todoapp-listitem-nur-fuer-aktuellen-user-migrate.png" alt="" class="wp-image-503"/></figure>



<p class="wp-block-paragraph">Nach Hinzufügen der neuen Tabellenspalte sieht die Tabelle &#8222;list_items&#8220; wie folgt aus (user_id ist bereits bei einigen list_items von Hand geändert worden):</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1954" height="554" src="https://arasan.de/wp-content/uploads/2022/09/laravel-todoapp-listitem-nur-fuer-aktuellen-user-tabelle-list_items-tableplus.png" alt="" class="wp-image-504"/></figure>



<p class="wp-block-paragraph">Damit nur die ListItems angezeigt werden, die dem aktuellen User gehören, müssen wir das User Model, das ListItem Model und den TodoListController anpassen:</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2714" height="1630" src="https://arasan.de/wp-content/uploads/2022/09/laravel-todoapp-listitem-nur-fuer-aktuellen-user-model-listitem-belongsto-user.png" alt="" class="wp-image-508"/></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2712" height="1634" src="https://arasan.de/wp-content/uploads/2022/09/laravel-todoapp-listitem-nur-fuer-aktuellen-user-model-user-hasmany-listitems.png" alt="" class="wp-image-509"/></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2706" height="1636" src="https://arasan.de/wp-content/uploads/2022/09/laravel-todoapp-listitem-nur-fuer-aktuellen-user-todolistcontroller-index-listitems-von-aktuellem-user.png" alt="" class="wp-image-510"/></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2708" height="1628" src="https://arasan.de/wp-content/uploads/2022/09/laravel-todoapp-listitem-nur-fuer-aktuellen-user-todolistcontroller-saveItem-mit-aktuellem-user.png" alt="" class="wp-image-511"/></figure>



<p class="wp-block-paragraph">Jetzt werden nur die Todo ListItems von dem aktuell angemeldeten User angezeigt. Wenn ein neues Todo ListItem erzeugt wird, wird automatisch die aktuelle UserId gesetzt.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Laravel TodoApp &#8211; Model + Migration erstellen</title>
		<link>https://arasan.de/laravel-todoapp-model-migration-erstellen/</link>
		
		<dc:creator><![CDATA[«Æ»]]></dc:creator>
		<pubDate>Thu, 08 Sep 2022 15:21:02 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Migration]]></category>
		<category><![CDATA[Model]]></category>
		<category><![CDATA[TodoApp]]></category>
		<guid isPermaLink="false">https://arasan.de/?p=340</guid>

					<description><![CDATA[Nach Einrichtung der MySQL Datenbank-Verbindung zum MySQL Server können wir ein Model und die zugehörige Migration für die Tabelle erstellen. Wenn das Model und die Migration erstellt sind, können wir die Migration laufen lassen, damit die Tabellen in der MyQL Datenbank erstellt werden: Die Migrations sind erfolgreich durchgelaufen &#8211; wir können die erstellten Tabellen z.B.&#8230;]]></description>
										<content:encoded><![CDATA[<ol style="margin: 20px"><li><a href="https://arasan.de/laravel-projekt-mit-git-github-erstellen/">Laravel TodoApp &#8211; Projekt mit Git + Github erstellen</a></li><li><a href="https://arasan.de/laravel-view-blade-template-in-atom-editor-bearbeiten/">Laravel TodoApp &#8211; View (Blade Template) in Atom Editor bearbeiten:</a></li><li><a href="https://arasan.de/laravel-mysql-datenbank-verbindung-konfigurieren/">Laravel TodoApp &#8211; MySQL Datenbank-Verbindung konfigurieren</a></li><li>Laravel TodoApp &#8211; Model + Migration erstellen</li><li><a href="https://arasan.de/laravel-todoapp-listitem-form-route-controller-erstellen/">Laravel TodoApp &#8211; ListItem Form + Route + Controller erstellen</a></li><li><a href="https://arasan.de/laravel-todoapp-formulardaten-in-logdatei-ausgeben/">Laravel TodoApp &#8211; Formulardaten in Logdatei ausgeben</a></li><li><a href="https://arasan.de/laravel-todoapp-formulardaten-in-tabelle-speichern/">Laravel TodoApp &#8211; Formulardaten in Tabelle speichern</a></li><li><a href="https://arasan.de/laravel-todoapp-listitems-aus-tabelle-ausgeben/">Laravel TodoApp &#8211; ListItems aus Tabelle ausgeben</a></li><li><a href="https://arasan.de/laravel-todoapp-todo-listitem-als-erledigt-markieren/">Laravel TodoApp &#8211; Todo ListItem als erledigt markieren</a></li><li><a href="https://arasan.de/laravel-todoapp-layout-erstellen/">Laravel TodoApp &#8211; Layout erstellen</a></li><li><a href="https://arasan.de/laravel-todoapp-bootstrap-hinzufuegen/">Laravel TodoApp &#8211; Bootstrap hinzufügen</a></li><li><a href="https://arasan.de/laravel-todoapp-welcome-blade-template-umbenennen-in-todos/">Laravel TodoApp &#8211; Welcome Blade Template umbenennen in Todos</a></li><li><a href="https://arasan.de/laravel-todoapp-todo-nur-eintragen-wenn-user-angemeldet/">Laravel TodoApp &#8211; Todo nur eintragen wenn User angemeldet</a></li><li><a href="https://arasan.de/laravel-todoapp-nur-eigene-todos-anzeigen-und-bearbeiten/">Laravel TodoApp &#8211; Nur eigene Todos anzeigen und bearbeiten</a></li></ol>



<p class="wp-block-paragraph">Nach Einrichtung der <a href="https://arasan.de/laravel-mysql-datenbank-verbindung-konfigurieren/" data-type="post" data-id="335">MySQL Datenbank-Verbindung zum MySQL Server</a> können wir ein Model und die zugehörige Migration für die Tabelle erstellen.</p>



<pre class="wp-block-code"><code>php artisan make:model ListItem -m</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1832" height="1276" src="https://arasan.de/wp-content/uploads/2022/09/laravel-todoapp-db-model-migration-erstellen.png" alt="" class="wp-image-342"/></figure>



<p class="wp-block-paragraph">Wenn das Model und die Migration erstellt sind, können wir die Migration laufen lassen, damit die Tabellen in der MyQL Datenbank erstellt werden:</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1812" height="1250" src="https://arasan.de/wp-content/uploads/2022/09/laravel-todoapp-migrate-1.png" alt="" class="wp-image-344"/></figure>



<p class="wp-block-paragraph">Die Migrations sind erfolgreich durchgelaufen &#8211; wir können die erstellten Tabellen z.B. in <a href="https://www.tableplus.com">TablePlus</a> anschauen:</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1976" height="1308" src="https://arasan.de/wp-content/uploads/2022/09/laravel-todoapp-erstellte-mysql-tabellen-in-tableplus-anschauen.png" alt="" class="wp-image-349"/></figure>



<p class="wp-block-paragraph">Wir erstellen eine weitere Migration und führen sie aus, um neue Spalten zur ListItem Tabelle hinzuzufügen:</p>



<pre class="wp-block-code"><code>php artisan make:migration list_item_name_is_complete</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1818" height="162" src="https://arasan.de/wp-content/uploads/2022/09/laravel-todoapp-migration-erstellen-spalte-name-is_complete.png" alt="" class="wp-image-352"/></figure>



<pre class="wp-block-code"><code>php artisan migrate</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1826" height="378" src="https://arasan.de/wp-content/uploads/2022/09/laravel-todoapp-migration-ausfuehren-spalte-name-is_complete.png" alt="" class="wp-image-353"/></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1980" height="550" src="https://arasan.de/wp-content/uploads/2022/09/laravel-todoapp-tabelle-list_items-in-tableplus-ansehen.png" alt="" class="wp-image-354"/></figure>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
