Comments (6)
The resolution to these diffs involve:
- Backdating enable_ossd
- adding default uuid_generate_v4() lines to two migration files
The remaining dependencies can be handled by pulling in missing migrations and running the db:migrate:down
command on your current dev setup (I feel we should also do this on the production database such that it's in-line with what is desirable --desirable meaning does not contain datatables and data fields that are unused by rails, and undocumented anywhere other than schema.rb but will respect your decision to not manipulate the production db unless necessary).
The files needed for the transformation are here:
The commands that conduct the database mutation are:
rake db:migrate:down VERSION=20140505141409 # removes table locales
rake db:migrate:down VERSION=20140504133807 # removes field action_page_image
rake db:migrate:down VERSION=20140504122904 # removes table action_page_images
rake db:migrate:down VERSION=20140327210148 # field removes call_tool
After the commands are finished, schema.rb will be in a form that's more congruent with what the migrations are capable of generating (and your database will be corrected accordingly such that future migrations or rake db:schema:dump
commands will return the same schema made possible by the migrations).
After the magrate:down commands, the migrations should be deleted, they don't need to be tracked into version control since they are all pointless database changes that are undesirable. schema.rb
should be committed and pushed to upstream.
In an accessory PR, I'll include the enable_ossd related migration patches which will complete the resolution of this issue.
Thank you for your patients with me on this issue. There will be vegan donuts on Monday from Pepples at sometime after 9:30 AM if everything goes according to my Monday morning plan :)
from action-center-platform.
Here are the files that need to be dropped into db/migrate/
and renamed from .rb.txt
to .rb
before those db:migrate:down
commands will work.
20140327210148_add_call_tool_to_action_page.rb.txt
20140504122904_create_action_page_images.rb.txt
20140504133807_add_action_page_image_to_action_page.rb.txt
20140505141409_create_locales.rb.txt
from action-center-platform.
NOTE: don't start running till Monday, I wanted to finish this Friday night but need to take a thought break. I'm also open to alternative approaches that will achieve the goal of having a schema.rb that's reproducible via the migration feature if this approach gives you pause.
My plan is to do a quick test run of the below procedure against a fresh clone of the production database.
Solution Overview
- Clear out bunk tables and fields from migration (explained in this issue)
- [easy-migration-fixes branch] Remove migrations AddGeoWorldMapTables and remove countries
- [easy-migration-fixes branch] backdate enable_ossd and patch files to use 'uuid_generate_v4()'
Procedure to Clear Out Bunk Tables and Fields from schema.rb
-
git checkout -b fixing-migration-schema-discrepancy
-
Copy/ paste sample migration files
-
run migrate:down commands
rake db:migrate:down VERSION=20140505141409
rake db:migrate:down VERSION=20140504133807
rake db:migrate:down VERSION=20140504122904
rake db:migrate:down VERSION=20140327210148
- delete migration files
cd db/migrate
rm 20140327210148_add_call_tool_to_action_page.rb 20140504122904_create_action_page_images.rb 20140504133807_add_action_page_image_to_action_page.rb 20140505141409_create_locales.rb
-
git add db/schema.rb; git commit -m "removed undesirable elements from schema.rb";
-
push to github
-
Never allow commiters to remove migrations from the repo again without first adjusting the db/schema.rb file (this took forever to sort out and we still have issues where production db will differ from some deploys)
from action-center-platform.
Also wanted to leave this table so it's ready for Monday:
Alternate Resolution Paths that Lead to schema.rb to be inline with migrations
(In order of least to most intrusive, I favor the 'intrusive' side because otherwise we're intentionally scripted pointless fields and tables in our schema.rb)
A. Peform easy-migration-fixes merge, and simply track in the erased migration scrips and leave them there
B. Pefrom Easy-migration-fixes, track in the erased migrations, and write migrations to eliminate un-needed database elements
C. Pefrom easy-migration-fixes, copy in erased migrations, perform rake db:migrate:down
to fix schema.rb and your dev table so the un-needed tables don't show up in schema.rb next time you run rake db:migrate
D. Collapse all migrations into a single migration file that will represent the currently tracked in schema.rb.
I'm actually starting to favor B over C, since after you perform the migrations, we could theoretically delete the migrations that cancel each other at any point in the future. D is my least favorite path forward, but I will do this if the other options are disagreeable to you as long as it achieves the goal of having a schema.rb that can be generated via the migrations tracked into the repo.
from action-center-platform.
this issue has been resolved with #33
from action-center-platform.
This hasn't been pushed to production yet and needs to be tested on staging to ensure I don't bring act.eff.org offline ever again.
from action-center-platform.
Related Issues (20)
- Add tool tip to Partner logo upload
- Remove double pagination from petitions HOT 1
- Changing filters on analytics returns 500 error
- About Face petition field should request city, not university HOT 1
- Fix alignment on petition action HOT 1
- Standardize postgres version across environments
- Make reference to Salsa privacy policy on state level actions HOT 1
- Make header text on act.eff.org clickable HOT 1
- Email fields should only accept valid email addresses HOT 1
- slashes in links mysteriously turning into :
- Fix share icon spacing in thank you email HOT 1
- Ruby 2.5 is EOL in March 2021 HOT 3
- Tests appear to be broken on master branch
- Tweak Admin preview / view UX
- SES signature version error
- Error Net::SMTPServerBusy: 454 Throttling failure: Daily message quota exceeded. HOT 3
- Update Action Center text for call action
- Add Mx. option
- Error when looking up representative
- 2024 Upgrade TODOs, nice-to-haves, etc HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from action-center-platform.