<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="234332" data-post-id="234332">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="the_wildgoose" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  the_wildgoose
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<blockquote>
<p>Tbh I fail to see how a release with some module to run migrations doesn’t essentially give you that. If you want to just run migrations do <code>bin/app eval SomeModule.run_migrations</code>. If you want to run migrations on boot you can put the same call in a boot phase or within <code>MyApp.Application.start</code> and it’ll be run on boot.</p>
<p>The complex part will be within <code>SomeModule.run_migrations</code> and depend on the project being built.</p>
</blockquote>
<p>Can you flesh out this part please?</p>
<p>Near as I can see we are all proposing a core bit of code “SomeModule.run_migrations”. The discussion is going slightly sideways, but I’m essentially pondering who/what/when kicks this module off?</p>
<p>In mix land we can use a mix task. In release land we seem to need “eval” to kick it off. I’m basically proposing to upgrade it to a genserver and stick it in the app tree (which I don’t see as a million miles away from using an eval?)</p>
<p>Main issues I’m struggling with are how to "compose"migrations from multiple parts of an umbrella. In one of my projects I have optional apps included within an umbrella and these use a variety of DBs and hence multiple migrations, potentially scattered across the app and different for different builds. Presumably you are arguing in favour of using each individual Apps Application.start function?</p>
<p>Calling a fixed module from MyApp.Application.Start, or inserting the same code into the OTP tree seem very similar to me? The idea of using the OTP tree is that I could in theory decide to cascade failure or not… I don’t feel very strongly about this since it seems a bit nuanced for most use cases.  However, given that if I don’t start up then I lose control over the whole box (not UI to have a user install a fixed firmware, no background service to allow an automated admin tunnel..), then it’s essential that I can try and ignore failures or take appropriate action (eg at least one repo is just logging data, so we can afford to blow that away to get back into a sane state.)</p>
<p>I’m also a bit unclear what happens if we have an umbrella app and one of the apps wants to fail it’s startup due to a failed migration? I guess it’s not so different if we fail in our OTP tree than the Application.start function? Will depend whether we set the app to :permanent? I guess I was thinking that putting it in the OTP tree gave me a bit more flexibility on when and how to fail (or ignore an error)</p>
<p>It seems to me that a web app might also want to struggle partly into life and offer some diagnostics to the user on how to rectify the failure? Dunno?</p>
<p>Note though that if YOU are automatically running migrations at app boot then we are already on the same page. What I’m basically advocating is that apps should move towards automating all (where practical) migration tasks and assisting the user in managing this process. Sure - offer me some advanced commands if it’s useful for me to run the migrations separately to booting the app, however, if migrations need running then don’t let me boot the app without running them! Fail, warn, disable functionality, whatever, but do everything possible to avoid involving me! (meaning for sure, don’t lose data, but if it’s case of running “Blah.run_migrations” then get on with it…!)</p>
<p>Thanks for taking the time to reply! Appreciated.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="234332" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/ecto-auto-migrator-thoughts-appreciated/42338/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-234332" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="234332"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="234339" data-post-id="234339">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="the_wildgoose" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  the_wildgoose
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I think I’ve not set out my concerns which guide my subsequent thought process clearly enough (apologies)</p>
<ul>
<li>
<p>I hate apps (looking at your rails), which have a deployment/migration document which has multiple “mix do_blah” alike steps that need absorbing</p>
</li>
<li>
<p>I don’t see that Elixir is particularly moving towards solving this. Deployment has appeared “problematic” until recently. Even putting your migrations into a Module.run_migrations module seems a like a bit of hidden knowledge (I think I found it buried in this forum as a tip, way down a thread…). Generally I see frequent assumptions that you have access to mix and some expert will run it and check for errors?</p>
</li>
<li>
<p>It feels to me that we the community could do more to encourage a clear entry point to Module.run_migrations and setting up some skeleton around this for deployment (ie mix won’t exist for lots of users at deploy time)</p>
</li>
<li>
<p>Booting up the app having forgotten to run the migrations seems like a horror that shouldn’t happen to me? How to prevent this and avoid corrupting data?</p>
</li>
<li>
<p>I (opinion) feel that lots of developers opt out of the difficult task of writing bullet proof migrations. If the migrations are run at the command line by some expert, then it’s much easier to punt corner cases to documentation and support forums. If in contrast I was told that my requirements are to run the migrations automatically at app startup I would emotionally be tackling the problem with a different level of rigour… (and testing!)</p>
</li>
<li>
<p>Some apps cannot be allowed not to start. Migration failure is something that needs to be managed, but can’t stop the app booting</p>
</li>
<li>
<p>I speculate that for some apps it would be nice if the migrations could be run in the background while the app is operating “normally”. eg some migrations might take hours or days and the app should try to operate during that process</p>
</li>
<li>
<p>In some of these cases migration failures might be soft retryable or mark some subset of the database needing attention</p>
</li>
<li>
<p>Migrations aren’t only about databases. There could be on disk data, config files, logs, non ecto databases, etc</p>
</li>
<li>
<p>Composable apps are sometimes tricky. If I wrote a Wordpress competitor, then I would likely need to support a bunch of plugins (yuck), which they themselves likely need to manage their data and version upgrades. Again this could consist of both traditional database and non database assets</p>
</li>
<li>
<p>External transactions. Groups of migrations may make a logical unit that can succeed or fail, eg upgrade all the WordExPress plugins or none, etc. Some migrations might be difficult/impossible to roll back (eg some of the non database stuff).</p>
</li>
</ul>
<p>I think we might end up in an interesting place if we start thinking about the migrations being valuable code and data to manage, just like we do when the app is running. The current attitude of “squeezing it to the edge with a big bang change” seems at odds (to me), with the rich tools we have to manage and maintain the data after we “boot”? Do we end up in a different place if we think in terms of booting half the app before starting the migration process?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="234339" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/ecto-auto-migrator-thoughts-appreciated/42338/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-234339" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="234339"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="234446" data-post-id="234446">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sbuttgereit" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sbuttgereit/120/30162_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sbuttgereit
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>So I have a similarish desire in regard for migrations: startup the application and apply any outstanding migrations as needed in the startup routines.  Naturally, there’s a bit more to it than that and I’m not in an embedded scenario, but there are reasons for this approach I believe are valid for wanting my application itself to govern the running of database updates rather than have that as a separate administrative task.  So my solution: don’t use Ecto migrations for this purpose or try to bend it to my will.</p>
<p>My viewpoint as a still relative outsider to the world of Elixir is this: Ecto as a tool is designed to meet the needs of a general audience, but a certain kind of general audience.  If you’re building a sort of typical web-app and your product is delivered via that web-app, where the database is mostly simpler persistence for a specific application, where you’re doing rigorous continuous integration &amp; (probably) continuous deployment, you don’t have database specialists involved in development (so called “application DBAs”), and you have full control over both the development of the application and the operations of the application: my assessment of Ecto is that it’s most at home in this kind of environment.   We can probably extend this a bit if we allow just the operational control by qualified staffing, where the application is brought in from elsewhere, like you might find in libraries or certain utility apps that you might add into your operation.  (I’m probably speaking more about Ecto SQL throughout this post moreso than Ecto, but I’ll just keep saying Ecto for now, you know what I mean).</p>
<p>But leave the model that Ecto best supports and it quickly makes less sense to use and trying to make Ecto be all things to all people I think will ultimately diminish the value it does provide to its intended audience.</p>
<p>Watching the forums here and talk around the Web, you’d think that database access and Ecto are necessary partners, but they aren’t.  Ecto is a very helpful library that will get you through a lot of use cases.  But when it doesn’t hit the mark, it’s probably best to just leave Ecto and its opinions on the shelf and find something else (OK, there really isn’t a lot to find) or make something bespoke to deal with your specific needs… the complexity and size of Ecto is probably because the way it is because it’s trying to be a generalized solution for these kinds of applications.</p>
<p>I looked at the specific problems I’m trying to solve and decided to roll my own migrator (just finishing up that project).  I don’t need many of the features that Ecto brings with it and Ecto doesn’t support a number of features I think are important to this specific application, and it’s not really that much code to make things work: it just needs to support my model for database updates well and handle the failure modes that can come out of that model in a sufficiently predicable manner.  So in this regard, Postgrex is much more important to my application than Ecto SQL.  But the requirements I’ve set for my application are niche compared to the common use cases for Elixir and I wouldn’t suggest anyone follow my model unless they have clear reasons to do something similar.  Of course, there’s the query builders and the DSL around building out the schema with Ecto… but I don’t need that either.  Plain old SQL is completely sufficient and I’m probably better served since the database does more in my application than in many web-apps.</p>
<p>Anyway… I guess I’m just trying to say is extending the target use cases in a well established something like Ecto isn’t necessarily bad, but it’s worth asking if you should rather than if you can and that’s basically the messaging that I’m seeing in this thread: many voices not sold on extending Ecto in this direction and I think they’re probably right.</p>
<p>Thanks,<br>
Steve</p>
<p>P.S. Perhaps Ironically, I am using Ecto proper for it’s changesets and validations in dealing with internal validations, form processing, etc.  I could gin up something for that, too, but for my use case it actually works well so far.  I may end up going elsewhere in the end, but for right now those parts of Ecto are superior to anything I could build myself and will likely be more than good enough.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="234446" data-batch-url="/posts/batch_likers">
                        3
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/ecto-auto-migrator-thoughts-appreciated/42338/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-234446" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="234446"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="235066" data-post-id="235066">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="LostKobrakai" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/LostKobrakai/120/3072_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  LostKobrakai
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="the_wildgoose" data-post="12" data-topic="42338">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/t/3ab097/48.png" class="avatar"> the_wildgoose:</div>
<blockquote>
<p>Main issues I’m struggling with are how to "compose"migrations from multiple parts of an umbrella. In one of my projects I have optional apps included within an umbrella and these use a variety of DBs and hence multiple migrations, potentially scattered across the app and different for different builds. Presumably you are arguing in favour of using each individual Apps Application.start function?</p>
</blockquote>
</aside>
<p>That’s exactly the complexity I was hinting at in my last post. I don’t think I have the one solution here given all approaches come with their individual tradeoffs. The more “dynamic” or unknown (as opposed to static) a system is the more tricky it becomes to handle its state. In the end you’ll need some place to know of all the subcomponents you have. When using the individual <code>Application.start</code> callbacks then this place would be the startup list of applications in your release. Generally I’d suggest having some central component in your system knowing about subcomponents, because then you are in control – instead of delegating to a piece of code you don’t directly control. With that you could have something like a <code>MyCentralApp.run_migrations</code> delegate to a known module in each subcomponents, which handles their individual migration needs. Something like</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">for sub &lt;- fetch_subcomponent_roots() do
  Module.concat(sub, Migration).run_migration()
end
</code></pre>
<p>I’d strongly suggest to let each application deal with it’s own migration needs, ot</p>
<aside class="quote no-group quote-modified" data-username="the_wildgoose" data-post="12" data-topic="42338">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/t/3ab097/48.png" class="avatar"> the_wildgoose:</div>
<blockquote>
<p>However, given that if I don’t start up then I lose control over the whole box (not UI to have a user install a fixed firmware, no background service to allow an automated admin tunnel…), then it’s essential that I can try and ignore failures or take appropriate action (eg at least one repo is just logging data, so we can afford to blow that away to get back into a sane state.)</p>
</blockquote>
</aside>
<p>That’s imo completely unrelated to migrations, but to anything your dependencies do. I want to start that this is generally not something the beam has a simple solution to. If an application crashes (and it’s a permanent one) then the vm will shut down and is expected to come back online by means outside the vm. Also restarts are the means of recovery on the beam, but (especially without backoff) they can only fix a subset of possible errors in a system. The goal of tools provided by the beam and otp is to keep all the stuff running, which you tell it to keep running and it’ll give up if it cannot do so.</p>
<p>So to build a system, where partial availability is more important than complete availability you’ll need to build in the guard rails. Those could be circuit breakers, starting applications (see e.g. the shoehorn library) or processes with non <code>:permanent</code> restart types, using more elaborate restart mechanisms with backoffs, custom logic (see e.g. the parent library). You’ll essentially want to be able to shut off things, which continue to fail (causing partial downtime) in favor of keeping the ability to connect to the system from the outside. Doesn’t matter if a migration or other code is the cause of the errors.</p>
<p>This becomes even more tricky when you considere NIFs, which when they fail directly bring down the beam VM. Nothing application level can catch errors in NIFs. Also there are outside forces, which might stop your beam VM. E.g. when using linux the oom killer might stop the beam if you’re using to much memory.</p>
<p>While as you can see there are a lot of things to cover, this is not to say you cannot deal with those. But you’ll need to be diligent and careful, know your dependencies, know your failure cases, … The beam has many tools, which help build a system, which has the properties you need. You won’t be getting them automatically though.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="235066" data-batch-url="/posts/batch_likers">
                        3
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/ecto-auto-migrator-thoughts-appreciated/42338/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-235066" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="235066"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="235377" data-post-id="235377">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="the_wildgoose" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  the_wildgoose
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>The fine line which seems to getting agreement here is:</p>
<ul>
<li>Migrations encompass more than just Ecto</li>
<li>Once you add subcomponents, it’s useful to disperse the migration process into the components</li>
</ul>
<p>I think I’m seeing glimmers of agreement that: “having the app itself manage most migrations” is desired?</p>
<p>So, I hope the library as proposed gives some ideas on how that could be managed. I do see a missing piece with data migrations and how to handle in a robust form. I dislike the current tendency that it’s pushed to an upgrade readme (although I grant that the more “enterprise” or “clustered” the end result, the more appropriate this could be)</p>
<p>I think the final solution will be some guidance on good practice. Something like we have with deployments. Perhaps a startup phase in apps reserved to try and shoehorn in migrations, along with some useful lib functions?</p>
<p>Lets see</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="235377" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/ecto-auto-migrator-thoughts-appreciated/42338/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-235377" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="235377"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="235381" data-post-id="235381">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Brainiac" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Brainiac
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="the_wildgoose" data-post="16" data-topic="42338">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/t/3ab097/48.png" class="avatar"> the_wildgoose:</div>
<blockquote>
<p>I think the final solution will be some guidance on good practice. Something like we have with deployments. Perhaps a startup phase in apps reserved to try and shoehorn in migrations, along with some useful lib functions?</p>
</blockquote>
</aside>
<p>There already is <a href="https://hexdocs.pm/ecto_sql/Ecto.Migrator.html" rel="noopener nofollow ugc">detailed docs</a> on how to use the migrator, and the examples shown applies to a release deployment. It  already shows how to call migrations directly either through shell or a script through eval, and it can easily be placed in a startup shell script as well (or if you’re dockerizing your app, in the dockerfile’s <code>CMD</code> or manually through <code>docker exec</code>.).</p>
<p>The worst case possible of having migrations run before the deployment is if there are issues with your migration script (which may happen from time to time) due to data inconsistencies. You wouldn’t want a faulty migration to block your deployments.<br>
Or another possible scenario would be if you need to downgrade your app’s version and roll back the migration manually, how would you do so if the migrations run automatically?<br>
What if you’re doing hot code reloading for HA requirements?We’d need to decouple the migrations completely in that case.</p>
<p>Everyone’s deployment requirements differ, hence there isn’t a “best practice”.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="235381" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/ecto-auto-migrator-thoughts-appreciated/42338/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-235381" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="235381"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #16"></div>
  </section>
</div>
    <div class="postbit" id="235452" data-post-id="235452">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="the_wildgoose" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  the_wildgoose
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>You aren’t addressing the issue of the user running the app <em>without</em> running the migrations. This could equally cause trouble..?</p>
<p>Please read through the whole thread. I’m claiming that the old school desire to treat migrations as a bit of an afterthought is undesirable. Case in point, I upgraded my android phone yesterday, at no point was I dumped to a shell to manage the individual migrations of dozens of apps…</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="235452" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/ecto-auto-migrator-thoughts-appreciated/42338/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-235452" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="235452"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #17"></div>
  </section>
</div>
    <div class="postbit" id="235466" data-post-id="235466">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="cmo" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/cmo/120/19618_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  cmo
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I think you’re missing the point that most people are not building software where some naive end user is doing the upgrades. I’d assume most people are writing software that they or their team deploys on servers and users just access a webpage.</p>
<p>If you’re trying to gather support for a library to meet your niche requirements maybe you could try being a bit nicer about it?</p>
<p>I have similar requirements to you as my app is run on clients’ hardware, often disconnected from the internet. I plan to run/rollback migrations as part of the installer/upgrade/uninstall.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="235466" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/ecto-auto-migrator-thoughts-appreciated/42338/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-235466" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="235466"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #18"></div>
  </section>
</div>
    <div class="postbit" id="235503" data-post-id="235503">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Brainiac" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Brainiac
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="the_wildgoose" data-post="18" data-topic="42338">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/t/3ab097/48.png" class="avatar"> the_wildgoose:</div>
<blockquote>
<p>I’m claiming that the old school desire to treat migrations as a bit of an afterthought is undesirable.</p>
</blockquote>
</aside>
<p>I think they there’s already been much improvement in that respect, given that there is now releases and actual docs on how to do migrations, as compared to previously one had to work with distillery and complicate matters further (I know because I literally wrote an article on auto migrations with docker and distillery and startup hooks).</p>
<p>I don’t think that such deployment and migration complexity should be handled and solved by the ecto team, it would be above and beyond an average user’s deployment (1 app 1 release 1 migration needed).</p>
<p>Perhaps as a lib or cli tool, maybe.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="235503" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/ecto-auto-migrator-thoughts-appreciated/42338/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-235503" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="235503"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #19"></div>
  </section>
</div>
    <div class="postbit" id="237389" data-post-id="237389">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="feld" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  feld
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="the_wildgoose" data-post="8" data-topic="42338">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/t/3ab097/48.png" class="avatar"> the_wildgoose:</div>
<blockquote>
<p>e) I guess migrations don’t always only happen at boot? I’m thinking about say my currency rates or keychains, etc?</p>
</blockquote>
</aside>
<p>We wrote a framework into Pleroma that will let you run database migrations in the background while the app is running and when the migration has finished it flips over to the new codepath. Something like this as a first class citizen for everyone to use would be amazing.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="237389" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/ecto-auto-migrator-thoughts-appreciated/42338/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-237389" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="237389"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>