summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20130109090000_populate_gs_parameter_with_dialplan_defaults.rb4
-rw-r--r--db/migrate/20130213110000_add_sounds_to_parameters.rb2
-rw-r--r--db/migrate/20130219135000_remove_sound_prefix_from_conference_parameters.rb8
-rw-r--r--db/migrate/20130222074610_create_groups.rb14
-rw-r--r--db/migrate/20130222074652_create_group_memberships.rb14
-rw-r--r--db/migrate/20130222092313_create_group_permissions.rb14
-rw-r--r--db/migrate/20130224081700_groups_to_user_groups_in_routes.rb19
-rw-r--r--db/migrate/20130224091700_add_initial_groups.rb22
-rw-r--r--db/migrate/20130225091200_add_destinationable_to_call_forward.rb21
-rw-r--r--db/migrate/20130225160423_create_restore_jobs.rb13
10 files changed, 128 insertions, 3 deletions
diff --git a/db/migrate/20130109090000_populate_gs_parameter_with_dialplan_defaults.rb b/db/migrate/20130109090000_populate_gs_parameter_with_dialplan_defaults.rb
index fe1cdae..a8350a3 100644
--- a/db/migrate/20130109090000_populate_gs_parameter_with_dialplan_defaults.rb
+++ b/db/migrate/20130109090000_populate_gs_parameter_with_dialplan_defaults.rb
@@ -79,7 +79,7 @@ class PopulateGsParameterWithDialplanDefaults < ActiveRecord::Migration
GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'rate', :value => 16000, :class_type => 'Integer')
GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'interval', :value => 20, :class_type => 'Integer')
GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'energy-level', :value => 300, :class_type => 'Integer')
- GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'sound-prefix', :value => '/opt/freeswitch/sounds/en/us/callie', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'sound-prefix', :value => '/opt/freeswitch/sounds/de/tts/google', :class_type => 'String')
GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'muted-sound', :value => 'conference/conf-muted.wav', :class_type => 'String')
GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'unmuted-sound', :value => 'conference/conf-unmuted.wav', :class_type => 'String')
GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'alone-sound', :value => 'conference/conf-alone.wav', :class_type => 'String')
@@ -101,7 +101,7 @@ class PopulateGsParameterWithDialplanDefaults < ActiveRecord::Migration
GsParameter.create(:entity => 'dialplan', :section => 'parameters', :name => 'dial_timeout', :value => '120', :class_type => 'Integer')
GsParameter.create(:entity => 'dialplan', :section => 'parameters', :name => 'max_loops', :value => '20', :class_type => 'Integer')
GsParameter.create(:entity => 'dialplan', :section => 'parameters', :name => 'default_ringtone', :value => '1', :class_type => 'Integer')
- GsParameter.create(:entity => 'dialplan', :section => 'parameters', :name => 'default_language', :value => 'en', :class_type => 'String')
+ GsParameter.create(:entity => 'dialplan', :section => 'parameters', :name => 'default_language', :value => 'de', :class_type => 'String')
GsParameter.create(:entity => 'dialplan', :section => 'parameters', :name => 'phone_book_entry_image_url', :value => 'http://192.168.0.150/uploads/phone_book_entry/image', :class_type => 'String')
GsParameter.create(:entity => 'dialplan', :section => 'parameters', :name => 'user_image_url', :value => 'http://192.168.0.150/uploads/user/image', :class_type => 'String')
GsParameter.create(:entity => 'dialplan', :section => 'parameters', :name => 'ringtone_url', :value => 'http://192.168.0.150', :class_type => 'String')
diff --git a/db/migrate/20130213110000_add_sounds_to_parameters.rb b/db/migrate/20130213110000_add_sounds_to_parameters.rb
index 8c4cd94..dd20ca3 100644
--- a/db/migrate/20130213110000_add_sounds_to_parameters.rb
+++ b/db/migrate/20130213110000_add_sounds_to_parameters.rb
@@ -1,7 +1,7 @@
class AddSoundsToParameters < ActiveRecord::Migration
def up
GsParameter.create(:entity => 'dialplan', :section => 'sounds', :name => 'en', :value => '/opt/freeswitch/sounds/en/us/callie', :class_type => 'String')
- GsParameter.create(:entity => 'dialplan', :section => 'sounds', :name => 'de', :value => '/opt/freeswitch/sounds/de/de/callie', :class_type => 'String')
+ GsParameter.create(:entity => 'dialplan', :section => 'sounds', :name => 'de', :value => '/opt/freeswitch/sounds/de/tts/google', :class_type => 'String')
end
def down
diff --git a/db/migrate/20130219135000_remove_sound_prefix_from_conference_parameters.rb b/db/migrate/20130219135000_remove_sound_prefix_from_conference_parameters.rb
new file mode 100644
index 0000000..950e3af
--- /dev/null
+++ b/db/migrate/20130219135000_remove_sound_prefix_from_conference_parameters.rb
@@ -0,0 +1,8 @@
+class RemoveSoundPrefixFromConferenceParameters < ActiveRecord::Migration
+ def up
+ GsParameter.where(:entity => 'conferences', :section => 'parameters', :name => 'sound-prefix').destroy_all
+ end
+
+ def down
+ end
+end
diff --git a/db/migrate/20130222074610_create_groups.rb b/db/migrate/20130222074610_create_groups.rb
new file mode 100644
index 0000000..e5848b9
--- /dev/null
+++ b/db/migrate/20130222074610_create_groups.rb
@@ -0,0 +1,14 @@
+class CreateGroups < ActiveRecord::Migration
+ def self.up
+ create_table :groups do |t|
+ t.string :name
+ t.boolean :active
+ t.string :comment
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :groups
+ end
+end
diff --git a/db/migrate/20130222074652_create_group_memberships.rb b/db/migrate/20130222074652_create_group_memberships.rb
new file mode 100644
index 0000000..e572445
--- /dev/null
+++ b/db/migrate/20130222074652_create_group_memberships.rb
@@ -0,0 +1,14 @@
+class CreateGroupMemberships < ActiveRecord::Migration
+ def self.up
+ create_table :group_memberships do |t|
+ t.integer :group_id
+ t.string :item_type
+ t.integer :item_id
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :group_memberships
+ end
+end
diff --git a/db/migrate/20130222092313_create_group_permissions.rb b/db/migrate/20130222092313_create_group_permissions.rb
new file mode 100644
index 0000000..5949819
--- /dev/null
+++ b/db/migrate/20130222092313_create_group_permissions.rb
@@ -0,0 +1,14 @@
+class CreateGroupPermissions < ActiveRecord::Migration
+ def self.up
+ create_table :group_permissions do |t|
+ t.integer :group_id
+ t.string :permission
+ t.integer :target_group_id
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :group_permissions
+ end
+end
diff --git a/db/migrate/20130224081700_groups_to_user_groups_in_routes.rb b/db/migrate/20130224081700_groups_to_user_groups_in_routes.rb
new file mode 100644
index 0000000..5e03cfa
--- /dev/null
+++ b/db/migrate/20130224081700_groups_to_user_groups_in_routes.rb
@@ -0,0 +1,19 @@
+class GroupsToUserGroupsInRoutes < ActiveRecord::Migration
+ def up
+ RouteElement.where(:var_in => 'val:auth_account.owner.groups').each do |route_element|
+ route_element.update_attributes(:var_in => 'val:auth_account.owner.user_groups')
+ end
+ RouteElement.where(:var_in => 'val:account.owner.groups').each do |route_element|
+ route_element.update_attributes(:var_in => 'val:account.owner.user_groups')
+ end
+ end
+
+ def down
+ RouteElement.where(:var_in => 'val:auth_account.owner.user_groups').each do |route_element|
+ route_element.update_attributes(:var_in => 'val:auth_account.owner.groups')
+ end
+ RouteElement.where(:var_in => 'val:account.owner.user_groups').each do |route_element|
+ route_element.update_attributes(:var_in => 'val:account.owner.groups')
+ end
+ end
+end
diff --git a/db/migrate/20130224091700_add_initial_groups.rb b/db/migrate/20130224091700_add_initial_groups.rb
new file mode 100644
index 0000000..f680fb6
--- /dev/null
+++ b/db/migrate/20130224091700_add_initial_groups.rb
@@ -0,0 +1,22 @@
+class AddInitialGroups < ActiveRecord::Migration
+ def up
+ Group.create(:name => 'admins', :active => true, :comment => 'Administrator user accounts')
+ Group.create(:name => 'users', :active => true, :comment => 'Generic user accounts')
+ Group.create(:name => 'tenant_sip_accounts', :active => true, :comment => 'SIP accounts owned by tenants')
+
+ user_sip_accounts = Group.create(:name => 'user_sip_accounts', :active => true, :comment => 'SIP accounts owned by user accounts')
+ user_sip_accounts.group_permissions.create(:permission => 'pickup', :target_group_id => user_sip_accounts.id)
+
+ Group.create(:name => 'international_calls', :active => true, :comment => 'International calls permitted')
+ Group.create(:name => 'national_calls', :active => true, :comment => 'National calls permitted')
+
+ GsParameter.create(:entity => 'group', :section => 'default', :name => 'User.admin', :value => '--- [admins]\n', :class_type => 'YAML')
+ GsParameter.create(:entity => 'group', :section => 'default', :name => 'User', :value => '--- [users]\n', :class_type => 'YAML')
+ GsParameter.create(:entity => 'group', :section => 'default', :name => 'SipAccount.user', :value => '--- [user_sip_accounts, international_calls, national_calls]\n', :class_type => 'YAML')
+ GsParameter.create(:entity => 'group', :section => 'default', :name => 'SipAccount.tenant', :value => '--- [tenant_sip_accounts]\n', :class_type => 'YAML')
+ end
+
+ def down
+ Group.destroy_all
+ end
+end
diff --git a/db/migrate/20130225091200_add_destinationable_to_call_forward.rb b/db/migrate/20130225091200_add_destinationable_to_call_forward.rb
new file mode 100644
index 0000000..89e4b3b
--- /dev/null
+++ b/db/migrate/20130225091200_add_destinationable_to_call_forward.rb
@@ -0,0 +1,21 @@
+class AddDestinationableToCallForward < ActiveRecord::Migration
+ def up
+ add_column :call_forwards, :destinationable_type, :string
+ add_column :call_forwards, :destinationable_id, :integer
+
+ CallForward.all.each do |call_forward|
+ call_forward.update_attributes(:destinationable_type => call_forward.call_forwardable_type, :destinationable_id => call_forward.call_forwardable_id, :call_forwardable_type => 'PhoneNumber', :call_forwardable_id => call_forward.phone_number_id )
+ end
+
+ remove_column :call_forwards, :phone_number_id
+ end
+
+ def down
+ add_column :call_forwards, :phone_number_id, :integer
+ CallForward.where(:call_forwardable_type => 'PhoneNumber').each do |call_forward|
+ call_forward.update_attributes(:phone_number_id => call_forward.call_forwardable_id, :call_forwardable_type => call_forward.destinationable_type, :call_forwardable_id => call_forward.destinationable_id)
+ end
+ remove_column :call_forwards, :destinationable_type
+ remove_column :call_forwards, :destinationable_id
+ end
+end
diff --git a/db/migrate/20130225160423_create_restore_jobs.rb b/db/migrate/20130225160423_create_restore_jobs.rb
new file mode 100644
index 0000000..9f83791
--- /dev/null
+++ b/db/migrate/20130225160423_create_restore_jobs.rb
@@ -0,0 +1,13 @@
+class CreateRestoreJobs < ActiveRecord::Migration
+ def self.up
+ create_table :restore_jobs do |t|
+ t.string :state
+ t.string :backup_file
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :restore_jobs
+ end
+end