VRFS-3276 : Schema, model updates and new calendar model.

This commit is contained in:
Steven Miers 2015-07-01 20:51:17 -05:00
parent 20472b6b26
commit b5d0c758f0
5 changed files with 31 additions and 0 deletions

View File

@ -295,3 +295,4 @@ affiliate_partners2.sql
enhance_band_profile.sql
broadcast_notifications.sql
broadcast_notifications_fk.sql
calendar.sql

12
db/up/calendar.sql Normal file
View File

@ -0,0 +1,12 @@
CREATE TABLE calendars (
id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4() NOT NULL,
user_id VARCHAR(64) NOT NULL REFERENCES users(id) ON DELETE CASCADE,
name VARCHAR(128),
description VARCHAR(8000),
trigger_delete BOOLEAN DEFAULT FALSE,
start_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
end_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
recurring_mode VARCHAR(50) NOT NULL DEFAULT 'once',
created_at TIMESTAMP WITHOUT TIME ZONE DEFAULT NOW() NOT NULL,
updated_at TIMESTAMP WITHOUT TIME ZONE DEFAULT NOW() NOT NULL
);

View File

@ -94,6 +94,7 @@ require "jam_ruby/amqp/amqp_connection_manager"
require "jam_ruby/database"
require "jam_ruby/message_factory"
require "jam_ruby/models/backing_track"
require "jam_ruby/models/calendar"
require "jam_ruby/models/feedback"
require "jam_ruby/models/feedback_observer"
#require "jam_ruby/models/max_mind_geo"

View File

@ -0,0 +1,14 @@
module JamRuby
class Calendar < ActiveRecord::Base
include HtmlSanitize
html_sanitize strict: [:name, :description]
attr_accessible :name, :description, :trigger_delete, :start_at, :end_at
@@log = Logging.logger[Calendar]
self.table_name = "calendars"
self.primary_key = 'id'
belongs_to :user, :class_name => 'JamRuby::User', :foreign_key => :user_id, :inverse_of => :calendars
end
end

View File

@ -45,6 +45,9 @@ module JamRuby
# authorizations (for facebook, etc -- omniauth)
has_many :user_authorizations, :class_name => "JamRuby::UserAuthorization"
# calendars (for scheduling NOT in music_session)
has_many :calendars, :class_name => "JamRuby::Calendar"
# connections (websocket-gateway)
has_many :connections, :class_name => "JamRuby::Connection"