New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create the schema at build time. #22
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Working on changing our schema loading to be in files we can debug rather than in memory at runtime. Going to take a bunch of work to do it right. Meanwhile, quiet the test.
I want to switch to using Schema::Loader as its meant to be used, creating static files at module install time rather than at runtime. This is a first step to isolating the schema creation process.
Easier to call it during the build process that way.
More functionality, no additional deps. The version of Mouse is the one which comes with Debian stable. Seems a sane minimum.
This simplifies the "should update database" logic. In the process tidied up our use of accessor types, making sure the class types we use are always pre-declared to avoid Moose thinking they're not class types. Also eliminated the unncessary BUILD method in PBP. Its now an attribute default.
Neater separation of concerns this way.
Separation of concerns and it lets other classes log.
Neatly moves a lot of code out of BackPAN::Index.
A small role, but it was getting repeated. Questionable if BackPAN::Index should use it, given how much it overrides, but the important thing about the role is it has an App::Cache object, not the details of how its created.
Not much point in table creation having its own class any more.
Makes much more sense there.
Where it belongs.
This leaves just BackPAN::Index->_populate_database as the only serious database access outside BackPAN::Index::Database. Going to leave that for now as I'm not sure where the index reading and population should go. Also that method is most of the startup cost, its been tuned, and I don't want to mess with it just now lest I get sidetracked optimizing.
They've moved to other classes.
Its no longer needed. We're about to add some Module::Build specific code to build the schema and the Makefile.PL will only confuse things.
Took a bit of doing. DBIC::Schema::Loader will only make a schema using load_classes() or load_namespaces() which spider all of lib/BackPAN/Index/, see non result classes and freak out. So we let it make a Schema class and throw it out. We need to generate the database at build time so Schema::Loader can see it.
We can use the app cache's location just fine.
This isn't generated by Schema::Loader.
schwern
added a commit
that referenced
this pull request
Dec 27, 2012
Create the schema at build time.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fair amount of refactoring going on here. Primarily to move responsibility for creating and managing the database into its own class, BackPAN::Index::Database. Then the db can be created at build time so the schema can see it.
For #21