File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
lib/activerecord-clean-db-structure Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 4040
4141## Other options
4242
43- ### indexes_after_tables
43+ ### meta_tables_after_main
4444
45- You can optionally have indexes following the respective tables setting ` indexes_after_tables ` :
45+ You can optionally place indexes and constraints (limited to deferrable ones) after the main tables by setting meta_tables_after_main :
4646
4747``` ruby
4848Rails .application.configure do
49- config.activerecord_clean_db_structure.indexes_after_tables = true
49+ config.activerecord_clean_db_structure.meta_tables_after_main = true
5050end
5151```
5252
@@ -61,6 +61,7 @@ CREATE TABLE public.users (
6161
6262CREATE INDEX index_users_on_tentant_id ON public .users USING btree (tenant_id);
6363CREATE UNIQUE INDEX index_users_on_email ON public .users USING btree (email);
64+ ALTER TABLE public .users ADD CONSTRAINT unique_tenant UNIQUE (tenant_id) DEFERRABLE INITIALLY DEFERRED;
6465```
6566
6667### order_column_definitions
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ def clean_options
128128 dump . gsub! ( /^(INSERT INTO schema_migrations .*)\n \n / , "\\ 1\n " )
129129 end
130130
131- if options [ :meta_tables_after_main ] == true
131+ if options [ :indexes_after_tables ] || options [ :meta_tables_after_main ]
132132 # Extract indexes
133133 indexes =
134134 dump
You can’t perform that action at this time.
0 commit comments