added services
This commit is contained in:
39
services/db/migrate/20221115164901_setup.rb
Normal file
39
services/db/migrate/20221115164901_setup.rb
Normal file
@ -0,0 +1,39 @@
|
||||
class Setup < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
enable_extension 'uuid-ossp'
|
||||
enable_extension 'pgcrypto'
|
||||
|
||||
create_table :senders, id: :string do |t|
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :recipients, id: :string do |t|
|
||||
t.string :verification_status, default: 'unverified', nullable: false
|
||||
t.datetime :last_verified_at, nullable: true
|
||||
t.string :bounce_status , default: 'unknown'
|
||||
t.datetime :bounce_status_changed_at, nullable: true
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :received_mails, id: :uuid do |t|
|
||||
t.string :sender_id, nullable: false
|
||||
t.string :message_id, nullable: false
|
||||
t.binary :body, nullable: false
|
||||
t.string :delivery_status, default: 'queued', nullable: false
|
||||
t.string :delivery_status_changed_at
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :mail_recipients, id: false do |t|
|
||||
t.uuid :received_mail_id
|
||||
t.string :recipient_id
|
||||
t.string :delivery_status, default: 'delivered', nullable: false
|
||||
t.string :delivery_status_changed_at
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :received_mails, :sender_id
|
||||
add_index :received_mails, :message_id, unique: true
|
||||
add_index :mail_recipients, %i[received_mail_id recipient_id], unique: true
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user