Skip to content

Conversation

@hogiyogi
Copy link
Contributor

After upgrading our Ecto version to 3.13.0, we were encountering an error:

warning: undefined module attribute @timestamps_opts, please remove access to @timestamps_opts or explicitly set it before access
    │
 35 │   typed_schema "my_schema" do
    │   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    │
    └─ lib/my_schema.ex:35: MySchema (module)

== Compilation error in file lib/my_schema.ex ==
** (FunctionClauseError) no function clause matching in Keyword.merge/2    
    
    The following arguments were given to Keyword.merge/2:
    
        # 1
        nil
    
        # 2
        [type: :utc_datetime_usec]
    
    Attempted function clauses (showing 3 out of 3):
    
        def merge(keywords1, []) when is_list(keywords1)
        def merge([], keywords2) when is_list(keywords2)
        def merge(keywords1, keywords2) when is_list(keywords1) and is_list(keywords2)

It looks like Ecto changed the @timestamps_opts from being defined explicitly to using:

    # Those module attributes are accessed only dynamically
    # so we explicitly reference them here to avoid warnings.
    Module.get_attribute(module, :timestamps_opts)

@bamorim
Copy link
Owner

bamorim commented Jun 23, 2025

Thanks for the fix. I’ll create a new release.

@bamorim bamorim merged commit c4a13df into bamorim:master Jun 24, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants