Giter Site home page Giter Site logo

Comments (4)

narrowtux avatar narrowtux commented on July 19, 2024

Hi! I'm sorry you're having an issue with loading old versions.

Can you provide more details about your issue:

  • which function are you calling and how?
  • (if applicable) how did you configure ex_audit?
  • add the entire error message

from ex_audit.

schnittchen avatar schnittchen commented on July 19, 2024

I'm just calling MyApp.Version |> MyApp.Repo.all and the error I get is

cannot load `"some_table_name"` as type ExAudit.Type.Schema for field :entity_schema in %MyApp.Version{...}

(obviously with some real table name)

The error is easy to reproduce:

  • have something tracked
  • clear the tracked_schemas config
  • run the query

Aside, the version_schema and tracked_schemas should not be configuration for the ex_audit application but somehow bound to the Repo at hand (see https://hexdocs.pm/elixir/1.9.1/library-guidelines.html#avoid-application-configuration)

from ex_audit.

narrowtux avatar narrowtux commented on July 19, 2024

I feel like this might be out of spec for this library. If you remove a schema from the config, you should also write a migration that deletes all of these entries (the execute function can be used in ecto migrations to run arbitrary SQL queries):

DELETE FROM versions WHERE entity_schema= 'some_table_name'

Of course, you could also decide to keep these in a seperate table before deleting them from the versions table:

CREATE TABLE some_table_name_versions AS (SELECT * FROM versions WHERE entity_schema = 'some_table_name');

from ex_audit.

schnittchen avatar schnittchen commented on July 19, 2024

I just ran into this issue again after renaming a table. I had to go down to SQL to fix this, because the ExAudit.Type.Schema won't let me just add an arbitrary atom into the :tracked_schemas env.

from ex_audit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.