mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 18:26:06 +02:00
Add ActionVersion
This commit is contained in:
parent
f5ab7814e3
commit
f4fc975440
4 changed files with 77 additions and 0 deletions
|
@ -1,4 +1,6 @@
|
|||
class Action < ActiveRecord::Base
|
||||
has_paper_trail class_name: 'ActionVersion'
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :contact
|
||||
|
||||
|
|
4
app/models/version/action_version.rb
Normal file
4
app/models/version/action_version.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
class ActionVersion < PaperTrail::Version
|
||||
self.table_name = :log_actions
|
||||
self.sequence_name = :log_actions_id_seq
|
||||
end
|
16
db/migrate/20190620084334_create_log_actions.rb
Normal file
16
db/migrate/20190620084334_create_log_actions.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
class CreateLogActions < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :log_actions do |t|
|
||||
t.string :item_type, null: false
|
||||
t.integer :item_id, null: false
|
||||
t.string :event, null: false
|
||||
t.string :whodunnit
|
||||
t.jsonb :object
|
||||
t.jsonb :object_changes
|
||||
t.datetime :created_at
|
||||
t.string :session
|
||||
t.jsonb :children
|
||||
t.string :uuid
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1147,6 +1147,44 @@ CREATE SEQUENCE public.log_accounts_id_seq
|
|||
ALTER SEQUENCE public.log_accounts_id_seq OWNED BY public.log_accounts.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: log_actions; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE public.log_actions (
|
||||
id integer NOT NULL,
|
||||
item_type character varying NOT NULL,
|
||||
item_id integer NOT NULL,
|
||||
event character varying NOT NULL,
|
||||
whodunnit character varying,
|
||||
object jsonb,
|
||||
object_changes jsonb,
|
||||
created_at timestamp without time zone,
|
||||
session character varying,
|
||||
children jsonb,
|
||||
uuid character varying
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: log_actions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.log_actions_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: log_actions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.log_actions_id_seq OWNED BY public.log_actions.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: log_bank_statements; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
@ -2506,6 +2544,13 @@ ALTER TABLE ONLY public.log_account_activities ALTER COLUMN id SET DEFAULT nextv
|
|||
ALTER TABLE ONLY public.log_accounts ALTER COLUMN id SET DEFAULT nextval('public.log_accounts_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.log_actions ALTER COLUMN id SET DEFAULT nextval('public.log_actions_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -2891,6 +2936,14 @@ ALTER TABLE ONLY public.log_accounts
|
|||
ADD CONSTRAINT log_accounts_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: log_actions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.log_actions
|
||||
ADD CONSTRAINT log_actions_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: log_bank_statements_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
@ -4763,3 +4816,5 @@ INSERT INTO schema_migrations (version) VALUES ('20190617121949');
|
|||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20190617122505');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20190620084334');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue