mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 02:35:57 +02:00
Restore versions
DB table and add learning tests
This commit is contained in:
parent
5c8e507b93
commit
647bf4c397
5 changed files with 84 additions and 8 deletions
15
db/migrate/20190302091059_restore_versions.rb
Normal file
15
db/migrate/20190302091059_restore_versions.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
class RestoreVersions < ActiveRecord::Migration
|
||||
def change
|
||||
drop_table :versions
|
||||
|
||||
create_table :versions do |t|
|
||||
t.string :item_type, :null => false
|
||||
t.integer :item_id, :null => false
|
||||
t.string :event, :null => false
|
||||
t.string :whodunnit
|
||||
t.text :object
|
||||
t.datetime :created_at
|
||||
end
|
||||
add_index :versions, [:item_type, :item_id]
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddObjectChangesToVersions < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :versions, :object_changes, :jsonb
|
||||
end
|
||||
end
|
|
@ -2363,7 +2363,13 @@ ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
|
|||
|
||||
CREATE TABLE public.versions (
|
||||
id integer NOT NULL,
|
||||
depricated_table_but_somehow_paper_trail_tests_fails_without_it text
|
||||
item_type character varying NOT NULL,
|
||||
item_id integer NOT NULL,
|
||||
event character varying NOT NULL,
|
||||
whodunnit character varying,
|
||||
object text,
|
||||
created_at timestamp without time zone,
|
||||
object_changes jsonb
|
||||
);
|
||||
|
||||
|
||||
|
@ -3980,6 +3986,13 @@ CREATE INDEX index_users_on_identity_code ON public.users USING btree (identity_
|
|||
CREATE INDEX index_users_on_registrar_id ON public.users USING btree (registrar_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_versions_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE INDEX index_versions_on_item_type_and_item_id ON public.versions USING btree (item_type, item_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_whois_records_on_domain_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
@ -4927,6 +4940,10 @@ INSERT INTO schema_migrations (version) VALUES ('20190102144032');
|
|||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20190209150026');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20190302091059');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20190302111152');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20190311111718');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20190312211614');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue