Change primary key to bigint on repositories [SCI-2614][SCI-2616][SCI-2617]

This commit is contained in:
Oleksii Kriuchykhin 2018-08-06 17:36:16 +02:00
parent 6004f8411b
commit 938ec5acb8
6 changed files with 35 additions and 13 deletions

View file

@ -3,7 +3,7 @@ AllCops:
- "vendor/**/*"
- "db/schema.rb"
UseCache: false
TargetRubyVersion: 2.2
TargetRubyVersion: 2.4
##################### Style ####################################

View file

@ -51,7 +51,6 @@ gem 'rgl' # Graph framework for project diagram calculations
gem 'nested_form_fields'
gem 'ajax-datatables-rails', '~> 0.3.1'
gem 'commit_param_routing' # Enables different submit actions in the same form to route to different actions in controller
gem 'kaminari'
gem 'i18n-js', '~> 3.0' # Localization in javascript files
gem 'roo', '~> 2.7.1' # Spreadsheet parser
gem 'wicked_pdf', '~> 1.1.0'

View file

@ -0,0 +1,23 @@
class ChangePrimaryKeyToBigintOnRepositories < ActiveRecord::Migration[5.1]
def up
change_column :repository_rows, :id, :bigint
change_column :repository_columns, :id, :bigint
change_column :repository_cells, :id, :bigint
change_column :repository_cells, :repository_row_id, :bigint
change_column :repository_cells, :value_id, :bigint
change_column :repository_text_values, :id, :bigint
change_column :repository_date_values, :id, :bigint
change_column :my_module_repository_rows, :repository_row_id, :bigint
end
def down
change_column :repository_rows, :id, :integer
change_column :repository_columns, :id, :integer
change_column :repository_cells, :id, :integer
change_column :repository_cells, :repository_row_id, :integer
change_column :repository_cells, :value_id, :integer
change_column :repository_text_values, :id, :integer
change_column :repository_date_values, :id, :integer
change_column :my_module_repository_rows, :repository_row_id, :integer
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20180524091143) do
ActiveRecord::Schema.define(version: 20180806115201) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -181,7 +181,7 @@ ActiveRecord::Schema.define(version: 20180524091143) do
end
create_table "my_module_repository_rows", id: :serial, force: :cascade do |t|
t.integer "repository_row_id", null: false
t.bigint "repository_row_id", null: false
t.integer "my_module_id"
t.integer "assigned_by_id", null: false
t.datetime "created_at"
@ -379,11 +379,11 @@ ActiveRecord::Schema.define(version: 20180524091143) do
t.index ["last_modified_by_id"], name: "index_repository_asset_values_on_last_modified_by_id"
end
create_table "repository_cells", id: :serial, force: :cascade do |t|
t.integer "repository_row_id"
create_table "repository_cells", force: :cascade do |t|
t.bigint "repository_row_id"
t.integer "repository_column_id"
t.string "value_type"
t.integer "value_id"
t.bigint "value_id"
t.datetime "created_at"
t.datetime "updated_at"
t.index ["repository_column_id"], name: "index_repository_cells_on_repository_column_id"
@ -391,7 +391,7 @@ ActiveRecord::Schema.define(version: 20180524091143) do
t.index ["value_type", "value_id"], name: "index_repository_cells_on_value_type_and_value_id"
end
create_table "repository_columns", id: :serial, force: :cascade do |t|
create_table "repository_columns", force: :cascade do |t|
t.integer "repository_id"
t.integer "created_by_id", null: false
t.string "name"
@ -401,7 +401,7 @@ ActiveRecord::Schema.define(version: 20180524091143) do
t.index ["repository_id"], name: "index_repository_columns_on_repository_id"
end
create_table "repository_date_values", id: :serial, force: :cascade do |t|
create_table "repository_date_values", force: :cascade do |t|
t.datetime "data"
t.datetime "created_at"
t.datetime "updated_at"
@ -435,7 +435,7 @@ ActiveRecord::Schema.define(version: 20180524091143) do
t.index ["repository_list_item_id"], name: "index_repository_list_values_on_repository_list_item_id"
end
create_table "repository_rows", id: :serial, force: :cascade do |t|
create_table "repository_rows", force: :cascade do |t|
t.integer "repository_id"
t.integer "created_by_id", null: false
t.integer "last_modified_by_id", null: false
@ -456,7 +456,7 @@ ActiveRecord::Schema.define(version: 20180524091143) do
t.index ["user_id"], name: "index_repository_table_states_on_user_id"
end
create_table "repository_text_values", id: :serial, force: :cascade do |t|
create_table "repository_text_values", force: :cascade do |t|
t.string "data"
t.datetime "created_at"
t.datetime "updated_at"

View file

@ -2,7 +2,7 @@ version: '2'
services:
db:
container_name: scinote_db_production
image: postgres:9.4
image: postgres:9.6
volumes:
- scinote_production_postgres:/var/lib/postgresql/data

View file

@ -2,7 +2,7 @@ version: '2'
services:
db:
container_name: scinote_db_development
image: postgres:9.4
image: postgres:9.6
volumes:
- scinote_development_postgres:/var/lib/postgresql/data