<h1>Updating Your Game<aclass="headerlink"href="#updating-your-game"title="Permalink to this headline">¶</a></h1>
<p>Fortunately, it’s extremely easy to keep your Evennia server up-to-date. If you haven’t already, see
the <aclass="reference internal"href="../Setup/Installation.html"><spanclass="doc std std-doc">Getting Started guide</span></a> and get everything running.</p>
<h2>Updating with the latest Evennia code changes<aclass="headerlink"href="#updating-with-the-latest-evennia-code-changes"title="Permalink to this headline">¶</a></h2>
<p>Very commonly we make changes to the Evennia code to improve things. There are many ways to get told
when to update: You can subscribe to the RSS feed or manually check up on the feeds from
<aclass="reference external"href="https://www.evennia.com">https://www.evennia.com</a>. You can also simply fetch the latest regularly.</p>
<p>When you’re wanting to apply updates, simply <codeclass="docutils literal notranslate"><spanclass="pre">cd</span></code> to your cloned <codeclass="docutils literal notranslate"><spanclass="pre">evennia</span></code> root directory and type:</p>
<p>assuming you’ve got the command line client. If you’re using a graphical client, you will probably
want to navigate to the <codeclass="docutils literal notranslate"><spanclass="pre">evennia</span></code> directory and either right click and find your client’s pull
function, or use one of the menus (if applicable).</p>
<p>You will always need to do <codeclass="docutils literal notranslate"><spanclass="pre">evennia</span><spanclass="pre">reload</span></code> (or <codeclass="docutils literal notranslate"><spanclass="pre">reload</span></code> from -in-game) from your game-dir to have
the new code affect your game. If you want to be really sure you should run a full <codeclass="docutils literal notranslate"><spanclass="pre">evennia</span><spanclass="pre">reboot</span></code>
so that both Server and Portal can restart (this will disconnect everyone though, so if you know the
Portal has had no updates you don’t have to do that).</p>
</section>
<sectionid="upgrading-evennia-dependencies">
<h2>Upgrading Evennia dependencies<aclass="headerlink"href="#upgrading-evennia-dependencies"title="Permalink to this headline">¶</a></h2>
<p>On occasion we update the versions of third-party libraries Evennia depend on (or we may add a new
dependency). This will be announced on the mailing list/forum. If you run into errors when starting
Evennia, always make sure you have the latest versions of everything. In some cases, like for
Django, starting the server may also give warning saying that you are using a working, but too-old
version that should not be used in production.</p>
<p>Upgrading <codeclass="docutils literal notranslate"><spanclass="pre">evennia</span></code> will automatically fetch all the latest packages that it now need. First <codeclass="docutils literal notranslate"><spanclass="pre">cd</span></code> to
your cloned <codeclass="docutils literal notranslate"><spanclass="pre">evennia</span></code> folder. Make sure your <codeclass="docutils literal notranslate"><spanclass="pre">virtualenv</span></code> is active and use</p>
<p>Remember the period (<codeclass="docutils literal notranslate"><spanclass="pre">.</span></code>) at the end - that applies the upgrade to the current location (your
<div><p>The <codeclass="docutils literal notranslate"><spanclass="pre">-e</span></code> means that we are <em>linking</em> the evennia sources rather than copying them into the
environment. This means we can most of the time just update the sources (with <codeclass="docutils literal notranslate"><spanclass="pre">git</span><spanclass="pre">pull</span></code>) and see
those changes directly applied to our installed <codeclass="docutils literal notranslate"><spanclass="pre">evennia</span></code> package. Without installing/upgrading the
package with <codeclass="docutils literal notranslate"><spanclass="pre">-e</span></code>, we would have to remember to upgrade the package every time we downloaded any new
source-code changes.</p>
</div></blockquote>
<p>Follow the upgrade output to make sure it finishes without errors. To check what packages are
currently available in your python environment after the upgrade, use</p>
<divclass="highlight-none notranslate"><divclass="highlight"><pre><span></span>pip list
</pre></div>
</div>
<p>This will show you the version of all installed packages. The <codeclass="docutils literal notranslate"><spanclass="pre">evennia</span></code> package will also show the
location of its source code.</p>
</section>
<sectionid="migrating-the-database-schema">
<h2>Migrating the Database Schema<aclass="headerlink"href="#migrating-the-database-schema"title="Permalink to this headline">¶</a></h2>
<p>Whenever we change the database layout of Evennia upstream (such as when we add new features) you
will need to <em>migrate</em> your existing database. When this happens it will be clearly noted in the
<codeclass="docutils literal notranslate"><spanclass="pre">git</span><spanclass="pre">log</span></code> (it will say something to the effect of “Run migrations”). Database changes will also be
announced on the Evennia <aclass="reference external"href="https://groups.google.com/forum/#%21forum/evennia">mailing list</a>.</p>
<p>When the database schema changes, you just go to your game folder and run</p>
<div><p>Hint: If the <codeclass="docutils literal notranslate"><spanclass="pre">evennia</span></code> command is not found, you most likely need to activate your
<p>If you run the default <codeclass="docutils literal notranslate"><spanclass="pre">SQlite3</span></code> database (to change this you need to edit your <codeclass="docutils literal notranslate"><spanclass="pre">settings.py</span></code> file),
the database is actually just a normal file in <codeclass="docutils literal notranslate"><spanclass="pre">mygame/server/</span></code> called <codeclass="docutils literal notranslate"><spanclass="pre">evennia.db3</span></code>. <em>Simply delete
that file</em> - that’s it. Now run <codeclass="docutils literal notranslate"><spanclass="pre">evennia</span><spanclass="pre">migrate</span></code> to recreate a new, fresh one.</p>
<p>If you run some other database system you can instead flush the database:</p>
<p>In e.g. MySQL you can then do something like this (assuming your MySQL database is named “Evennia”:</p>
<divclass="highlight-none notranslate"><divclass="highlight"><pre><span></span>mysql> DROP DATABASE Evennia;
mysql> exit
</pre></div>
</div>
<blockquote>
<div><p>NOTE: Under Windows OS, in order to access SQLite dbshell you need to <aclass="reference external"href="https://www.sqlite.org/download.html">download the SQLite
command-line shell program</a>. It’s a single executable file
(sqlite3.exe) that you should place in the root of either your MUD folder or Evennia’s (it’s the
same, in both cases Django will find it).</p>
</div></blockquote>
</section>
<sectionid="more-about-schema-migrations">
<h2>More about schema migrations<aclass="headerlink"href="#more-about-schema-migrations"title="Permalink to this headline">¶</a></h2>
<p>If and when an Evennia update modifies the database <em>schema</em> (that is, the under-the-hood details as
to how data is stored in the database), you must update your existing database correspondingly to
match the change. If you don’t, the updated Evennia will complain that it cannot read the database
properly. Whereas schema changes should become more and more rare as Evennia matures, it may still
happen from time to time.</p>
<p>One way one could handle this is to apply the changes manually to your database using the database’s
command line. This often means adding/removing new tables or fields as well as possibly convert
existing data to match what the new Evennia version expects. It should be quite obvious that this
quickly becomes cumbersome and error-prone. If your database doesn’t contain anything critical yet
it’s probably easiest to simply reset it and start over rather than to bother converting.</p>
<p>Enter <em>migrations</em>. Migrations keeps track of changes in the database schema and applies them
automatically for you. Basically, whenever the schema changes we distribute small files called
“migrations” with the source. Those tell the system exactly how to implement the change so you don’t
have to do so manually. When a migration has been added we will tell you so on Evennia’s mailing
lists and in commit messages -
you then just run <codeclass="docutils literal notranslate"><spanclass="pre">evennia</span><spanclass="pre">migrate</span></code> to be up-to-date again.</p>