You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is sort of a continuation of #44 , and a devils advocate for one half of #60 which says
The proc macro runs independently on each #[model], and Cargo does not appear to provide any environment variables with a unique identifier for the build. Thus each .table file is generated independently and there isn't a great way to reap dead ones (that I've identified).
In the last task, one of the outcomes was to create cargo clean which is described as
Clean current migration state. Deletes the current migration working state which is generated on each build. This can be used as a workaround to remove stale tables from the schema, as Butane does not currently auto-detect model removals.
The next build will recreate with only tables for the extant models
This is useful, but to be a solution, needs to be either
very clearly documented as a required step when removing tables or types,
automated, either auto-cleaning, or auto-detecting cleaning is needed.
#44 proposes extra effort is going to be required of developers. If so, it would be easy for developers to create a build.rs and set a unique build identifier variable.
Another approach is to derive a unique-enough id from all files under src/ (and tests/ if CARGO_CFG_TEST is set). Could be file modification timestamps or hashes.
So if we had a build identifier, what can we do? For it to be of any use, it would need to be stored somewhere under .butane/. As it will change frequently, it would need to be a file which isnt checked into VCS.
The "solution" of creating a build.rs to auto-clean .butane/migrations/current caused #56 - Using an IDE while running tests causes test failures. The fix in #215 only works because in that project all of the models are in tests/. It isnt a general solution.
To use this build-id to reap dead tables/types, I guess the either a build.rs or proc-macros would detect that that there is a new build, and delete all the current files - esp types.json which is always json-appended to. Unless done carefully, this is break in the "IDE + running tests" scenario.
What would be interesting is if the proc-macros could write the new files into .butane/builds/<id>, and then some process known to run at the end be injected to replace the current migration dir files if a change was detected.
The text was updated successfully, but these errors were encountered:
This is sort of a continuation of #44 , and a devils advocate for one half of #60 which says
In the last task, one of the outcomes was to create
cargo clean
which is described asThis is useful, but to be a solution, needs to be either
#44 proposes extra effort is going to be required of developers. If so, it would be easy for developers to create a
build.rs
and set a unique build identifier variable.Another approach is to derive a unique-enough id from all files under
src/
(andtests/
ifCARGO_CFG_TEST
is set). Could be file modification timestamps or hashes.So if we had a build identifier, what can we do? For it to be of any use, it would need to be stored somewhere under
.butane/
. As it will change frequently, it would need to be a file which isnt checked into VCS.The "solution" of creating a build.rs to auto-clean
.butane/migrations/current
caused #56 - Using an IDE while running tests causes test failures. The fix in #215 only works because in that project all of the models are intests/
. It isnt a general solution.To use this build-id to reap dead tables/types, I guess the either a build.rs or proc-macros would detect that that there is a new build, and delete all the
current
files - esptypes.json
which is always json-appended to. Unless done carefully, this is break in the "IDE + running tests" scenario.What would be interesting is if the proc-macros could write the new files into
.butane/builds/<id>
, and then some process known to run at the end be injected to replace thecurrent
migration dir files if a change was detected.The text was updated successfully, but these errors were encountered: