<?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>laravel migrations Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/laravel-migrations/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/laravel-migrations/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Thu, 11 Mar 2021 12:41:56 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Creating tables in Migration</title>
		<link>https://www.scmgalaxy.com/tutorials/creating-tables-in-migration/</link>
					<comments>https://www.scmgalaxy.com/tutorials/creating-tables-in-migration/#respond</comments>
		
		<dc:creator><![CDATA[Joydeep M]]></dc:creator>
		<pubDate>Thu, 11 Mar 2021 12:41:56 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[laravel]]></category>
		<category><![CDATA[laravel database]]></category>
		<category><![CDATA[laravel migrations]]></category>
		<category><![CDATA[laravel project]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=5496</guid>

					<description><![CDATA[<p>In Laravel to create a new database table first of all we need to make a migration which we have [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/creating-tables-in-migration/">Creating tables in Migration</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">In Laravel to create a new database table first of all we need to make a migration which we have explained in the previous blog. I recommend you to read that blog, you can refer the link given below:</p>



<p class="wp-block-paragraph"><br><a href="https://www.scmgalaxy.com/tutorials/explanation-of-database-migrations-in-laravel-5-8/">https://www.scmgalaxy.com/tutorials/explanation-of-database-migrations-in-laravel-5-8/</a></p>



<p class="wp-block-paragraph">Once we are done with creating a migration file, to create a new database<br>table we have to use the create method on the Schema facade. The create method accepts two arguments:-</p>



<p class="wp-block-paragraph">The first is the name of the table, while the second is a closure which receives a Blueprint object that may be used to define the new table:</p>



<pre class="wp-block-code"><code>use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

Schema::create('users', function (Blueprint $table) {
    $table->id();
    $table->string('name');
    $table->string('email');
    $table->timestamps();
});</code></pre>



<p class="wp-block-paragraph">In the table we can add number of $table as per our requirement. There are several data type which we can use while creating the $table. Few of them are given below:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow" id="column-method-bigIncrements"><p><code>bigIncrements()</code></p></blockquote>



<p class="wp-block-paragraph">The&nbsp;<code>bigIncrements</code>&nbsp;method creates an auto-incrementing&nbsp;<code>UNSIGNED BIGINT</code>&nbsp;(primary key) equivalent column:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
$table-&gt;bigIncrements(&#039;id&#039;);
</pre></div>


<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow" id="column-method-bigInteger"><p><code>bigInteger()</code></p></blockquote>



<p class="wp-block-paragraph">The&nbsp;<code>bigInteger</code>&nbsp;method creates a&nbsp;<code>BIGINT</code>&nbsp;equivalent column:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
$table-&gt;bigInteger(&#039;votes&#039;);
</pre></div>


<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow" id="column-method-id"><p><code>id()</code></p></blockquote>



<p class="wp-block-paragraph">The&nbsp;<code>id</code>&nbsp;method is an alias of the&nbsp;<code>bigIncrements</code>&nbsp;method. By default, the method will create an&nbsp;<code>id</code>&nbsp;column; however, you may pass a column name if you would like to assign a different name to the column:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
$table-&gt;id();
</pre></div>


<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow" id="column-method-rememberToken"><p><code>rememberToken()</code></p></blockquote>



<p class="wp-block-paragraph">The&nbsp;<code>rememberToken</code>&nbsp;method creates a nullable,&nbsp;<code>VARCHAR(100)</code>&nbsp;equivalent column that is intended to store the current &#8220;remember me&#8221;&nbsp;<a href="https://laravel.com/docs/8.x/authentication#remembering-users">authentication token</a>:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
$table-&gt;rememberToken();
</pre></div>


<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow" id="column-method-string"><p><code>string()</code></p></blockquote>



<p class="wp-block-paragraph">The&nbsp;<code>string</code>&nbsp;method creates a&nbsp;<code>VARCHAR</code>&nbsp;equivalent column of the given length:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
$table-&gt;string(&#039;name&#039;, 100);
</pre></div>


<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow" id="column-method-text"><p><code>text()</code></p></blockquote>



<p class="wp-block-paragraph">The&nbsp;<code>text</code>&nbsp;method creates a&nbsp;<code>TEXT</code>&nbsp;equivalent column:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
$table-&gt;text(&#039;description&#039;);
</pre></div>


<p class="wp-block-paragraph">To know more about creating tables and adding columns, you can refer the video given below:</p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe  id="_ytid_65460"  width="640" height="360"  data-origwidth="640" data-origheight="360" src="https://www.youtube.com/embed/pd99VUe7b0o?enablejsapi=1&#038;list=PLT9miexWCpPXuMenRSnpek96ncK3dXf90&#038;index=13&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;" class="__youtube_prefs__  epyt-is-override  no-lazyload" title="YouTube player"  allow="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen data-no-lazy="1" data-skipgform_ajax_framebjll=""></iframe>
</div></figure>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/creating-tables-in-migration/">Creating tables in Migration</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/creating-tables-in-migration/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
