Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions db/migrate/20180206152600_relax_citations.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class RelaxCitations < ActiveRecord::Migration
def self.up
# Use longer "text" field
change_column :citations, :title, :text
change_column :citations, :journal, :text
add_column :citations, :notes, :text

# This constraint is draconian and totally unnecessary.
# Other metadata should be plenty sufficient without well-formed page number
execute %q{
ALTER TABLE citations
DROP CONSTRAINT well_formed_citation_page_spec;
}
end

def self.down
change_column :citations, :title, :string
change_column :citations, :journal, :string
remove_column :citations, :notes, :text
execute %q{
ALTER TABLE citations
ADD CONSTRAINT well_formed_citation_page_spec CHECK (pg ~ '^([1-9]\d*(\u2013[1-9]\d*)?)?$');
}
end
end