Git Product home page Git Product logo

Comments (6)

TheNotary avatar TheNotary commented on May 24, 2024

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.

TheNotary avatar TheNotary commented on May 24, 2024

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.

TheNotary avatar TheNotary commented on May 24, 2024

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

  1. git checkout -b fixing-migration-schema-discrepancy

  2. Copy/ paste sample migration files

  3. 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
  1. 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
  1. git add db/schema.rb; git commit -m "removed undesirable elements from schema.rb";

  2. push to github

  3. 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.

TheNotary avatar TheNotary commented on May 24, 2024

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.

TheNotary avatar TheNotary commented on May 24, 2024

this issue has been resolved with #33

from action-center-platform.

TheNotary avatar TheNotary commented on May 24, 2024

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)

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.