<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Forum Pasja Informatyki - Najnowsze z tagiem migracje</title>
<link>https://forum.pasja-informatyki.pl/tag/migracje</link>
<description>Powered by Question2Answer</description>
<item>
<title>Plik konfiguracyjny .env na serwerze</title>
<link>https://forum.pasja-informatyki.pl/556600/plik-konfiguracyjny-env-na-serwerze</link>
<description>

&lt;p&gt;Po przeniesieniu projektu stworzonego w Laravel 8 pojawia się błąd
&lt;br&gt;
&amp;nbsp;&lt;/p&gt;



&lt;pre class=&quot;brush:php;&quot;&gt;
Warning: require(/home/server197773/ftp/Landing/../vendor/autoload.php): failed to open stream: No such file or directory in /home/server197773/ftp/Landing/index.php on line 34

Fatal error: require(): Failed opening required '/home/server197773/ftp/Landing/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/server197773/ftp/Landing/index.php on line 34&lt;/pre&gt;



&lt;p&gt;O co chodzi.
&lt;br&gt;
Miałem baze danych na localhost, wyexportowałem ją, przeniosłem na ftp zmieniłem w env
&lt;br&gt;
&amp;nbsp;&lt;/p&gt;



&lt;pre class=&quot;brush:php;&quot;&gt;
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=&lt;/pre&gt;



&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
<category>PHP</category>
<guid isPermaLink="true">https://forum.pasja-informatyki.pl/556600/plik-konfiguracyjny-env-na-serwerze</guid>
<pubDate>Wed, 08 Dec 2021 18:27:55 +0000</pubDate>
</item>
<item>
<title>Migracje bazy danych - podział na pliki.</title>
<link>https://forum.pasja-informatyki.pl/531956/migracje-bazy-danych-podzial-na-pliki</link>
<description>Hej,&lt;br /&gt;
&lt;br /&gt;
Czy tworząc migrację powinienem dla tworzenia każdej tabeli stworzyć odrębną migracje? Czy może tworzeniem wszystkich tabel powinna zajmować się jedna migracja np. o nazwie &amp;quot;initial&amp;quot;?</description>
<category>PHP</category>
<guid isPermaLink="true">https://forum.pasja-informatyki.pl/531956/migracje-bazy-danych-podzial-na-pliki</guid>
<pubDate>Sat, 06 Mar 2021 05:40:28 +0000</pubDate>
</item>
<item>
<title>Resetowanie bazy danych/migracji w Django</title>
<link>https://forum.pasja-informatyki.pl/507501/resetowanie-bazy-danych-migracji-w-django</link>
<description>

&lt;p&gt;Hej,
&lt;br&gt;

&lt;br&gt;
Gdy tworzę nowego użytkownika jego id rozpoczyna się od +20 numeru. Wynika to stąd, że wcześniej narobiłem tylu użytkowników przy testach. Problem w tym, że gdy ich wszystkich skasowałem, id nowo stworzonych nalicza się dalej (21, 22, 23 itd.) Usuwałem migracje, traktowałem bazę danych flushem (py manage.py flush), używałem polecenia squash, zrobiłem wiele i baz najmniejszych rezultatów.
&lt;br&gt;
&amp;nbsp;&lt;/p&gt;



&lt;pre class=&quot;brush:python;&quot;&gt;
&amp;gt;&amp;gt;&amp;gt; User.objects.get(id=0)  
[długa linia kodu która mówi, że takiego Usera nie ma]
&amp;gt;&amp;gt;&amp;gt; User.objects.get(id=24) 
&amp;lt;User: Stasiek&amp;gt;
[ten User jest pierwszy (jedyny w bazie) i winien mieć id 0]&lt;/pre&gt;



&lt;p&gt;Jestem otwarty na propozycję.&lt;/p&gt;</description>
<category>Python</category>
<guid isPermaLink="true">https://forum.pasja-informatyki.pl/507501/resetowanie-bazy-danych-migracji-w-django</guid>
<pubDate>Tue, 08 Sep 2020 21:09:07 +0000</pubDate>
</item>
<item>
<title>Laravel - błąd przy wykonywaniu migracjii</title>
<link>https://forum.pasja-informatyki.pl/460035/laravel-blad-przy-wykonywaniu-migracjii</link>
<description>

&lt;p&gt;Witam. Przy próbie wykonania migracji w frameworku Laravel (wersja 6.0.3) i bazie danych MySQL (serwis remotemysql.com) wywala mi błąd:&lt;/p&gt;



&lt;pre class=&quot;brush:plain;&quot;&gt;
Migrating: 2019_11_22_094321_add_foreign_keys

   Illuminate\Database\QueryException  : SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') default character set utf8mb4 collate 'utf8mb4_unicode_ci'' at line 1 (SQL: create table `parts` () default character set utf8mb4 collate 'utf8mb4_unicode_ci')

  at /home/kamils/php/collection/vendor/laravel/framework/src/Illuminate/Database/Connection.php:665
    661|         // If an exception occurs when attempting to run a query, we'll format the error
    662|         // message to include the bindings with SQL, which will make this exception a
    663|         // lot more helpful to the developer instead of just the database's errors.
    664|         catch (Exception $e) {
  &amp;gt; 665|             throw new QueryException(
    666|                 $query, $this-&amp;gt;prepareBindings($bindings), $e
    667|             );
    668|         }
    669| 

  Exception trace:

  1   PDOException::(&quot;SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') default character set utf8mb4 collate 'utf8mb4_unicode_ci'' at line 1&quot;)
      /home/kamils/php/collection/vendor/laravel/framework/src/Illuminate/Database/Connection.php:453

  2   PDO::prepare(&quot;create table `parts` () default character set utf8mb4 collate 'utf8mb4_unicode_ci'&quot;)
      /home/kamils/php/collection/vendor/laravel/framework/src/Illuminate/Database/Connection.php:453

  Please use the argument -v to see more details.
&lt;/pre&gt;



&lt;p&gt;A tu migracja, która wywołuje ten błąd:&amp;nbsp;&lt;/p&gt;



&lt;pre class=&quot;brush:php;&quot;&gt;
&amp;lt;?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddForeignKeys extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {

        Schema::create('parts', function (Blueprint $table) {
            $table-&amp;gt;foreign('owner')-&amp;gt;references('id')-&amp;gt;on('users')-&amp;gt;change();
        });

        Schema::create('sets', function (Blueprint $table) {
            $table-&amp;gt;foreign('owner')-&amp;gt;references('id')-&amp;gt;on('users')-&amp;gt;change();
        });

        Schema::create('images', function (Blueprint $table) {
            $table-&amp;gt;foreign('partId')-&amp;gt;references('id')-&amp;gt;on('parts')-&amp;gt;change();
            $table-&amp;gt;foreign('setId')-&amp;gt;references('id')-&amp;gt;on('sets')-&amp;gt;change();
        });
        Schema::table('features', function (Blueprint $table){
            $table-&amp;gt;foreign('featureType')-&amp;gt;references('id')-&amp;gt;on('feature_types')-&amp;gt;change();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
&lt;/pre&gt;



&lt;p&gt;Proszę o pomoc, googlowanie i samodzielne próby tylko pogarszały sprawę :/&lt;/p&gt;</description>
<category>PHP</category>
<guid isPermaLink="true">https://forum.pasja-informatyki.pl/460035/laravel-blad-przy-wykonywaniu-migracjii</guid>
<pubDate>Mon, 25 Nov 2019 19:43:26 +0000</pubDate>
</item>
<item>
<title>Czy warto tworzyć relacje na poziomie bazy danych podczas tworzenie migracji w Laravelu</title>
<link>https://forum.pasja-informatyki.pl/395651/czy-warto-tworzyc-relacje-poziomie-bazy-danych-podczas-tworzenie-migracji-laravelu</link>
<description>Czy podczas tworzenia migracji w Laravelu powinienem tworzyć relacje na poziomie bazy danych czy nie jest to konieczne, jakie korzyści niesie takie rozwiązanie ?</description>
<category>PHP</category>
<guid isPermaLink="true">https://forum.pasja-informatyki.pl/395651/czy-warto-tworzyc-relacje-poziomie-bazy-danych-podczas-tworzenie-migracji-laravelu</guid>
<pubDate>Fri, 23 Nov 2018 17:49:55 +0000</pubDate>
</item>
<item>
<title>Laravel relacja jeden do wielu - odwołanie do nieistniejącego pola</title>
<link>https://forum.pasja-informatyki.pl/368163/laravel-relacja-jeden-do-wielu-odwolanie-do-nieistniejacego-pola</link>
<description>

&lt;p&gt;Witam!&lt;/p&gt;



&lt;p&gt;O czym ja zapominam robiąc migracje w Lavarelu że raz relacje działają mi tak a raz tak ? Przedstawiając to co chcę uzyskać to chcę przypisać użytkownikowi jego zamówienia a zamówieniu produkty jakie zamówił. Więc mam tabelę User tabelę Order i tabelę OrderProduct. Tabela Usera z relacją jeden do wielu z tabelą Order, tabela Order z relacją jeden do wielu z tabelą OrderProduct. Zaczynając od relacji Order i OrderProduct wyskakuje mi błąd:&lt;/p&gt;



&lt;blockquote&gt;


&lt;p&gt;SQLSTATE[42S22]: Column not found: 1054 Unknown column 'order_products_tables.order_table_id' in 'where clause' (SQL: select * from `order_products_tables` where `order_products_tables`.`order_table_id` = 1 and `order_products_tables`.`order_table_id` is not null)&lt;/p&gt;
&lt;/blockquote&gt;



&lt;p&gt;I ten błąd mówi jasno i wyraźnie że nie może znaleźć kolumny &lt;strong&gt;order_table_id&lt;/strong&gt; w tabeli &lt;strong&gt;order_products_tables&lt;/strong&gt; i się nie dziwię co może teraz głupio zabrzmieć bo takiego pola nie ma ale jest pole &lt;strong&gt;order_id &lt;/strong&gt;i w migracjach jest opisane z którym polem jest relacja i nie mogę zrozumieć dlaczego Laravel stara się odwoływać do &lt;strong&gt;order_products_tables.&lt;/strong&gt;&lt;/p&gt;



&lt;p&gt;Migracje &lt;strong&gt;Order&lt;/strong&gt;:&lt;/p&gt;



&lt;pre class=&quot;brush:php;&quot;&gt;
        Schema::create('order_tables', function (Blueprint $table) {
            $table-&amp;gt;increments('id');

            $table-&amp;gt;integer('user_id')-&amp;gt;unsigned()-&amp;gt;nullable();

            $table-&amp;gt;foreign('user_id')
                -&amp;gt;references('id')
                -&amp;gt;on('users');

            $table-&amp;gt;timestamps();
        });&lt;/pre&gt;



&lt;p&gt;Migracje &lt;strong&gt;OrderProduct&lt;/strong&gt;:&lt;/p&gt;



&lt;pre class=&quot;brush:php;&quot;&gt;
        Schema::create('order_products_tables', function (Blueprint $table) {
            $table-&amp;gt;increments('id');

            $table-&amp;gt;integer('order_id')-&amp;gt;unsigned();

            $table-&amp;gt;integer('count')-&amp;gt;unsigned();
            $table-&amp;gt;integer('price')-&amp;gt;unsigned();

            $table-&amp;gt;foreign('order_id')
                -&amp;gt;references('id')
                -&amp;gt;on('order_tables');

            $table-&amp;gt;timestamps();
        });
&lt;/pre&gt;



&lt;p&gt;Jak to wynika z migracji tabela &lt;strong&gt;order_products_tables &lt;/strong&gt;przechowuje ID rekordu z tabeli &lt;strong&gt;order_tables&lt;/strong&gt; i na podstawie tego ID zachodzi relacja.&lt;/p&gt;



&lt;p&gt;Model tabeli &lt;strong&gt;Order&lt;/strong&gt;:&lt;/p&gt;



&lt;pre class=&quot;brush:php;&quot;&gt;
class OrderTable extends Model
{
    protected $table = 'order_tables';

    public function user()
    {
        return $this-&amp;gt;belongsTo(User::class, 'id');
    }

    public function products()
    {
        return $this-&amp;gt;hasMany('App\OrderProductTable');
    }
}&lt;/pre&gt;



&lt;p&gt;Model tabeli &lt;strong&gt;OrderProduct&lt;/strong&gt;:&lt;/p&gt;



&lt;pre class=&quot;brush:php;&quot;&gt;
class OrderProductTable extends Model
{
    protected $table = 'order_products_tables';

    public function order()
    {
        return $this-&amp;gt;belongsTo(OrderTable::class, 'id');
    }
}&lt;/pre&gt;



&lt;p&gt;Nie rozumiem dlaczego idzie odwołanie do &lt;strong&gt;order_table_id.&lt;/strong&gt; Mam zrobione inne relacje np. User i Order na tej samej zasadzie i działa to bez problemu nagle tutaj pojawił mi się taki przypadek. Gdzie mam szukać rozwiązania i dlaczego tak to działa ?&lt;/p&gt;</description>
<category>PHP</category>
<guid isPermaLink="true">https://forum.pasja-informatyki.pl/368163/laravel-relacja-jeden-do-wielu-odwolanie-do-nieistniejacego-pola</guid>
<pubDate>Mon, 23 Jul 2018 19:39:22 +0000</pubDate>
</item>
<item>
<title>Migracje - Cigniter</title>
<link>https://forum.pasja-informatyki.pl/12695/migracje-cigniter</link>
<description>

&lt;p&gt;Hej, cześć witajcie!&amp;nbsp;&lt;/p&gt;



&lt;p&gt;Mam problem z migracjami w CodeIgniterze.&amp;nbsp;&lt;/p&gt;



&lt;p&gt;Jeżeli zna się ktoś na tym proszę o pomoc! : )&lt;/p&gt;



&lt;p&gt;Oto błąd:&lt;/p&gt;



&lt;p&gt;&lt;img alt=&quot;&quot; src=&quot;https://forum.pasja-informatyki.pl/?qa=blob&amp;amp;qa_blobid=10523022740747587596&quot; style=&quot;height:141px; width:600px&quot;&gt;&lt;/p&gt;



&lt;p&gt;Oto wszystkie wymagane kodziki:&lt;/p&gt;



&lt;p&gt;►&lt;strong&gt;Ustawienia:&lt;/strong&gt;&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;&lt;img alt=&quot;&quot; src=&quot;https://forum.pasja-informatyki.pl/?qa=blob&amp;amp;qa_blobid=279155356685595794&quot; style=&quot;height:647px; width:600px&quot;&gt;&lt;/strong&gt;&lt;/p&gt;



&lt;p&gt;►&lt;strong&gt;To, co robi skrypt:&lt;/strong&gt;&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;&lt;img alt=&quot;&quot; src=&quot;https://forum.pasja-informatyki.pl/?qa=blob&amp;amp;qa_blobid=10537179946601977108&quot; style=&quot;height:586px; width:600px&quot;&gt;&lt;/strong&gt;&lt;/p&gt;



&lt;p&gt;►&lt;strong&gt;Uruchamia skrypt:&lt;/strong&gt;&lt;/p&gt;



&lt;p&gt;&lt;img alt=&quot;&quot; src=&quot;https://forum.pasja-informatyki.pl/?qa=blob&amp;amp;qa_blobid=7281542350176024448&quot; style=&quot;height:341px; width:600px&quot;&gt;&lt;/p&gt;



&lt;p&gt;Linczur do dokumentacji:&amp;nbsp;&lt;a href=&quot;http://www.codeigniter.com/user_guide/libraries/migration.html?highlight=migration&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;http://www.codeigniter.com/user_guide/libraries/migration.html?highlight=migration&lt;/a&gt;.&lt;/p&gt;</description>
<category>Nasze projekty</category>
<guid isPermaLink="true">https://forum.pasja-informatyki.pl/12695/migracje-cigniter</guid>
<pubDate>Tue, 21 Apr 2015 15:31:08 +0000</pubDate>
</item>
</channel>
</rss>