diff options
| author | Vlatka Pavisic | 2017-03-01 16:19:40 +0100 |
|---|---|---|
| committer | Vlatka Pavisic | 2017-03-01 16:20:00 +0100 |
| commit | c1b5903d9cc3143c5d026adf38e3b2d7ddcb125e (patch) | |
| tree | 4dee709d2da9f8b5629e6b2f6cca239ace90dd72 /db | |
| parent | 405bd98b208060456bf1926efe8a293c9de4de34 (diff) | |
| download | chouette-core-c1b5903d9cc3143c5d026adf38e3b2d7ddcb125e.tar.bz2 | |
Refs #2686 : Change foreign key type to bigint
Diffstat (limited to 'db')
| -rw-r--r-- | db/migrate/20170301145604_change_foreign_keys_to_bigint.rb | 46 | ||||
| -rw-r--r-- | db/schema.rb | 124 |
2 files changed, 97 insertions, 73 deletions
diff --git a/db/migrate/20170301145604_change_foreign_keys_to_bigint.rb b/db/migrate/20170301145604_change_foreign_keys_to_bigint.rb new file mode 100644 index 000000000..cc89198c5 --- /dev/null +++ b/db/migrate/20170301145604_change_foreign_keys_to_bigint.rb @@ -0,0 +1,46 @@ +class ChangeForeignKeysToBigint < ActiveRecord::Migration + def change + change_column :stop_area_referential_syncs, :stop_area_referential_id, :bigint + change_column :stop_area_referential_sync_messages, :stop_area_referential_sync_id, :bigint + change_column :stop_area_referential_memberships, :organisation_id, :bigint + change_column :stop_area_referential_memberships, :stop_area_referential_id, :bigint + change_column :line_referential_memberships, :organisation_id, :bigint + change_column :line_referential_memberships, :line_referential_id, :bigint + change_column :line_referential_sync_messages, :line_referential_sync_id, :bigint + change_column :line_referential_syncs, :line_referential_id, :bigint + change_column :referential_metadata, :referential_id, :bigint + change_column :referential_metadata, :line_ids, :bigint, array: true + change_column :referential_metadata, :referential_source_id, :bigint + change_column :workbenches, :organisation_id, :bigint + change_column :workbenches, :line_referential_id, :bigint + change_column :workbenches, :stop_area_referential_id, :bigint + change_column :api_keys, :referential_id, :bigint + change_column :calendars, :organisation_id, :bigint + change_column :clean_up_results, :clean_up_id, :bigint + change_column :clean_ups, :referential_id, :bigint + change_column :companies, :line_referential_id, :bigint + change_column :group_of_lines, :line_referential_id, :bigint + change_column :import_messages, :import_id, :bigint + change_column :import_messages, :resource_id, :bigint + change_column :import_resources, :import_id, :bigint + change_column :imports, :workbench_id, :bigint + change_column :imports, :referential_id, :bigint + change_column :lines, :line_referential_id, :bigint + change_column :lines, :secondary_company_ids, :bigint, array: true + change_column :networks, :line_referential_id, :bigint + change_column :referential_clonings, :source_referential_id, :bigint + change_column :referential_clonings, :target_referential_id, :bigint + change_column :referentials, :line_referential_id, :bigint + change_column :referentials, :stop_area_referential_id, :bigint + change_column :referentials, :workbench_id, :bigint + change_column :referentials, :created_from_id, :bigint + change_column :routing_constraint_zones, :line_id, :bigint + change_column :stop_areas, :stop_area_referential_id, :bigint + change_column :taggings, :tag_id, :bigint + change_column :taggings, :taggable_id, :bigint + change_column :taggings, :tagger_id, :bigint + change_column :time_tables, :calendar_id, :bigint + change_column :users, :organisation_id, :bigint + change_column :users, :invited_by_id, :bigint + end +end diff --git a/db/schema.rb b/db/schema.rb index eb966ba00..5ef4dbd20 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,11 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -<<<<<<< Updated upstream -ActiveRecord::Schema.define(version: 20170228135627) do -======= -ActiveRecord::Schema.define(version: 20170218111254) do ->>>>>>> Stashed changes +ActiveRecord::Schema.define(version: 20170301145604) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -76,7 +72,7 @@ ActiveRecord::Schema.define(version: 20170218111254) do add_index "access_points", ["objectid"], :name => "access_points_objectid_key", :unique => true create_table "api_keys", force: true do |t| - t.integer "referential_id" + t.integer "referential_id", limit: 8 t.string "token" t.string "name" t.datetime "created_at" @@ -86,10 +82,10 @@ ActiveRecord::Schema.define(version: 20170218111254) do create_table "calendars", force: true do |t| t.string "name" t.string "short_name" - t.daterange "date_ranges", array: true - t.date "dates", array: true + t.daterange "date_ranges", array: true + t.date "dates", array: true t.boolean "shared" - t.integer "organisation_id" + t.integer "organisation_id", limit: 8 t.datetime "created_at" t.datetime "updated_at" end @@ -100,7 +96,7 @@ ActiveRecord::Schema.define(version: 20170218111254) do create_table "clean_up_results", force: true do |t| t.string "message_key" t.hstore "message_attributs" - t.integer "clean_up_id" + t.integer "clean_up_id", limit: 8 t.datetime "created_at" t.datetime "updated_at" end @@ -111,7 +107,7 @@ ActiveRecord::Schema.define(version: 20170218111254) do t.string "status" t.datetime "started_at" t.datetime "ended_at" - t.integer "referential_id" + t.integer "referential_id", limit: 8 t.datetime "begin_date" t.datetime "created_at" t.datetime "updated_at" @@ -135,7 +131,7 @@ ActiveRecord::Schema.define(version: 20170218111254) do t.string "registration_number" t.string "url" t.string "time_zone" - t.integer "line_referential_id" + t.integer "line_referential_id", limit: 8 t.text "import_xml" t.datetime "created_at" t.datetime "updated_at" @@ -169,22 +165,6 @@ ActiveRecord::Schema.define(version: 20170218111254) do add_index "connection_links", ["objectid"], :name => "connection_links_objectid_key", :unique => true - create_table "delayed_jobs", force: true do |t| - t.integer "priority", default: 0 - t.integer "attempts", default: 0 - t.text "handler" - t.text "last_error" - t.datetime "run_at" - t.datetime "locked_at" - t.datetime "failed_at" - t.string "locked_by" - t.string "queue" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" - create_table "exports", force: true do |t| t.integer "referential_id", limit: 8 t.string "status" @@ -249,7 +229,7 @@ ActiveRecord::Schema.define(version: 20170218111254) do t.string "name" t.string "comment" t.string "registration_number" - t.integer "line_referential_id" + t.integer "line_referential_id", limit: 8 t.text "import_xml" t.datetime "created_at" t.datetime "updated_at" @@ -267,8 +247,8 @@ ActiveRecord::Schema.define(version: 20170218111254) do t.integer "criticity" t.string "message_key" t.hstore "message_attributs" - t.integer "import_id" - t.integer "resource_id" + t.integer "import_id", limit: 8 + t.integer "resource_id", limit: 8 t.datetime "created_at" t.datetime "updated_at" end @@ -277,7 +257,7 @@ ActiveRecord::Schema.define(version: 20170218111254) do add_index "import_messages", ["resource_id"], :name => "index_import_messages_on_resource_id" create_table "import_resources", force: true do |t| - t.integer "import_id" + t.integer "import_id", limit: 8 t.string "status" t.datetime "created_at" t.datetime "updated_at" @@ -289,8 +269,8 @@ ActiveRecord::Schema.define(version: 20170218111254) do t.string "status" t.string "current_step_id" t.float "current_step_progress" - t.integer "workbench_id" - t.integer "referential_id" + t.integer "workbench_id", limit: 8 + t.integer "referential_id", limit: 8 t.string "name" t.datetime "created_at" t.datetime "updated_at" @@ -355,8 +335,8 @@ ActiveRecord::Schema.define(version: 20170218111254) do add_index "journey_patterns_stop_points", ["journey_pattern_id"], :name => "index_journey_pattern_id_on_journey_patterns_stop_points" create_table "line_referential_memberships", force: true do |t| - t.integer "organisation_id" - t.integer "line_referential_id" + t.integer "organisation_id", limit: 8 + t.integer "line_referential_id", limit: 8 t.boolean "owner" end @@ -364,7 +344,7 @@ ActiveRecord::Schema.define(version: 20170218111254) do t.integer "criticity" t.string "message_key" t.hstore "message_attributs" - t.integer "line_referential_sync_id" + t.integer "line_referential_sync_id", limit: 8 t.datetime "created_at" t.datetime "updated_at" end @@ -372,7 +352,7 @@ ActiveRecord::Schema.define(version: 20170218111254) do add_index "line_referential_sync_messages", ["line_referential_sync_id"], :name => "line_referential_sync_id" create_table "line_referential_syncs", force: true do |t| - t.integer "line_referential_id" + t.integer "line_referential_id", limit: 8 t.datetime "created_at" t.datetime "updated_at" t.datetime "started_at" @@ -408,11 +388,11 @@ ActiveRecord::Schema.define(version: 20170218111254) do t.string "color", limit: 6 t.string "text_color", limit: 6 t.string "stable_id" - t.integer "line_referential_id" + t.integer "line_referential_id", limit: 8 t.boolean "deactivated", default: false t.text "import_xml" t.string "transport_submode" - t.integer "secondary_company_ids", array: true + t.integer "secondary_company_ids", limit: 8, array: true t.datetime "created_at" t.datetime "updated_at" end @@ -435,7 +415,7 @@ ActiveRecord::Schema.define(version: 20170218111254) do t.string "source_identifier" t.string "comment" t.text "import_xml" - t.integer "line_referential_id" + t.integer "line_referential_id", limit: 8 t.datetime "created_at" t.datetime "updated_at" end @@ -476,8 +456,8 @@ ActiveRecord::Schema.define(version: 20170218111254) do t.string "status" t.datetime "started_at" t.datetime "ended_at" - t.integer "source_referential_id" - t.integer "target_referential_id" + t.integer "source_referential_id", limit: 8 + t.integer "target_referential_id", limit: 8 t.datetime "created_at" t.datetime "updated_at" end @@ -486,12 +466,12 @@ ActiveRecord::Schema.define(version: 20170218111254) do add_index "referential_clonings", ["target_referential_id"], :name => "index_referential_clonings_on_target_referential_id" create_table "referential_metadata", force: true do |t| - t.integer "referential_id" - t.integer "line_ids", array: true - t.integer "referential_source_id" + t.integer "referential_id", limit: 8 + t.integer "line_ids", limit: 8, array: true + t.integer "referential_source_id", limit: 8 t.datetime "created_at" t.datetime "updated_at" - t.daterange "periodes", array: true + t.daterange "periodes", array: true end add_index "referential_metadata", ["line_ids"], :name => "index_referential_metadata_on_line_ids" @@ -512,11 +492,11 @@ ActiveRecord::Schema.define(version: 20170218111254) do t.integer "user_id", limit: 8 t.string "user_name" t.string "data_format" - t.integer "line_referential_id" - t.integer "stop_area_referential_id" - t.integer "workbench_id" + t.integer "line_referential_id", limit: 8 + t.integer "stop_area_referential_id", limit: 8 + t.integer "workbench_id", limit: 8 t.datetime "archived_at" - t.integer "created_from_id" + t.integer "created_from_id", limit: 8 t.boolean "ready", default: false end @@ -557,7 +537,7 @@ ActiveRecord::Schema.define(version: 20170218111254) do create_table "routing_constraint_zones", force: true do |t| t.string "name" t.integer "stop_area_ids", array: true - t.integer "line_id" + t.integer "line_id", limit: 8 t.datetime "created_at" t.datetime "updated_at" t.string "objectid", null: false @@ -581,8 +561,8 @@ ActiveRecord::Schema.define(version: 20170218111254) do end create_table "stop_area_referential_memberships", force: true do |t| - t.integer "organisation_id" - t.integer "stop_area_referential_id" + t.integer "organisation_id", limit: 8 + t.integer "stop_area_referential_id", limit: 8 t.boolean "owner" end @@ -590,7 +570,7 @@ ActiveRecord::Schema.define(version: 20170218111254) do t.integer "criticity" t.string "message_key" t.hstore "message_attributs" - t.integer "stop_area_referential_sync_id" + t.integer "stop_area_referential_sync_id", limit: 8 t.datetime "created_at" t.datetime "updated_at" end @@ -598,7 +578,7 @@ ActiveRecord::Schema.define(version: 20170218111254) do add_index "stop_area_referential_sync_messages", ["stop_area_referential_sync_id"], :name => "stop_area_referential_sync_id" create_table "stop_area_referential_syncs", force: true do |t| - t.integer "stop_area_referential_id" + t.integer "stop_area_referential_id", limit: 8 t.datetime "created_at" t.datetime "updated_at" t.datetime "ended_at" @@ -638,7 +618,7 @@ ActiveRecord::Schema.define(version: 20170218111254) do t.string "city_name" t.string "url" t.string "time_zone" - t.integer "stop_area_referential_id" + t.integer "stop_area_referential_id", limit: 8 t.string "status" t.text "import_xml" t.datetime "deleted_at" @@ -672,10 +652,10 @@ ActiveRecord::Schema.define(version: 20170218111254) do add_index "stop_points", ["objectid"], :name => "stop_points_objectid_key", :unique => true create_table "taggings", force: true do |t| - t.integer "tag_id" - t.integer "taggable_id" + t.integer "tag_id", limit: 8 + t.integer "taggable_id", limit: 8 t.string "taggable_type" - t.integer "tagger_id" + t.integer "tagger_id", limit: 8 t.string "tagger_type" t.string "context", limit: 128 t.datetime "created_at" @@ -718,7 +698,7 @@ ActiveRecord::Schema.define(version: 20170218111254) do t.integer "int_day_types", default: 0 t.date "start_date" t.date "end_date" - t.integer "calendar_id" + t.integer "calendar_id", limit: 8 t.datetime "created_at" t.datetime "updated_at" end @@ -756,25 +736,25 @@ ActiveRecord::Schema.define(version: 20170218111254) do end create_table "users", force: true do |t| - t.string "email", default: "", null: false - t.string "encrypted_password", default: "" + t.string "email", default: "", null: false + t.string "encrypted_password", default: "" t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0 + t.integer "sign_in_count", default: 0 t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" t.datetime "created_at" t.datetime "updated_at" - t.integer "organisation_id" + t.integer "organisation_id", limit: 8 t.string "name" t.string "confirmation_token" t.datetime "confirmed_at" t.datetime "confirmation_sent_at" t.string "unconfirmed_email" - t.integer "failed_attempts", default: 0 + t.integer "failed_attempts", default: 0 t.string "unlock_token" t.datetime "locked_at" t.string "authentication_token" @@ -782,12 +762,12 @@ ActiveRecord::Schema.define(version: 20170218111254) do t.datetime "invitation_sent_at" t.datetime "invitation_accepted_at" t.integer "invitation_limit" - t.integer "invited_by_id" + t.integer "invited_by_id", limit: 8 t.string "invited_by_type" t.datetime "invitation_created_at" t.string "username" t.datetime "synced_at" - t.string "permissions", array: true + t.string "permissions", array: true end add_index "users", ["email"], :name => "index_users_on_email", :unique => true @@ -836,11 +816,11 @@ ActiveRecord::Schema.define(version: 20170218111254) do create_table "workbenches", force: true do |t| t.string "name" - t.integer "organisation_id" + t.integer "organisation_id", limit: 8 t.datetime "created_at" t.datetime "updated_at" - t.integer "line_referential_id" - t.integer "stop_area_referential_id" + t.integer "line_referential_id", limit: 8 + t.integer "stop_area_referential_id", limit: 8 end add_index "workbenches", ["line_referential_id"], :name => "index_workbenches_on_line_referential_id" @@ -848,8 +828,6 @@ ActiveRecord::Schema.define(version: 20170218111254) do add_index "workbenches", ["stop_area_referential_id"], :name => "index_workbenches_on_stop_area_referential_id" Foreigner.load - add_foreign_key "access_links", "access_points", name: "aclk_acpt_fkey", dependent: :delete - add_foreign_key "group_of_lines_lines", "group_of_lines", name: "groupofline_group_fkey", dependent: :delete add_foreign_key "journey_frequencies", "timebands", name: "journey_frequencies_timeband_id_fk", dependent: :nullify |
