mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 01:35:34 +08:00
migrations that fixes the bug with smart annotations [fixes SCI-2426]
This commit is contained in:
parent
c3d247faae
commit
b8098093ee
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
|
||||
|
@ -60,7 +60,7 @@ class Repository < ApplicationRecord
|
|||
def self.name_like(query)
|
||||
where('repositories.name ILIKE ?', "%#{query}%")
|
||||
end
|
||||
|
||||
|
||||
def importable_repository_fields
|
||||
fields = {}
|
||||
# First and foremost add record name
|
||||
|
|
|
@ -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