Commit Graph

3 Commits

Author SHA1 Message Date
Jan Provaznik 0fc9f9d3e7 Add version 4.2 to all existing migrations
DB schema generated by a migration may look different in
rails 4 and 5 (because rails 5 may use different default values).
For this reason it's important to explicitly set for which rails
version a migration was written for.

See https://stackoverflow.com/questions/35929869/activerecordmigration-deprecation-warning-asks-for-rails-version-but-im-no/35930912#35930912
2018-11-22 13:18:28 +01:00
Jan Provaznik 1ec356a0b5 Mysql fixes for Rails 5
* `MysqlDateTimeWithTimeZone` inherits from `ActiveRecord::Type::DateTime`
  (`MysqlDateTime` is not present in Rails 5)
* explicitly set `NULL` default value for `merge_request_diff_files`'s
  `diff` column (otherwise empty string is used in a migration) and
  empty string is not allowed for text/blob fields in Mysql
* disable NO_ZERO_DATE mode for all Mysql DB connections, otherwise
  SQL queries fail on inserting `0` value for `created_at` column
2018-06-21 22:06:50 +02:00
Sean McGivern 9a73b634ab Add table for files in merge request diffs
This adds an ID-less table containing one row per file, per merge request
diff. It has a column for each attribute on Gitlab::Git::Diff that is serialised
currently, with the advantage that we can easily query the attributes of this
new table.

It does not migrate existing data, so we have fallback code when the legacy
st_diffs column is present instead. For a merge request diff to be valid, it
should have at most one of:

* Rows in this new table, with the correct merge_request_diff_id.
* A non-NULL st_diffs column.

It may have neither, if the diff is empty.
2017-06-16 18:30:01 +01:00