Commit graph

22 commits

Author SHA1 Message Date
Yorick Peterse
d7a4c1d2a5
Backport EE changes made to the scripts/ directory
This backport changes made by EE to the files in the scripts/ directory.
This comes with a few changes to some scripts to make them work in the
single codebase setup.
2019-07-29 13:53:20 +02:00
Heinrich Lee Yu
2b3d00a778 Remove unneeded monkey-patch
Changes all calls to data_source_exists? to table_exists?
since that is the intent of these calls
2019-07-25 12:21:38 +08:00
Nick Thomas
4aa76dddec
Remove dead MySQL code
None of this code can be reached any more, so it can all be removed
2019-07-23 16:53:03 +01:00
Wei-Meng Lee
cfc6d2528c Fix attempting to drop views in PostgreSQL 2019-04-02 00:19:22 +00:00
Jose Torres
56c267e52c Fix MySQL error when truncating a table that doesn't exist
This adds a conditional statement before truncating the
`schema_migrations` table.

This comit also ports this code to Rails 5.
2019-02-05 17:30:22 -08:00
DJ Mountney
76cfe4f1fd Ensure the schema is loaded with post_migrations included
If doing a schema load, the post_migrations should also be marked as up,
even if SKIP_POST_DEPLOYMENT_MIGRATIONS was set, otherwise future
migration runs will be broken.
2018-09-11 18:41:14 -07:00
DJ Mountney
a9fcf96856 Fixes an issue where migrations instead of schema loading were run
If you called rake gitlab:db:drop_tables before running gitlab-ctl
reconfigure (or rake gitlab:db:configure)
2018-06-27 13:39:55 -07:00
Nick Thomas
1a168dc7a5 Fix caching large snippet HTML content on MySQL databases 2017-05-03 15:27:45 +01:00
Douwe Maan
e4551749c0 Only check new migrations in 'rake down_timecheck' 2017-03-08 17:33:53 -06:00
Douwe Maan
87c9df29ce Don’t exclude some file in lib from rubocop 2017-02-23 09:32:42 -06:00
Drew Blessing
cfd103dbb5 Disable MySQL foreign key checks before dropping all tables 2016-07-25 21:16:54 -05:00
Yorick Peterse
a8bfe20d0d
Added checks for migration downtime
These new checks can be used to check if migrations require downtime or
not (as tagged by their authors). In CI this compares the current branch
with master so migrations added by merge requests are automatically
verified.

To check the migrations added since a Git reference simply run:

    bundle exec rake gitlab:db:downtime_check[GIT_REF]
2016-07-20 12:41:56 +02:00
Stan Hu
bf92ea687f Properly quote table name in Rake task for MySQL and PostgreSQL compatibility
!4318 broke the gitlab:db:drop_tables functionality for PostgreSQL.

Closes #15259
2016-06-09 15:06:19 -07:00
Stan Hu
4fbb284cfd Merge branch 'fix_issue_15259' into 'master'
Fix bug with SQL syntax error during backup restoration

## What does this MR do?
It properly escapes the table name in the `DROP TABLE IF EXISTS ...` statement used during restore of a backup.

## Are there points in the code the reviewer needs to double check?
Please check compatibility with PostgreSQL

## Why was this MR needed?
Fix an issue with backups can not be restored if MySQL is used as database for GitLab.

## What are the relevant issue numbers?
#15259 

## Screenshots (if relevant)
-

See merge request !4318
2016-06-09 21:44:10 +00:00
Connor Shea
903946c78a
Replace colorize gem with rainbow.
Colorize is a gem licensed under the GPLv2, so we can’t use it in GitLab without relicensing GitLab under the terms of the GPL. Rainbow is licensed under the MIT license and does the exact same thing as Colorize, so Rainbow was added in place of Colorize.

The syntax is slightly different for Rainbow vs. Colorize, and was updated in accordance.

The gem is still a dependency of Spinach, so it’s included in the development/test environments, but won’t be packaged with the actual product, and therefore doesn’t require we relicense the product.

An attempt at relicensing Colorize was made, but didn’t succeed as the library owner never responded.

Rainbow library: https://github.com/sickill/rainbow
Relevant issue regarding licensing in GitLab's gems: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3775
2016-06-03 10:37:09 -06:00
Daniel Beyer
97aecdeade Fix bug with SQL syntax error during backup restoration
closes #15259
2016-05-27 13:35:12 +02:00
DJ Mountney
1a7326ba9a Switch the gitlab:db:configure task to use tables.any? instead of looking specifically for the schema_migrations table 2016-05-25 10:47:09 -07:00
DJ Mountney
24632d2150 Update hash syntax and add changelog for the gitlab:db:configure rake task 2016-05-25 10:44:22 -07:00
DJ Mountney
c6e7d826b2 Add a gitlab:db:configure rake task to handle conditionally seeding or migrating the database. 2016-05-25 10:44:22 -07:00
Drew Blessing
10d4d5842b Add if exists to drop command 2016-05-09 12:20:18 -05:00
Drew Blessing
50d18a1e1d Rake drop tables with cascade 2016-05-03 09:29:15 -05:00
Drew Blessing
5516b6c47f Reload the schema before restoring a database backup 2016-03-21 21:16:34 -05:00