Skip to content

Commit 1fdbe95

Browse files
committed
Add Set Schema Search Path as a rails til
1 parent d90f147 commit 1fdbe95

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ _310 TILs and counting..._
198198
- [Retrieve An Object If It Exists](rails/retrieve-an-object-if-it-exists.md)
199199
- [Select A Select By Selector](rails/select-a-select-by-selector.md)
200200
- [Select Value For SQL Counts](rails/select-value-for-sql-counts.md)
201+
- [Set Schema Search Path](rails/set-schema-search-path.md)
201202
- [Show Pending Migrations](rails/show-pending-migrations.md)
202203
- [Show Rails Models With Pry](rails/show-rails-models-with-pry.md)
203204
- [Show Rails Routes With Pry](rails/show-rails-routes-with-pry.md)

rails/set-schema-search-path.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Set Schema Search Path
2+
3+
By default the schema search path for a PostgreSQL database is going to be
4+
`"$user", public`. Tables created by a Rails migration are going to end up
5+
on the `public` schema by default. If your application has other schemas in
6+
play, then you may want to ensure that those schemas are also on the schema
7+
search path. This can be accomplished by adding the `schema_search_path`
8+
setting to your `database.yml` file. For instance, to include both the
9+
`legacy` and `public` schema in the Postgres search path, add the following
10+
line:
11+
12+
```ruby
13+
schema_search_path: "legacy,public"
14+
```
15+
16+
h/t Jack Christensen

0 commit comments

Comments
 (0)