summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-10-17 12:45:31 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-10-17 12:45:31 +0200
commit6cdbb27ec3cf72ce6728986909aa3df54b7a26c6 (patch)
treeb989b826e119a382e1bc0fde590e312c8d3bbcda /db
parent7aea16b64624eb681a1c134759a8f4fa1e5b2a78 (diff)
downloadgitlab-ce-6cdbb27ec3cf72ce6728986909aa3df54b7a26c6.tar.gz
Refactor code to use available and stopped statuses and refactor views to use separate renders
Diffstat (limited to 'db')
-rw-r--r--db/fixtures/development/14_pipelines.rb4
-rw-r--r--db/migrate/20161006104309_add_state_to_environment.rb2
-rw-r--r--db/migrate/20161017095000_add_properties_to_deployment.rb29
-rw-r--r--db/schema.rb11
4 files changed, 33 insertions, 13 deletions
diff --git a/db/fixtures/development/14_pipelines.rb b/db/fixtures/development/14_pipelines.rb
index d3fabe111a1..08ad3097d34 100644
--- a/db/fixtures/development/14_pipelines.rb
+++ b/db/fixtures/development/14_pipelines.rb
@@ -16,8 +16,8 @@ class Gitlab::Seeder::Pipelines
{ name: 'env:alpha', stage: 'deploy', environment: 'alpha', status: :pending },
{ name: 'env:beta', stage: 'deploy', environment: 'beta', status: :running },
{ name: 'env:gamma', stage: 'deploy', environment: 'gamma', status: :canceled },
- { name: 'staging', stage: 'deploy', environment: 'staging', status_event: :success },
- { name: 'close staging', stage: 'deploy', environment: 'staging', when: 'manual', status: :skipped, options: { environment: { close: true } } },
+ { name: 'staging', stage: 'deploy', environment: 'staging', status_event: :success, options: { environment: { on_stop: 'stop staging' } } },
+ { name: 'stop staging', stage: 'deploy', environment: 'staging', when: 'manual', status: :skipped },
{ name: 'production', stage: 'deploy', environment: 'production', when: 'manual', status: :skipped },
{ name: 'slack', stage: 'notify', when: 'manual', status: :created },
]
diff --git a/db/migrate/20161006104309_add_state_to_environment.rb b/db/migrate/20161006104309_add_state_to_environment.rb
index 83dff07069f..ccb546654f9 100644
--- a/db/migrate/20161006104309_add_state_to_environment.rb
+++ b/db/migrate/20161006104309_add_state_to_environment.rb
@@ -6,7 +6,7 @@ class AddStateToEnvironment < ActiveRecord::Migration
DOWNTIME = false
def up
- add_column_with_default(:environments, :state, :string, default: :opened)
+ add_column_with_default(:environments, :state, :string, default: :available)
end
def down
diff --git a/db/migrate/20161017095000_add_properties_to_deployment.rb b/db/migrate/20161017095000_add_properties_to_deployment.rb
new file mode 100644
index 00000000000..6371166a4d2
--- /dev/null
+++ b/db/migrate/20161017095000_add_properties_to_deployment.rb
@@ -0,0 +1,29 @@
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddPropertiesToDeployment < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ # When a migration requires downtime you **must** uncomment the following
+ # constant and define a short and easy to understand explanation as to why the
+ # migration requires downtime.
+ # DOWNTIME_REASON = ''
+
+ # When using the methods "add_concurrent_index" or "add_column_with_default"
+ # you must disable the use of transactions as these methods can not run in an
+ # existing transaction. When using "add_concurrent_index" make sure that this
+ # method is the _only_ method called in the migration, any other changes
+ # should go in a separate migration. This ensures that upon failure _only_ the
+ # index creation fails and can be retried or reverted easily.
+ #
+ # To disable transactions uncomment the following line and remove these
+ # comments:
+ # disable_ddl_transaction!
+
+ def change
+ add_column :deployments, :properties, :text
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index ba2cf686fa9..b574f4d4a6a 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -398,22 +398,13 @@ ActiveRecord::Schema.define(version: 20161007133303) do
add_index "emails", ["user_id"], name: "index_emails_on_user_id", using: :btree
create_table "environments", force: :cascade do |t|
-<<<<<<< HEAD
- t.integer "project_id"
- t.string "name", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "external_url"
- t.string "environment_type"
- t.string "state", default: "opened", null: false
-=======
t.integer "project_id"
t.string "name", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.string "external_url"
t.string "environment_type"
->>>>>>> origin/master
+ t.string "state", default: "available", null: false
end
add_index "environments", ["project_id", "name"], name: "index_environments_on_project_id_and_name", using: :btree