Migrate mails to new system
This commit is contained in:
parent
c1953592b7
commit
63681cfded
2 changed files with 12 additions and 1 deletions
11
db/migrate/20170307092820_move_mails_to_new_system.rb
Normal file
11
db/migrate/20170307092820_move_mails_to_new_system.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
class MoveMailsToNewSystem < ActiveRecord::Migration[5.0]
|
||||
def up
|
||||
execute 'INSERT INTO received_mails (object, body, procedure_id, created_at, updated_at)
|
||||
SELECT object, body, procedure_id, mail_templates.created_at, mail_templates.updated_at from mail_templates inner join procedures on mail_templates.procedure_id = procedures.id;'
|
||||
|
||||
execute "UPDATE received_mails set created_at='1980-01-01 00:00', updated_at='1980-01-01 00:00' where created_at is NULL"
|
||||
|
||||
change_column_null :received_mails, :created_at, false
|
||||
change_column_null :received_mails, :updated_at, false
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20170306102320) do
|
||||
ActiveRecord::Schema.define(version: 20170307092820) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
|
Loading…
Reference in a new issue