Refactor zones

- Rename "zonefile_setting" to "zone"
- Remove version

#475
This commit is contained in:
Artur Beljajev 2017-04-20 17:20:36 +03:00
parent f1d7e53734
commit bff7437277
51 changed files with 425 additions and 389 deletions

View file

@ -0,0 +1,5 @@
class RenameZonefileSettingsToZones < ActiveRecord::Migration
def change
rename_table :zonefile_settings, :zones
end
end

View file

@ -0,0 +1,5 @@
class RemoveLogZonefileSettings < ActiveRecord::Migration
def change
drop_table :log_zonefile_settings
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170221115548) do
ActiveRecord::Schema.define(version: 20170420125200) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -914,22 +914,6 @@ ActiveRecord::Schema.define(version: 20170221115548) do
t.string "uuid"
end
create_table "log_zonefile_settings", force: :cascade do |t|
t.string "item_type", null: false
t.integer "item_id", null: false
t.string "event", null: false
t.string "whodunnit"
t.json "object"
t.json "object_changes"
t.datetime "created_at"
t.string "session"
t.json "children"
t.string "uuid"
end
add_index "log_zonefile_settings", ["item_type", "item_id"], name: "index_log_zonefile_settings_on_item_type_and_item_id", using: :btree
add_index "log_zonefile_settings", ["whodunnit"], name: "index_log_zonefile_settings_on_whodunnit", using: :btree
create_table "mail_templates", force: :cascade do |t|
t.string "name", null: false
t.string "subject"
@ -1141,7 +1125,7 @@ ActiveRecord::Schema.define(version: 20170221115548) do
add_index "whois_records", ["domain_id"], name: "index_whois_records_on_domain_id", using: :btree
add_index "whois_records", ["registrar_id"], name: "index_whois_records_on_registrar_id", using: :btree
create_table "zonefile_settings", force: :cascade do |t|
create_table "zones", force: :cascade do |t|
t.string "origin"
t.integer "ttl"
t.integer "refresh"

View file

@ -34,7 +34,7 @@ ActiveRecord::Base.transaction do
roles: ['admin']
)
ZonefileSetting.create!(
DNS::Zone.create!(
origin: 'tld',
ttl: 43200,
refresh: 3600,

View file

@ -2374,44 +2374,6 @@ CREATE SEQUENCE log_white_ips_id_seq
ALTER SEQUENCE log_white_ips_id_seq OWNED BY log_white_ips.id;
--
-- Name: log_zonefile_settings; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE log_zonefile_settings (
id integer NOT NULL,
item_type character varying NOT NULL,
item_id integer NOT NULL,
event character varying NOT NULL,
whodunnit character varying,
object json,
object_changes json,
created_at timestamp without time zone,
session character varying,
children json,
uuid character varying
);
--
-- Name: log_zonefile_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE log_zonefile_settings_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: log_zonefile_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE log_zonefile_settings_id_seq OWNED BY log_zonefile_settings.id;
--
-- Name: mail_templates; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
@ -2968,10 +2930,10 @@ ALTER SEQUENCE whois_records_id_seq OWNED BY whois_records.id;
--
-- Name: zonefile_settings; Type: TABLE; Schema: public; Owner: -; Tablespace:
-- Name: zones; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE zonefile_settings (
CREATE TABLE zones (
id integer NOT NULL,
origin character varying,
ttl integer,
@ -2992,10 +2954,10 @@ CREATE TABLE zonefile_settings (
--
-- Name: zonefile_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
-- Name: zones_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE zonefile_settings_id_seq
CREATE SEQUENCE zones_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@ -3004,10 +2966,10 @@ CREATE SEQUENCE zonefile_settings_id_seq
--
-- Name: zonefile_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
-- Name: zones_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE zonefile_settings_id_seq OWNED BY zonefile_settings.id;
ALTER SEQUENCE zones_id_seq OWNED BY zones.id;
--
@ -3381,13 +3343,6 @@ ALTER TABLE ONLY log_users ALTER COLUMN id SET DEFAULT nextval('log_users_id_seq
ALTER TABLE ONLY log_white_ips ALTER COLUMN id SET DEFAULT nextval('log_white_ips_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY log_zonefile_settings ALTER COLUMN id SET DEFAULT nextval('log_zonefile_settings_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
@ -3490,7 +3445,7 @@ ALTER TABLE ONLY whois_records ALTER COLUMN id SET DEFAULT nextval('whois_record
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY zonefile_settings ALTER COLUMN id SET DEFAULT nextval('zonefile_settings_id_seq'::regclass);
ALTER TABLE ONLY zones ALTER COLUMN id SET DEFAULT nextval('zones_id_seq'::regclass);
--
@ -3917,14 +3872,6 @@ ALTER TABLE ONLY log_white_ips
ADD CONSTRAINT log_white_ips_pkey PRIMARY KEY (id);
--
-- Name: log_zonefile_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY log_zonefile_settings
ADD CONSTRAINT log_zonefile_settings_pkey PRIMARY KEY (id);
--
-- Name: mail_templates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
@ -4038,11 +3985,11 @@ ALTER TABLE ONLY whois_records
--
-- Name: zonefile_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
-- Name: zones_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY zonefile_settings
ADD CONSTRAINT zonefile_settings_pkey PRIMARY KEY (id);
ALTER TABLE ONLY zones
ADD CONSTRAINT zones_pkey PRIMARY KEY (id);
--
@ -4675,20 +4622,6 @@ CREATE INDEX index_log_users_on_item_type_and_item_id ON log_users USING btree (
CREATE INDEX index_log_users_on_whodunnit ON log_users USING btree (whodunnit);
--
-- Name: index_log_zonefile_settings_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_log_zonefile_settings_on_item_type_and_item_id ON log_zonefile_settings USING btree (item_type, item_id);
--
-- Name: index_log_zonefile_settings_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_log_zonefile_settings_on_whodunnit ON log_zonefile_settings USING btree (whodunnit);
--
-- Name: index_messages_on_registrar_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@ -5280,3 +5213,7 @@ INSERT INTO schema_migrations (version) VALUES ('20161227193500');
INSERT INTO schema_migrations (version) VALUES ('20170221115548');
INSERT INTO schema_migrations (version) VALUES ('20170419120048');
INSERT INTO schema_migrations (version) VALUES ('20170420125200');