You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: support IDENTITY columns for auto-generated primary keys (#352)
* feat: support IDENTITY columns for auto-generated primary keys Adds support for using IDENTITY columns for auto-generated primary keys. IDENTITY columns are backed by bit-reversed sequences in Spanner. This means that IDENTITY columns produce unique non-monotonically-increasing values that are safe to use for primary keys in Spanner. The default `id` field and `:primary_key` type in Ruby ActiveRecord are mapped to IDENTITY columns. This feature is disabled by default, as it changes the default behavior of `id` and `:primary_key` fields. These currently use a client-side generated value. Client-side generated values support mutations, while server-side generated primary key values cannot be used in combination with mutations, as Spanner cannot use a THEN RETURN clause to return these to Ruby ActiveRecord. Add the following configuration value to your configuration to enable auto-generated primary keys with IDENTITY columns: ``` default_sequence_kind: BIT_REVERSED_POSITIVE ``` This feature will be enabled by default in the next major version of this provider. * chore: cleanup
| Interleaved tables require composite primary keys | Spanner requires composite primary keys for interleaved tables. See [this example](examples/snippets/interleaved-tables/README.md) for an example on how to use interleaved tables with ActiveRecord | Use composite primary keys. |
96
-
| Lack of sequential IDs | Spanner uses either using bit-reversed sequences or UUID4 to generated primary keys to avoid [hotspotting](https://cloud.google.com/spanner/docs/schema-design#uuid_primary_key) so you SHOULD NOT rely on IDs being sorted | Use either UUID4s or bit-reversed sequences to automatically generate primary keys.|
97
-
| Table without Primary Key | Spanner support does not support tables without a primary key. | Always define a primary key for your table. |
98
-
| Table names CANNOT have spaces within them whether back-ticked or not | Spanner DOES NOT support tables with spaces in them for example `Entity ID`| Ensure that your table names don't contain spaces. |
99
-
| Table names CANNOT have punctuation marks and MUST contain valid UTF-8 | Spanner DOES NOT support punctuation marks e.g. periods ".", question marks "?" in table names | Ensure that your table names don't contain punctuation marks. |
100
-
| Index with fields length [add_index](https://apidock.com/rails/v5.2.3/ActiveRecord/ConnectionAdapters/SchemaStatements/add_index)| Spanner does not support index with fields length | Ensure that your database definition does not include index definitions with field lengths. |
101
-
| Only GoogleSQL-dialect databases | Spanner supports both GoogleSQL- and PostgreSQL-dialect databases. This adapter only supports GoogleSQL-dialect databases. You can use the [PostgreSQL ActiveRecord provider in combination with PGAdapter](https://github.com/GoogleCloudPlatform/pgadapter/tree/postgresql-dialect/samples/ruby/activerecord) for Spanner PostgreSQL databases. ||
102
-
|`rails dbconsole` is not supported. | The `rails dbconsole` is not supported for Spanner databases. ||
| Interleaved tables require composite primary keys | Spanner requires composite primary keys for interleaved tables. See [this example](examples/snippets/interleaved-tables/README.md) for an example on how to use interleaved tables with ActiveRecord | Use composite primary keys.|
97
+
| Lack of sequential IDs | Spanner uses either bit-reversed IDENTITY columns or sequences to generated primary keys to avoid [hotspotting](https://cloud.google.com/spanner/docs/schema-design#uuid_primary_key) so you SHOULD NOT rely on IDs being sorted | Use either IDENTITY columns or bit-reversed sequences to automatically generate primary keys. |
98
+
| Table without Primary Key | Spanner support does not support tables without a primary key. | Always define a primary key for your table.|
99
+
| Table names CANNOT have spaces within them whether back-ticked or not | Spanner DOES NOT support tables with spaces in them for example `Entity ID`| Ensure that your table names don't contain spaces.|
100
+
| Table names CANNOT have punctuation marks and MUST contain valid UTF-8 | Spanner DOES NOT support punctuation marks e.g. periods ".", question marks "?" in table names | Ensure that your table names don't contain punctuation marks.|
101
+
| Index with fields length [add_index](https://apidock.com/rails/v5.2.3/ActiveRecord/ConnectionAdapters/SchemaStatements/add_index)| Spanner does not support index with fields length | Ensure that your database definition does not include index definitions with field lengths.|
102
+
| Only GoogleSQL-dialect databases | Spanner supports both GoogleSQL- and PostgreSQL-dialect databases. This adapter only supports GoogleSQL-dialect databases. You can use the [PostgreSQL ActiveRecord provider in combination with PGAdapter](https://github.com/GoogleCloudPlatform/pgadapter/tree/postgresql-dialect/samples/ruby/activerecord) for Spanner PostgreSQL databases. ||
103
+
|`rails dbconsole` is not supported. | The `rails dbconsole` is not supported for Spanner databases. ||
0 commit comments