narf37
I am using phoenix and the tds ecto adapter, on a controller i dont have any repo import or alias , and every time i call a controller action the tds adapter keeps querying the schema_migrations tables. I does the following 8 queries
IF NOT EXISTS (SELECT * FROM [INFORMATION_SCHEMA].[TABLES] WHERE [TABLE_NAME] = 'schema_migrations') CREATE TABLE [schema_migrations] ([version] bigint, [inserted_at] datetime, CONSTRAINT [schema_migrations_pkey] PRIMARY KEY CLUSTERED ([version]));
go
exec sp_unprepare @handle=7
go
declare @p1 int
set @p1=4
exec sp_prepare @handle=@p1 output,@params=N'',@stmt=N'sp_getapplock @Resource = ''ecto_ApiSystem.Repo'', @LockMode = ''Exclusive'', @LockOwner = ''Transaction'', @LockTimeout = -1'
select @p1
go
sp_getapplock @Resource = 'ecto_ApiSystem.Repo', @LockMode = 'Exclusive', @LockOwner = 'Transaction', @LockTimeout = -1
go
exec sp_unprepare @handle=4
go
declare @p1 int
set @p1=5
exec sp_prepare @handle=@p1 output,@params=N'',@stmt=N'SELECT CAST(s0.[version] AS bigint) FROM [schema_migrations] AS s0'
select @p1
go
SELECT CAST(s0.[version] AS bigint) FROM [schema_migrations] AS s0
go
exec sp_unprepare @handle=5
go
I am fairly new on elixir and ecto , I know that this is a behaviour to allow migrations on distributed deployments, my question is why is it happening on a route that does not touch the database and why is it happen on every single call.
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
al2o3cr
Hi @narf37! I went ahead and formatted your log messages with triple-backticks
```so they’re more legible.Regarding your question, that check is coming from the
CheckRepoStatusplug:https://github.com/phoenixframework/phoenix_ecto/blob/master/lib/phoenix_ecto/check_repo_status.ex
which is included in the default
endpoint.exgenerated by Phoenix. It only runs in development mode; more discussion on that in the Plug guide.narf37
Also i dont have any schemas defined or migrations pending my repo looks like this
defmodule ApiSystem.Repo do
use Ecto.Repo,
otp_app: :api_system,
adapter: Ecto.Adapters.Tds
end
scope “/api”, ApiSystemWeb do
pipe_through :api
end
defmodule ApiSystemWeb.TestController do
use ApiSystemWeb, :controller
alias Jason
def testMethod(conn, _params) do
conn
|>json(%{test: “ok”})
end
end
narf37
thats it!, i commented and now it dont get query.
is there a reason why it was to be done on every request?
al2o3cr
Most web frameworks (Phoenix included) will reload your application’s code when a change to the files is detected. In Phoenix, that check happens on every request.
But this can lead to unexpected behavior when the user creates a migration, adds a new field to a schema, but forgets to run the migration - the newly-loaded code expects a field that isn’t there!
CheckRepoStatusaims to prevent that problem by verifying that the development database is caught-up.