aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorRobert Dober2017-09-27 13:55:09 +0200
committerGitHub2017-09-27 13:55:09 +0200
commit103e77e1fd28bf6f5ba3ad4f64a0681f2e9dd76f (patch)
tree1735f2f103fe0f8fcc5fa6b66a292912c6036041 /db
parent28a42fb19174eafee38fe3c5f8fa58f89991f44a (diff)
parentd1bd434d78972d4f4156f3e3e864e075cad9e62d (diff)
downloadchouette-core-103e77e1fd28bf6f5ba3ad4f64a0681f2e9dd76f.tar.bz2
Merge pull request #78 from af83/3520-workbench--add-output-association-to-ReferentialSuite
3520 workbench add output association to referential suite
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20170925123159_add_output_to_workbenches.rb5
-rw-r--r--db/migrate/20170925154017_create_referential_suite_for_each_existing_workbench.rb12
-rw-r--r--db/schema.rb3
3 files changed, 19 insertions, 1 deletions
diff --git a/db/migrate/20170925123159_add_output_to_workbenches.rb b/db/migrate/20170925123159_add_output_to_workbenches.rb
new file mode 100644
index 000000000..d6aea96a0
--- /dev/null
+++ b/db/migrate/20170925123159_add_output_to_workbenches.rb
@@ -0,0 +1,5 @@
+class AddOutputToWorkbenches < ActiveRecord::Migration
+ def change
+ add_column :workbenches, :output_id, :bigint, index: true
+ end
+end
diff --git a/db/migrate/20170925154017_create_referential_suite_for_each_existing_workbench.rb b/db/migrate/20170925154017_create_referential_suite_for_each_existing_workbench.rb
new file mode 100644
index 000000000..530850a5a
--- /dev/null
+++ b/db/migrate/20170925154017_create_referential_suite_for_each_existing_workbench.rb
@@ -0,0 +1,12 @@
+class CreateReferentialSuiteForEachExistingWorkbench < ActiveRecord::Migration
+ def up
+ Workbench.where(output: nil).each do |workbench|
+ workbench.output = ReferentialSuite.create
+ workbench.save
+ end
+ end
+
+ def down
+ raise ActiveRecord::IrreversibleMigration
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 89f002aee..c95280051 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: 20170922165315) do
+ActiveRecord::Schema.define(version: 20170925154017) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -969,6 +969,7 @@ ActiveRecord::Schema.define(version: 20170922165315) do
t.datetime "updated_at"
t.integer "line_referential_id", limit: 8
t.integer "stop_area_referential_id", limit: 8
+ t.integer "output_id", limit: 8
end
add_index "workbenches", ["line_referential_id"], name: "index_workbenches_on_line_referential_id", using: :btree