Sha256: e2e6eb1f19b783e906ded725ac9203ab27566a92243d400c9b35f55af8986032

Contents?: true

Size: 1.09 KB

Versions: 21

Compression:

Stored size: 1.09 KB

Contents

# Sample - Quickstart

This sample shows how to create and use a very simple Cloud Spanner database with ActiveRecord.
The database consists of two tables:
- Singers
- Albums

Albums references Singers with a [foreign key](https://cloud.google.com/spanner/docs/foreign-keys/overview).

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.

This sample will:
1. Create the sample database by calling `rake db:migrate`. This will execute the migrations in the folder `db/migrate`.
2. Fill the sample database with some data by calling `rake db:seed`. This will execute the script in `db/seeds.rb`.
The seed script fills the database with 10 random singers and 30 random albums.
3. Run the `application.rb` file. This application will:
   1. List all known singers and albums.
   2. Select a random singer and update the name of this singer.
   3. Select all singers whose last names start with an 'A'.

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-1.6.3 examples/snippets/quickstart/README.md
activerecord-spanner-adapter-1.6.2 examples/snippets/quickstart/README.md
activerecord-spanner-adapter-1.6.1 examples/snippets/quickstart/README.md
activerecord-spanner-adapter-1.6.0 examples/snippets/quickstart/README.md
activerecord-spanner-adapter-1.5.1 examples/snippets/quickstart/README.md
activerecord-spanner-adapter-1.5.0 examples/snippets/quickstart/README.md
activerecord-spanner-adapter-1.4.4 examples/snippets/quickstart/README.md
activerecord-spanner-adapter-1.4.3 examples/snippets/quickstart/README.md
activerecord-spanner-adapter-1.4.2 examples/snippets/quickstart/README.md
activerecord-spanner-adapter-1.4.1 examples/snippets/quickstart/README.md
activerecord-spanner-adapter-1.4.0 examples/snippets/quickstart/README.md
activerecord-spanner-adapter-1.3.1 examples/snippets/quickstart/README.md
activerecord-spanner-adapter-1.2.2 examples/snippets/quickstart/README.md
activerecord-spanner-adapter-1.2.1 examples/snippets/quickstart/README.md
activerecord-spanner-adapter-1.2.0 examples/snippets/quickstart/README.md
activerecord-spanner-adapter-1.1.0 examples/snippets/quickstart/README.md
activerecord-spanner-adapter-1.0.1 examples/snippets/quickstart/README.md
activerecord-spanner-adapter-1.0.0 examples/snippets/quickstart/README.md
activerecord-spanner-adapter-0.7.0 examples/snippets/quickstart/README.md
activerecord-spanner-adapter-0.6.0 examples/snippets/quickstart/README.md