Skip to content

Instantly share code, notes, and snippets.

@z64

z64/model.cr Secret

Created August 27, 2017 08:39
Show Gist options
  • Save z64/872ebab2293838cb627367a7a24bd236 to your computer and use it in GitHub Desktop.
Save z64/872ebab2293838cb627367a7a24bd236 to your computer and use it in GitHub Desktop.
class StarSystem < Jennifer::Model::Base
mapping(
id: {type: Int64, primary: true},
created_at: {type: Time, null: false, default: Time.now},
updated_at: {type: Time, null: false, default: Time.now},
name: {type: String, null: false},
position: {type: Array(Float64), null: false},
security: {type: String, null: false},
economy: {type: String, null: false},
population: {type: Int64, null: true, default: 0i64},
cc_value: {type: Int32, null: true, default: 0}
)
end
Table "public.star_systems"
Column | Type | Modifiers | Storage | Stats target | Description
------------+--------------------------+-----------------------------------------------------------+----------+--------------+-------------
id | bigint | not null default nextval('star_systems_id_seq'::regclass) | plain | |
created_at | timestamp with time zone | not null default now() | plain | |
updated_at | timestamp with time zone | not null default now() | plain | |
name | text | not null | extended | |
position | numeric[] | not null | extended | |
security | security | not null | plain | |
economy | economy | not null | plain | |
population | bigint | not null default 0 | plain | |
cc_value | numeric | not null default 0 | main | |
Indexes:
"star_systems_pkey" PRIMARY KEY, btree (id)
"star_system_position_idx" UNIQUE, btree ("position")
"star_system_name_idx" btree (name)
Referenced by:
TABLE "faction_presences" CONSTRAINT "faction_presences_star_system_id_fkey" FOREIGN KEY (star_system_id) REFERENCES star_systems(id) ON DELETE CASCADE
TABLE "factions" CONSTRAINT "factions_home_system_id_fkey" FOREIGN KEY (home_system_id) REFERENCES star_systems(id) ON DELETE CASCADE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment