diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-09-09 15:56:02 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-09-09 15:56:02 +0300 |
commit | 0b5d627cd4a3f81934e7772e3558356c9dd2e3cf (patch) | |
tree | a232d232e543ef372d91d0dfffbc93985f37d982 /db | |
parent | 90c338a49541c95452181af9e0d0bcf9da6c51ad (diff) | |
parent | 0d610270d9634b783137bc6318eff4aa82572a7d (diff) |
Merge branch 'master' into ci-and-ce-sitting-in-a-tree-k-i-s-s-i-n-g
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20150817163600_deduplicate_user_identities.rb | 14 | ||||
-rw-r--r-- | db/migrate/20150902001023_add_template_to_label.rb | 5 | ||||
-rw-r--r-- | db/schema.rb | 3 |
3 files changed, 21 insertions, 1 deletions
diff --git a/db/migrate/20150817163600_deduplicate_user_identities.rb b/db/migrate/20150817163600_deduplicate_user_identities.rb new file mode 100644 index 00000000000..fab669c2905 --- /dev/null +++ b/db/migrate/20150817163600_deduplicate_user_identities.rb @@ -0,0 +1,14 @@ +class DeduplicateUserIdentities < ActiveRecord::Migration + def change + execute 'DROP TABLE IF EXISTS tt_migration_DeduplicateUserIdentities;' + execute 'CREATE TEMPORARY TABLE tt_migration_DeduplicateUserIdentities AS SELECT id,provider,user_id FROM identities;' + execute 'DELETE FROM identities WHERE id NOT IN ( SELECT MIN(id) FROM tt_migration_DeduplicateUserIdentities GROUP BY user_id, provider);' + execute 'DROP TABLE IF EXISTS tt_migration_DeduplicateUserIdentities;' + end + + def down + # This is an irreversible migration; + # If someone is trying to rollback for other reasons, we should not throw an Exception. + # raise ActiveRecord::IrreversibleMigration + end +end diff --git a/db/migrate/20150902001023_add_template_to_label.rb b/db/migrate/20150902001023_add_template_to_label.rb new file mode 100644 index 00000000000..bd381a97b69 --- /dev/null +++ b/db/migrate/20150902001023_add_template_to_label.rb @@ -0,0 +1,5 @@ +class AddTemplateToLabel < ActiveRecord::Migration + def change + add_column :labels, :template, :boolean, default: false + end +end
\ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index d7197d951a4..30b4832c1f3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150826001931) do +ActiveRecord::Schema.define(version: 20150902001023) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -373,6 +373,7 @@ ActiveRecord::Schema.define(version: 20150826001931) do t.integer "project_id" t.datetime "created_at" t.datetime "updated_at" + t.boolean "template", default: false end add_index "labels", ["project_id"], name: "index_labels_on_project_id", using: :btree |