Skip to content
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

AO3-5910 Update schema and structure files #4000

Merged
merged 6 commits into from
May 2, 2021

Conversation

redsummernight
Copy link
Member

@redsummernight redsummernight commented Apr 28, 2021

Issue

https://otwarchive.atlassian.net/browse/AO3-5910

Purpose

Generate new versions of schema dumps from production.

For Ruby dump, run on an app server:

bundle exec rake db:schema:dump

then manually change the version in ActiveRecord::Schema.define to the latest migration timestamp.

For SQL dump, run on a database server:

mysqldump --no-data --routines --skip-comments --result-file=structure.sql otwarchive_production
Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all transactions, even those that changed suppressed parts of the database. If you don't want to restore GTIDs, pass --set-gtid-purged=OFF. To make a complete dump, pass --all-databases --triggers --routines --events.

then manually:

  • remove AUTO_INCREMENT values;
  • append a dump of the schema_migrations table, generated from bundle exec rails r "puts ActiveRecord::Base.connection.dump_schema_information".

The resulting output will be similar to that of bundle exec rake db:structure:dump (which we can't use because we've started provisioning app and database servers differently, and app servers no longer have mysqldump available).

Testing Instructions

CI build should pass.

After this is merged:

@@ -2,13 +2,29 @@
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40101 SET NAMES utf8 */;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is from production so it must be right, but... is this right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is just the overall default. Most tables have explicit overrides (CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci) which haven't changed.

@sarken sarken merged commit 79c0a10 into otwcode:master May 2, 2021
@redsummernight redsummernight deleted the AO3-5910 branch May 2, 2021 23:58
@sarken
Copy link
Collaborator

sarken commented May 9, 2021

For the wiki update, do you want me to just replace the entire "Updating schema dumps" section with what you've written under "Purpose," or are there bits on the wiki we should keep?

@redsummernight
Copy link
Member Author

Yeah, and I've updated the wiki.

@sarken
Copy link
Collaborator

sarken commented May 24, 2021

ty!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants