Skip to content

Commit

Permalink
Add model annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyevans committed Jun 26, 2018
1 parent f764dcd commit b0d81e3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
14 changes: 14 additions & 0 deletions models/message.rb
Expand Up @@ -7,3 +7,17 @@ def line
end
end
end

# Table: messages
# Columns:
# id | integer | PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY
# user_id | integer | NOT NULL
# room_id | integer | NOT NULL
# at | timestamp without time zone | NOT NULL DEFAULT now()
# message | text | NOT NULL
# Indexes:
# messages_pkey | PRIMARY KEY btree (id)
# room_messages_idx | btree (room_id, at DESC)
# Foreign key constraints:
# messages_room_id_fkey | (room_id) REFERENCES rooms(id)
# messages_user_id_fkey | (user_id) REFERENCES users(id)
10 changes: 10 additions & 0 deletions models/room.rb
Expand Up @@ -4,3 +4,13 @@ class Room < Model
one_to_many :recent_messages, :clone=>:messages, :limit=>50
end
end

# Table: rooms
# Columns:
# id | integer | PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY
# name | text | NOT NULL
# Indexes:
# rooms_pkey | PRIMARY KEY btree (id)
# rooms_name_key | UNIQUE btree (name)
# Referenced By:
# messages | messages_room_id_fkey | (room_id) REFERENCES rooms(id)
10 changes: 10 additions & 0 deletions models/user.rb
Expand Up @@ -2,3 +2,13 @@ module LilaShell
class User < Model
end
end

# Table: users
# Columns:
# id | integer | PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY
# name | text | NOT NULL
# Indexes:
# users_pkey | PRIMARY KEY btree (id)
# users_name_key | UNIQUE btree (name)
# Referenced By:
# messages | messages_user_id_fkey | (user_id) REFERENCES users(id)

0 comments on commit b0d81e3

Please sign in to comment.