Add migrations for devise lockable

This commit is contained in:
Mojca Lorber 2020-07-14 14:53:20 +02:00
parent f7083a000a
commit b087a8cbce
2 changed files with 24 additions and 2 deletions

View file

@ -0,0 +1,11 @@
# frozen_string_literal: true
class AddLockableToDevise < ActiveRecord::Migration[6.0]
def change
change_table :users, bulk: true do |t|
t.integer :failed_attempts, default: 0, null: false
t.datetime :locked_at
t.string :unlock_token, index: true, foreign_key: { to_table: :users }, unique: true
end
end
end

View file

@ -2657,7 +2657,10 @@ CREATE TABLE public.users (
current_team_id bigint,
authentication_token character varying(30),
settings jsonb DEFAULT '{}'::jsonb NOT NULL,
variables jsonb DEFAULT '{}'::jsonb NOT NULL
variables jsonb DEFAULT '{}'::jsonb NOT NULL,
failed_attempts integer DEFAULT 0 NOT NULL,
locked_at timestamp without time zone,
unlock_token character varying
);
@ -5775,6 +5778,13 @@ CREATE INDEX index_users_on_invited_by_id ON public.users USING btree (invited_b
CREATE UNIQUE INDEX index_users_on_reset_password_token ON public.users USING btree (reset_password_token);
--
-- Name: index_users_on_unlock_token; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_users_on_unlock_token ON public.users USING btree (unlock_token);
--
-- Name: index_view_states_on_user_id; Type: INDEX; Schema: public; Owner: -
--
@ -7267,6 +7277,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20200331183640'),
('20200603125407'),
('20200604210943'),
('20200622155632');
('20200622155632'),
('20200714082503');