|
8 | 8 |
|
9 | 9 | The SQL Server adapter for ActiveRecord using SQL Server 2012 or higher.
|
10 | 10 |
|
11 |
| -Interested in older versions? We follow a rational versioning policy that tracks Rails. That means that our 7.x version of the adapter is only for the latest 7.x version of Rails. If you need the adapter for SQL Server 2008 or 2005, you are still in the right spot. Just install the latest 3.2.x to 4.1.x version of the adapter that matches your Rails version. We also have stable branches for each major/minor release of ActiveRecord. |
| 11 | +Interested in older versions? We follow a rational versioning policy that tracks Rails. That means that our 7.x version |
| 12 | +of the adapter is only for the latest 7.x version of Rails. If you need the adapter for SQL Server 2008 or 2005, you |
| 13 | +are still in the right spot. Just install the latest 3.2.x to 4.1.x version of the adapter that matches your Rails |
| 14 | +version. We also have stable branches for each major/minor release of ActiveRecord. For older versions, please check |
| 15 | +their stable branches. |
12 | 16 |
|
13 | 17 | | Adapter Version | Rails Version | Support | Branch |
|
14 | 18 | |-----------------|---------------|----------------|-------------------------------------------------------------------------------------------------|
|
15 |
| -| Unreleased | `7.2.x` | In Development | [main](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/main) | |
16 |
| -| `7.1.4` | `7.1.x` | Active | [7-1-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/7-1-stable) | |
17 |
| -| `7.0.7` | `7.0.x` | Active | [7-0-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/7-0-stable) | |
18 |
| -| `6.1.3.0` | `6.1.x` | Active | [6-1-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/6-1-stable) | |
19 |
| -| `6.0.3` | `6.0.x` | Ended | [6-0-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/6-0-stable) | |
20 |
| -| `5.2.1` | `5.2.x` | Ended | [5-2-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/5-2-stable) | |
21 |
| -| `5.1.6` | `5.1.x` | Ended | [5-1-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/5-1-stable) | |
22 |
| -| `4.2.18` | `4.2.x` | Ended | [4-2-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/4-2-stable) | |
23 |
| -| `4.1.8` | `4.1.x` | Ended | [4-1-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/4-1-stable) | |
24 |
| - |
25 |
| -For older versions, please check their stable branches. |
| 19 | +| `7.2.x` | `7.2.x` | Active | [main](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/main) | |
| 20 | +| `7.1.x` | `7.1.x` | Active | [7-1-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/7-1-stable) | |
| 21 | +| `7.0.x` | `7.0.x` | Active | [7-0-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/7-0-stable) | |
| 22 | +| `6.1.x` | `6.1.x` | Active | [6-1-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/6-1-stable) | |
| 23 | +| `6.0.x` | `6.0.x` | Ended | [6-0-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/6-0-stable) | |
| 24 | +| `5.2.x` | `5.2.x` | Ended | [5-2-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/5-2-stable) | |
| 25 | +| `5.1.x` | `5.1.x` | Ended | [5-1-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/5-1-stable) | |
| 26 | +| `4.2.x` | `4.2.x` | Ended | [4-2-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/4-2-stable) | |
| 27 | +| `4.1.x` | `4.1.x` | Ended | [4-1-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/4-1-stable) | |
| 28 | + |
| 29 | +See [Rubygems](https://rubygems.org/gems/activerecord-sqlserver-adapter/versions) for the latest version of the adapter for each Rails release. |
26 | 30 |
|
27 | 31 | #### Native Data Type Support
|
28 | 32 |
|
@@ -167,14 +171,35 @@ ActiveRecord::ConnectionAdapters::SQLServerAdapter.showplan_option = 'SHOWPLAN_X
|
167 | 171 |
|
168 | 172 | ## New Rails Applications
|
169 | 173 |
|
170 |
| -When creating a new Rails application you can specify that you want to use the SQL Server adapter using the `database` option: |
| 174 | +When creating a new Rails application you need to perform the following steps to connect a Rails application to a |
| 175 | +SQL Server instance. |
171 | 176 |
|
| 177 | +1. Create new Rails application, the database defaults to `sqlite`. |
| 178 | + |
| 179 | +```bash |
| 180 | +rails new my_app |
172 | 181 | ```
|
173 |
| -rails new my_app --database=sqlserver |
| 182 | + |
| 183 | +2. Update the Gemfile to install the adapter instead of the SQLite adapter. Remove the `sqlite3` gem from the Gemfile. |
| 184 | + |
| 185 | +```ruby |
| 186 | +gem 'activerecord-sqlserver-adapter' |
174 | 187 | ```
|
175 | 188 |
|
176 |
| -To then connect the application to your SQL Server instance edit the `config/database.yml` file with the username, password and host of your SQL Server instance. |
| 189 | +3. Connect the application to your SQL Server instance by editing the `config/database.yml` file with the username, |
| 190 | +password and host of your SQL Server instance. |
177 | 191 |
|
| 192 | +Example: |
| 193 | + |
| 194 | +```yaml |
| 195 | +development: |
| 196 | + adapter: sqlserver |
| 197 | + host: 'localhost' |
| 198 | + port: 1433 |
| 199 | + database: my_app_development |
| 200 | + username: 'frank_castle' |
| 201 | + password: 'secret' |
| 202 | +``` |
178 | 203 |
|
179 | 204 | ## Installation
|
180 | 205 |
|
|
0 commit comments