Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-21 18:08:26 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-21 18:08:26 +0300
commitc859c3bfd242288065fe5e2d887f7204f09e2335 (patch)
tree10febaf8774a3ea6ab3773c0dd97658d673fb280 /db
parent28ce39a3e0e7b47e53939a15fb823af9c433327a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200116175538_update_timestamp_softwarelicensespolicy.rb28
-rw-r--r--db/migrate/20200121132641_update_timestamp_softwarelicensespolicy_not_null.rb15
-rw-r--r--db/schema.rb6
3 files changed, 46 insertions, 3 deletions
diff --git a/db/migrate/20200116175538_update_timestamp_softwarelicensespolicy.rb b/db/migrate/20200116175538_update_timestamp_softwarelicensespolicy.rb
new file mode 100644
index 00000000000..5ed797e33a3
--- /dev/null
+++ b/db/migrate/20200116175538_update_timestamp_softwarelicensespolicy.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class UpdateTimestampSoftwarelicensespolicy < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ time = Time.zone.now
+
+ update_column_in_batches(:software_license_policies, :created_at, time) do |table, query|
+ query.where(table[:created_at].eq(nil))
+ end
+
+ update_column_in_batches(:software_license_policies, :updated_at, time) do |table, query|
+ query.where(table[:updated_at].eq(nil))
+ end
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/migrate/20200121132641_update_timestamp_softwarelicensespolicy_not_null.rb b/db/migrate/20200121132641_update_timestamp_softwarelicensespolicy_not_null.rb
new file mode 100644
index 00000000000..1da96b470ef
--- /dev/null
+++ b/db/migrate/20200121132641_update_timestamp_softwarelicensespolicy_not_null.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class UpdateTimestampSoftwarelicensespolicyNotNull < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ change_column_null(:software_license_policies, :created_at, false)
+ change_column_null(:software_license_policies, :updated_at, false)
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 8ee1f2ffea6..39ada44b5aa 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2020_01_17_112554) do
+ActiveRecord::Schema.define(version: 2020_01_21_132641) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
@@ -3857,8 +3857,8 @@ ActiveRecord::Schema.define(version: 2020_01_17_112554) do
t.integer "project_id", null: false
t.integer "software_license_id", null: false
t.integer "classification", default: 0, null: false
- t.datetime_with_timezone "created_at"
- t.datetime_with_timezone "updated_at"
+ t.datetime_with_timezone "created_at", null: false
+ t.datetime_with_timezone "updated_at", null: false
t.index ["project_id", "software_license_id"], name: "index_software_license_policies_unique_per_project", unique: true
t.index ["software_license_id"], name: "index_software_license_policies_on_software_license_id"
end