Sha256: ab9f2419e806d98e4458bb4552c31267ba005390cfa788fa524ee9f604232a65
Contents?: true
Size: 1.04 KB
Versions: 21
Compression:
Stored size: 1.04 KB
Contents
# Sample - Commit Timestamps This example shows how to set an attribute to the [commit timestamp of a transaction](https://cloud.google.com/spanner/docs/commit-timestamp) using the Spanner ActiveRecord adapter. Setting the commit timestamp is different from the built-in `created_at`/`updated_at` [feature](https://guides.rubyonrails.org/active_record_basics.html#schema-conventions) of ActiveRecord. A `created_at`/`updated_at` column that is managed by ActiveRecord will be set to the date/time of the __client__ when the record is created/updated. The commit timestamp of a transaction is generated by Cloud Spanner and is set by the server when the transaction is committed. All records that are created or updated in the same transaction will be assigned the exact same commit timestamp. The sample will automatically start a Spanner Emulator in a docker container and execute the sample against that emulator. The emulator will automatically be stopped when the application finishes. Run the application with the command ```bash bundle exec rake run ```
Version data entries
21 entries across 21 versions & 1 rubygems
Version | Path |
---|---|
activerecord-spanner-adapter-0.5.0 | examples/snippets/commit-timestamp/README.md |