mirror of
https://github.com/internetee/registry.git
synced 2025-06-13 08:04:45 +02:00
parent
8c5478bb6f
commit
9697752823
4 changed files with 15 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
class Message < ActiveRecord::Base
|
||||
include Versions # version/message_version.rb
|
||||
belongs_to :registrar
|
||||
belongs_to :registrar, required: true
|
||||
|
||||
before_create -> { self.queued = true }
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class ChangeMessagesRegistrarIdToNotNull < ActiveRecord::Migration
|
||||
def change
|
||||
change_column_null :messages, :registrar_id, false
|
||||
end
|
||||
end
|
|
@ -2183,7 +2183,7 @@ ALTER SEQUENCE mail_templates_id_seq OWNED BY mail_templates.id;
|
|||
|
||||
CREATE TABLE messages (
|
||||
id integer NOT NULL,
|
||||
registrar_id integer,
|
||||
registrar_id integer NOT NULL,
|
||||
body character varying NOT NULL,
|
||||
attached_obj_type character varying,
|
||||
attached_obj_id integer,
|
||||
|
@ -5094,6 +5094,8 @@ INSERT INTO schema_migrations (version) VALUES ('20180207071528');
|
|||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20180207072139');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20180211011450');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20180211011948');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20180212123810');
|
||||
|
|
|
@ -14,4 +14,10 @@ class MessageTest < ActiveSupport::TestCase
|
|||
@message.validate
|
||||
assert @message.invalid?
|
||||
end
|
||||
|
||||
def test_invalid_without_registrar
|
||||
@message.registrar = nil
|
||||
@message.validate
|
||||
assert @message.invalid?
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue