mirror of
https://github.com/internetee/registry.git
synced 2025-07-30 14:36:22 +02:00
feat: Add admin contacts validation settings migration
Add migration to create new settings for admin contacts validation: - admin_contacts_required_for_org: boolean setting to require admin contacts for organizations - admin_contacts_required_for_minors: boolean setting to require admin contacts for minors - admin_contacts_allowed_ident_type: array setting to specify allowed identification types for admin contacts The migration safely handles existing settings by checking for their presence before creation. Default values are set to maintain backwards compatibility while enforcing new validation rules.
This commit is contained in:
parent
f2978599b4
commit
dc37223bc2
2 changed files with 101 additions and 2 deletions
|
@ -0,0 +1,48 @@
|
|||
class AddAdminContactsRulesToSettings < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
unless SettingEntry.exists?(code: 'admin_contacts_required_for_org')
|
||||
SettingEntry.create!(
|
||||
code: 'admin_contacts_required_for_org',
|
||||
value: 'true',
|
||||
format: 'boolean',
|
||||
group: 'domain_validation'
|
||||
)
|
||||
else
|
||||
puts "SettingEntry admin_contacts_required_for_org already exists"
|
||||
end
|
||||
|
||||
unless SettingEntry.exists?(code: 'admin_contacts_required_for_minors')
|
||||
SettingEntry.create!(
|
||||
code: 'admin_contacts_required_for_minors',
|
||||
value: 'true',
|
||||
format: 'boolean',
|
||||
group: 'domain_validation'
|
||||
)
|
||||
else
|
||||
puts "SettingEntry admin_contacts_required_for_minors already exists"
|
||||
end
|
||||
|
||||
unless SettingEntry.exists?(code: 'admin_contacts_allowed_ident_type')
|
||||
SettingEntry.create!(
|
||||
code: 'admin_contacts_allowed_ident_type',
|
||||
value: {
|
||||
'birthday' => true,
|
||||
'priv' => true,
|
||||
'org' => false
|
||||
}.to_json,
|
||||
format: 'array',
|
||||
group: 'domain_validation'
|
||||
)
|
||||
else
|
||||
puts "SettingEntry admin_contacts_allowed_ident_type already exists"
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
SettingEntry.where(code: [
|
||||
'admin_contacts_required_for_org',
|
||||
'admin_contacts_required_for_minors',
|
||||
'admin_contacts_allowed_ident_type'
|
||||
]).destroy_all
|
||||
end
|
||||
end
|
|
@ -1168,6 +1168,38 @@ CREATE SEQUENCE public.epp_sessions_id_seq
|
|||
ALTER SEQUENCE public.epp_sessions_id_seq OWNED BY public.epp_sessions.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: free_domain_reservation_holders; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.free_domain_reservation_holders (
|
||||
id bigint NOT NULL,
|
||||
user_unique_id character varying NOT NULL,
|
||||
domain_names character varying[] DEFAULT '{}'::character varying[],
|
||||
created_at timestamp(6) without time zone NOT NULL,
|
||||
updated_at timestamp(6) without time zone NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: free_domain_reservation_holders_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.free_domain_reservation_holders_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: free_domain_reservation_holders_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.free_domain_reservation_holders_id_seq OWNED BY public.free_domain_reservation_holders.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: invoice_items; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -2675,7 +2707,8 @@ CREATE TABLE public.reserved_domains (
|
|||
updator_str character varying,
|
||||
legacy_id integer,
|
||||
name character varying NOT NULL,
|
||||
password character varying NOT NULL
|
||||
password character varying NOT NULL,
|
||||
expire_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
|
@ -3185,6 +3218,13 @@ ALTER TABLE ONLY public.epp_logs ALTER COLUMN id SET DEFAULT nextval('public.epp
|
|||
ALTER TABLE ONLY public.epp_sessions ALTER COLUMN id SET DEFAULT nextval('public.epp_sessions_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: free_domain_reservation_holders id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.free_domain_reservation_holders ALTER COLUMN id SET DEFAULT nextval('public.free_domain_reservation_holders_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: invoice_items id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -3714,6 +3754,14 @@ ALTER TABLE ONLY public.epp_sessions
|
|||
ADD CONSTRAINT epp_sessions_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: free_domain_reservation_holders free_domain_reservation_holders_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.free_domain_reservation_holders
|
||||
ADD CONSTRAINT free_domain_reservation_holders_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: invoice_items invoice_items_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -5667,6 +5715,9 @@ INSERT INTO "schema_migrations" (version) VALUES
|
|||
('20241030095636'),
|
||||
('20241104104620'),
|
||||
('20241112093540'),
|
||||
('20241112124405');
|
||||
('20241112124405'),
|
||||
('20241129095711'),
|
||||
('20241206085817'),
|
||||
('20250204094550');
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue