Skip to content

db Schema

John Lockhart edited this page Aug 17, 2018 · 9 revisions

users

Column name Data type Details
id integer not null, primary key
username string not null, indexed
password_digest string not null
session_token string not null, indexed, unique
organizer boolean default: false, not null
organizer_description text
created_at datetime not null
updated_at datetime not null

associations:

  • has_many :tickets
  • has_many :events

events

Column name Data type Details
id integer not null, primary key
name string not null, indexed
organizer_id integer not null, indexed, unique to name
date datetime not null
time datetime not null
location_id string not null
description text not null
price float not null
capacity integer not null
created_at datetime not null
updated_at datetime not null

associations:

  • belongs_to :organizer foreign key: organizer_id
  • has_many :registrations
  • has_many :taggings

registrations

Column name Data type Details
event_id integer not null, indexed
attendee_id integer not null, indexed
created_at datetime not null
updated_at datetime not null

associations:

  • belongs_to :event foreign key: event_id
  • belongs_to :attendee foreign key: attendee_id (ref users)

categories aka tags

Column name Data type Details
id integer not null, primary key
category string not null, indexed, unique
created_at datetime not null
updated_at datetime not null

associations:

  • has_many :events through :taggings
  • belongs_to :attendee foreign key: attendee_id (ref users)

categorizations

Column name Data type Details
category_id integer not null, indexed, unique to event_id
event_id integer not null, indexed
created_at datetime not null
updated_at datetime not null

associations:

  • belongs_to :event foreign key: event_id
  • belongs_to :category foreign key: category_id

Clone this wiki locally