mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 17:51:13 +08:00
Merge pull request #1150 from ZmagoD/zd_SCI_2426
migrations that fixes the bug with smart annotations [fixes SCI-2426]
This commit is contained in:
commit
2ac04ee476
3 changed files with 11 additions and 4 deletions
|
@ -7,8 +7,8 @@ class Repository < ApplicationRecord
|
|||
foreign_key: :created_by_id,
|
||||
class_name: 'User',
|
||||
optional: true
|
||||
has_many :repository_columns
|
||||
has_many :repository_rows
|
||||
has_many :repository_columns, dependent: :destroy
|
||||
has_many :repository_rows, dependent: :destroy
|
||||
has_many :repository_table_states,
|
||||
inverse_of: :repository, dependent: :destroy
|
||||
has_many :report_elements, inverse_of: :repository, dependent: :destroy
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
class RemoveRepositoryRowsAndColumnsWithoutRepository < ActiveRecord::Migration[5.1]
|
||||
def up
|
||||
repository_ids = Repository.select(:id)
|
||||
RepositoryRow.where.not(repository_id: repository_ids).delete_all
|
||||
RepositoryColumn.where.not(repository_id: repository_ids).delete_all
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20180417062042) do
|
||||
ActiveRecord::Schema.define(version: 20180518113526) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
|
Loading…
Reference in a new issue