Skip to content

Commit e5d7621

Browse files
committed
backward compatibility
1 parent ab3a283 commit e5d7621

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ end
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
4848
Rails.application.configure do
49-
config.activerecord_clean_db_structure.indexes_after_tables = true
49+
config.activerecord_clean_db_structure.meta_tables_after_main = true
5050
end
5151
```
5252

@@ -61,6 +61,7 @@ CREATE TABLE public.users (
6161

6262
CREATE INDEX index_users_on_tentant_id ON public.users USING btree (tenant_id);
6363
CREATE 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

lib/activerecord-clean-db-structure/clean_dump.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)