Created
January 12, 2012 13:24
-
-
Save skord/1600502 to your computer and use it in GitHub Desktop.
Inventory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'dm-core' | |
| require 'dm-migrations' | |
| DataMapper.setup(:default, 'sqlite:///Users/mike/src/corpinv/corpinv.db') | |
| # DataMapper.setup(:default, 'sqlite::memory:') | |
| class Region | |
| include DataMapper::Resource | |
| property :id, Serial | |
| property :name, String | |
| has n, :constellations | |
| end | |
| class Constellation | |
| include DataMapper::Resource | |
| property :id, Serial | |
| property :name, String | |
| belongs_to :region | |
| has n, :solarsystems | |
| end | |
| class Solarsystem | |
| include DataMapper::Resource | |
| property :id, Serial | |
| property :name, String | |
| belongs_to :constellation | |
| has n, :planets | |
| end | |
| class Planet | |
| include DataMapper::Resource | |
| property :id, Serial | |
| property :name, String | |
| property :celestial_index, Integer | |
| property :makeup, String | |
| property :radius, Decimal | |
| belongs_to :solarsystem | |
| has n, :moons | |
| has n, :customs_offices | |
| end | |
| class Moon | |
| include DataMapper::Resource | |
| property :id, Serial | |
| property :name, String | |
| property :orbit_index, Integer | |
| property :radius, Decimal | |
| belongs_to :planet | |
| has n, :minerals, :through => Resource | |
| end | |
| class Mineral | |
| include DataMapper::Resource | |
| property :id, Serial | |
| property :name, String | |
| has n, :moons, :through => Resource | |
| end | |
| class CustomsOffice | |
| include DataMapper::Resource | |
| property :id, Serial | |
| property :name, String | |
| belongs_to :planet | |
| def owner | |
| 'TEST Alliance' | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment