features/example.feature in terrestrial-0.3.0 vs features/example.feature in terrestrial-0.5.0
- old
+ new
@@ -7,40 +7,40 @@
Post = Struct.new(:id, :author, :subject, :body, :created_at, :categories)
Category = Struct.new(:id, :name, :posts)
"""
And a conventionally similar database schema for table "users"
"""
- Column | Type
- ------------ +---------
- id | String
- first_name | String
- last_name | String
- email | String
+ Column | Type | Options
+ -------------+----------+-------------
+ id | String | Primary key
+ first_name | String |
+ last_name | String |
+ email | String |
"""
And a conventionally similar database schema for table "posts"
"""
- Column | Type
- -------------+---------
- id | String
- author_id | String
- subject | String
- body | String
- created_at | DateTime
+ Column | Type | Options
+ -------------┼----------+-------------
+ id | String | Primary key
+ author_id | String |
+ subject | String |
+ body | String |
+ created_at | DateTime |
"""
And a conventionally similar database schema for table "categories"
"""
- Column | Type
- -------------+---------
- id | String
- name | String
+ Column | Type | Options
+ -------------+---------+-------------
+ id | String | Primary key
+ name | String |
"""
And a conventionally similar database schema for table "categories_to_posts"
"""
- Column | Type
- -------------+---------
- post_id | String
- category_id | String
+ Column | Type | Options
+ -------------+---------+-------------
+ post_id | String | Primary key
+ category_id | String |
"""
And a database connection is established
"""
DB = Sequel.postgres(
host: ENV.fetch("PGHOST"),
@@ -48,11 +48,11 @@
database: ENV.fetch("PGDATABASE"),
)
"""
And the associations are defined in the configuration
"""
- MAPPINGS = Terrestrial.config(DB)
+ CONFIG = Terrestrial.config(DB)
.setup_mapping(:users) { |users|
users.class(User)
users.has_many(:posts, foreign_key: :author_id)
}
.setup_mapping(:posts) { |posts|
@@ -65,13 +65,10 @@
categories.has_many_through(:posts)
}
"""
And a object store is instantiated
"""
- OBJECT_STORE = Terrestrial.object_store(
- datastore: DB,
- mappings: MAPPINGS,
- )
+ OBJECT_STORE = Terrestrial.object_store(config: CONFIG)
"""
When a new graph of objects are created
"""
user = User.new(
"2f0f791c-47cf-4a00-8676-e582075bcd65",