Skip to content

Commit

Permalink
Merge pull request swapmyvote#838 from aspiers/cp-staging-db
Browse files Browse the repository at this point in the history
  • Loading branch information
aspiers authored Jul 2, 2024
2 parents 4854e55 + dc7c779 commit bb8b009
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 6 deletions.
17 changes: 17 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
"success_url": "/",
"stack": "heroku-22",
"env": {
"HEROKU_APP_NAME": {
"required": true
},
"STAGING_DATABASE_URL": {
"required": true
},
"SERVER_HOST": {
"description": "Determine what cookie name to use. This can also be used to construct SERVER_HOST_PORT.",
"value": ""
Expand Down Expand Up @@ -114,6 +120,17 @@
"scripts": {
"test": "bundle exec rake test"
}
},
"review": {
"addons": [
{
"plan": "heroku-postgresql:essential-0",
"as": "DATABASE"
}
],
"scripts": {
"postdeploy": "pg_dump $STAGING_DATABASE_URL | psql $DATABASE_URL && bundle exec rake db:migrate"
}
}
}
}
2 changes: 1 addition & 1 deletion db/migrate/20191123112854_populate_ons_constituencies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def down
# nothing to do, we're just ensuring the table is populated
end

def up
def up_disabled
expected_rows = OnsConstituency::NUMBER_OF_UK_CONSTITUENCIES

return if OnsConstituency.count == expected_rows
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20191125100635_populate_recommendations.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative "../fixtures/livefrombrexit_recommendations_json"

class PopulateRecommendations < ActiveRecord::Migration[5.2]
def up
def up_disabled
json = LivefrombrexitRecommendationsJson.new

json.each do |rec_as_hash|
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20191126092838_add_brexit_party.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class AddBrexitParty < ActiveRecord::Migration[5.2]
def up
def up_disabled
Party.find_or_create_by(name: "Brexit Party", color: "#5bc0de")
end

Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20191202081913_recommendations_refresh_dec01.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class RecommendationsRefreshDec01 < ActiveRecord::Migration[5.2]
# rubocop:disable Metrics/MethodLength
def up
def up_disabled
json = LivefrombrexitRecommendationsJson.new

timestamp = DateTime.now
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20191206161508_recommendations_refresh_dec06.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class RecommendationsRefreshDec06 < ActiveRecord::Migration[5.2]
def up
def up_disabled
Recommendation.refresh_from_json(progress: true)
end

Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20191208113028_recommendations_refresh_dec08.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class RecommendationsRefreshDec08 < ActiveRecord::Migration[5.2]
def up
def up_disabled
Recommendation.refresh_from_json(progress: true)
end

Expand Down
5 changes: 5 additions & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,9 @@
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end

add_foreign_key "identities", "users"
add_foreign_key "mobile_phones", "users"
add_foreign_key "recommended_parties", "parties"
add_foreign_key "sent_emails", "users"
add_foreign_key "users", "mobile_phones"
end

0 comments on commit bb8b009

Please sign in to comment.