Merged some migrations.

This commit is contained in:
Martin Edenhofer 2015-07-01 03:08:01 +02:00
parent ab53bbc3a7
commit 9babb669b4
17 changed files with 182 additions and 424 deletions

View file

@ -27,6 +27,7 @@ class CreateBase < ActiveRecord::Migration
t.column :zip, :string, limit: 100, null: true, default: '' t.column :zip, :string, limit: 100, null: true, default: ''
t.column :city, :string, limit: 100, null: true, default: '' t.column :city, :string, limit: 100, null: true, default: ''
t.column :country, :string, limit: 100, null: true, default: '' t.column :country, :string, limit: 100, null: true, default: ''
t.column :vip, :boolean, default: false
t.column :verified, :boolean, null: false, default: false t.column :verified, :boolean, null: false, default: false
t.column :active, :boolean, null: false, default: true t.column :active, :boolean, null: false, default: true
t.column :note, :string, limit: 250, null: true, default: '' t.column :note, :string, limit: 250, null: true, default: ''
@ -316,5 +317,39 @@ class CreateBase < ActiveRecord::Migration
add_index :settings, [:area] add_index :settings, [:area]
add_index :settings, [:frontend] add_index :settings, [:frontend]
create_table :stores do |t|
t.references :store_object, null: false
t.references :store_file, null: false
t.column :o_id, :integer, limit: 8, null: false
t.column :preferences, :string, limit: 2500, null: true
t.column :size, :string, limit: 50, null: true
t.column :filename, :string, limit: 250, null: false
t.column :created_by_id, :integer, null: false
t.timestamps
end
add_index :stores, [:store_object_id, :o_id]
create_table :store_objects do |t|
t.column :name, :string, limit: 250, null: false
t.column :note, :string, limit: 250, null: true
t.timestamps
end
add_index :store_objects, [:name], unique: true
create_table :store_files do |t|
t.column :sha, :string, limit: 128, null: false
t.column :provider, :string, limit: 20, null: true
t.timestamps
end
add_index :store_files, [:sha], unique: true
add_index :store_files, [:provider]
create_table :store_provider_dbs do |t|
t.column :sha, :string, limit: 128, null: false
t.column :data, :binary, limit: 200.megabytes, null: true
t.timestamps
end
add_index :store_provider_dbs, [:sha], unique: true
end end
end end

View file

@ -145,6 +145,7 @@ class CreateTicket < ActiveRecord::Migration
t.column :message_id, :string, limit: 3000, null: true t.column :message_id, :string, limit: 3000, null: true
t.column :message_id_md5, :string, limit: 32, null: true t.column :message_id_md5, :string, limit: 32, null: true
t.column :in_reply_to, :string, limit: 3000, null: true t.column :in_reply_to, :string, limit: 3000, null: true
t.column :content_type, :string, limit: 20, null: false, default: 'text/plain'
t.column :references, :string, limit: 3200, null: true t.column :references, :string, limit: 3200, null: true
t.column :body, :text, limit: 4.megabytes + 1 t.column :body, :text, limit: 4.megabytes + 1
t.column :internal, :boolean, null: false, default: false t.column :internal, :boolean, null: false, default: false
@ -248,9 +249,67 @@ class CreateTicket < ActiveRecord::Migration
t.timestamps t.timestamps
end end
add_index :links, [:link_object_source_id, :link_object_source_value, :link_object_target_id, :link_object_target_value, :link_type_id], unique: true, name: 'links_uniq_total' add_index :links, [:link_object_source_id, :link_object_source_value, :link_object_target_id, :link_object_target_value, :link_type_id], unique: true, name: 'links_uniq_total'
create_table :postmaster_filters do |t|
t.column :name, :string, limit: 250, null: false
t.column :channel, :string, limit: 250, null: false
t.column :match, :string, limit: 5000, null: false
t.column :perform, :string, limit: 5000, null: false
t.column :active, :boolean, null: false, default: true
t.column :note, :string, limit: 250, null: true
t.column :updated_by_id, :integer, null: false
t.column :created_by_id, :integer, null: false
t.timestamps
end
add_index :postmaster_filters, [:channel]
create_table :text_modules do |t|
t.references :user, null: true
t.column :name, :string, limit: 250, null: false
t.column :keywords, :string, limit: 500, null: true
t.column :content, :string, limit: 5000, null: false
t.column :note, :string, limit: 250, null: true
t.column :active, :boolean, null: false, default: true
t.column :updated_by_id, :integer, null: false
t.column :created_by_id, :integer, null: false
t.timestamps
end
add_index :text_modules, [:user_id]
add_index :text_modules, [:name]
create_table :text_modules_groups, id: false do |t|
t.integer :text_module_id
t.integer :group_id
end
add_index :text_modules_groups, [:text_module_id]
add_index :text_modules_groups, [:group_id]
create_table :templates do |t|
t.references :user, null: true
t.column :name, :string, limit: 250, null: false
t.column :options, :string, limit: 2500, null: false
t.column :updated_by_id, :integer, null: false
t.column :created_by_id, :integer, null: false
t.timestamps
end
add_index :templates, [:user_id]
add_index :templates, [:name]
create_table :templates_groups, id: false do |t|
t.integer :template_id
t.integer :group_id
end
add_index :templates_groups, [:template_id]
add_index :templates_groups, [:group_id]
end end
def self.down def self.down
drop_table :templates_groups
drop_table :templates
drop_table :text_modules_groups
drop_table :text_modules
drop_table :postmaster_filters
drop_table :notifications drop_table :notifications
drop_table :triggers drop_table :triggers
drop_table :links drop_table :links

View file

@ -1,44 +0,0 @@
class CreateStorage < ActiveRecord::Migration
def up
create_table :stores do |t|
t.references :store_object, null: false
t.references :store_file, null: false
t.column :o_id, :integer, limit: 8, null: false
t.column :preferences, :string, limit: 2500, null: true
t.column :size, :string, limit: 50, null: true
t.column :filename, :string, limit: 250, null: false
t.column :created_by_id, :integer, null: false
t.timestamps
end
add_index :stores, [:store_object_id, :o_id]
create_table :store_objects do |t|
t.column :name, :string, limit: 250, null: false
t.column :note, :string, limit: 250, null: true
t.timestamps
end
add_index :store_objects, [:name], unique: true
create_table :store_files do |t|
t.column :sha, :string, limit: 128, null: false
t.column :provider, :string, limit: 20, null: true
t.timestamps
end
add_index :store_files, [:sha], unique: true
add_index :store_files, [:provider]
create_table :store_provider_dbs do |t|
t.column :sha, :string, limit: 128, null: false
t.column :data, :binary, limit: 200.megabytes, null: true
t.timestamps
end
add_index :store_provider_dbs, [:sha], unique: true
end
def down
drop_table :stores
drop_table :store_objects
drop_table :store_files
end
end

View file

@ -1,26 +0,0 @@
class CreateTemplate < ActiveRecord::Migration
def up
create_table :templates do |t|
t.references :user, null: true
t.column :name, :string, limit: 250, null: false
t.column :options, :string, limit: 2500, null: false
t.column :updated_by_id, :integer, null: false
t.column :created_by_id, :integer, null: false
t.timestamps
end
add_index :templates, [:user_id]
add_index :templates, [:name]
create_table :templates_groups, id: false do |t|
t.integer :template_id
t.integer :group_id
end
add_index :templates_groups, [:template_id]
add_index :templates_groups, [:group_id]
end
def down
drop_table :templates_groups
drop_table :templates
end
end

View file

@ -1,19 +0,0 @@
class PostmasterFilterCreate < ActiveRecord::Migration
def up
create_table :postmaster_filters do |t|
t.column :name, :string, limit: 250, null: false
t.column :channel, :string, limit: 250, null: false
t.column :match, :string, limit: 5000, null: false
t.column :perform, :string, limit: 5000, null: false
t.column :active, :boolean, null: false, default: true
t.column :note, :string, limit: 250, null: true
t.column :updated_by_id, :integer, null: false
t.column :created_by_id, :integer, null: false
t.timestamps
end
add_index :postmaster_filters, [:channel]
end
def down
end
end

View file

@ -1,30 +0,0 @@
class TextModuleCreate < ActiveRecord::Migration
def up
create_table :text_modules do |t|
t.references :user, null: true
t.column :name, :string, limit: 250, null: false
t.column :keywords, :string, limit: 500, null: true
t.column :content, :string, limit: 5000, null: false
t.column :note, :string, limit: 250, null: true
t.column :active, :boolean, null: false, default: true
t.column :updated_by_id, :integer, null: false
t.column :created_by_id, :integer, null: false
t.timestamps
end
add_index :text_modules, [:user_id]
add_index :text_modules, [:name]
create_table :text_modules_groups, id: false do |t|
t.integer :text_module_id
t.integer :group_id
end
add_index :text_modules_groups, [:text_module_id]
add_index :text_modules_groups, [:group_id]
end
def down
drop_table :text_modules_groups
drop_table :text_modules
end
end

View file

@ -1,59 +0,0 @@
class AddSearchIndex < ActiveRecord::Migration
def up
Setting.create_or_update(
title: 'Elasticsearch Endpoint URL',
name: 'es_url',
area: 'SearchIndex::Elasticsearch',
description: 'Define endpoint of Elastic Search.',
state: '',
frontend: false
)
Setting.create_or_update(
title: 'Elasticsearch Endpoint User',
name: 'es_user',
area: 'SearchIndex::Elasticsearch',
description: 'Define http basic auth user of Elasticsearch.',
state: '',
frontend: false
)
Setting.create_or_update(
title: 'Elastic Search Endpoint Password',
name: 'es_password',
area: 'SearchIndex::Elasticsearch',
description: 'Define http basic auth password of Elasticsearch.',
state: '',
frontend: false
)
Setting.create_or_update(
title: 'Elastic Search Endpoint Index',
name: 'es_index',
area: 'SearchIndex::Elasticsearch',
description: 'Define Elasticsearch index name.',
state: 'zammad',
frontend: false
)
Setting.create_or_update(
title: 'Elastic Search Attachment Extentions',
name: 'es_attachment_ignore',
area: 'SearchIndex::Elasticsearch',
description: 'Define attachment extentions which are ignored for Elasticsearch.',
state: [ '.png', '.jpg', '.jpeg', '.mpeg', '.mpg', '.mov', '.bin', '.exe', '.box', '.mbox' ],
frontend: false
)
Setting.create_or_update(
title: 'Elastic Search Attachment Size',
name: 'es_attachment_max_size_in_mb',
area: 'SearchIndex::Elasticsearch',
description: 'Define max. attachment size for Elasticsearch.',
state: 50,
frontend: false
)
Ticket.search_index_reload
User.search_index_reload
Organization.search_index_reload
end
def down
end
end

View file

@ -1,34 +0,0 @@
class UpdateSetting2 < ActiveRecord::Migration
def up
Setting.create_if_not_exists(
title: 'Logo',
name: 'product_logo',
area: 'System::CI',
description: 'Defines the logo of the application, shown in the web interface.',
options: {
form: [
{
display: '',
null: false,
name: 'product_logo',
tag: 'input',
},
],
},
state: 'logo.svg',
frontend: true
)
Setting.create_if_not_exists(
title: 'Online Service',
name: 'system_online_service',
area: 'Core',
description: 'Defines if application is used as online service.',
options: {},
state: false,
frontend: true
)
end
def down
end
end

View file

@ -5,7 +5,7 @@ class CreateAvatar < ActiveRecord::Migration
t.column :object_lookup_id, :integer, null: false t.column :object_lookup_id, :integer, null: false
t.column :default, :boolean, null: false, default: false t.column :default, :boolean, null: false, default: false
t.column :deletable, :boolean, null: false, default: true t.column :deletable, :boolean, null: false, default: true
t.column :inital, :boolean, null: false, default: false t.column :initial, :boolean, null: false, default: false
t.column :store_full_id, :integer, null: true t.column :store_full_id, :integer, null: true
t.column :store_resize_id, :integer, null: true t.column :store_resize_id, :integer, null: true
t.column :store_hash, :string, limit: 32, null: true t.column :store_hash, :string, limit: 32, null: true

View file

@ -487,6 +487,44 @@ class UpdateObjectManager2 < ActiveRecord::Migration
updated_by_id: 1, updated_by_id: 1,
) )
ObjectManager::Attribute.add(
object: 'User',
name: 'vip',
display: 'VIP',
data_type: 'boolean',
data_option: {
null: true,
default: false,
item_class: 'formGroup--halfSize',
options: {
false: 'no',
true: 'yes',
},
translate: true,
},
editable: false,
active: true,
screens: {
edit: {
Admin: {
null: true,
},
Agent: {
null: true,
},
},
view: {
'-all-' => {
shown: false,
},
},
},
pending_migration: false,
position: 1490,
created_by_id: 1,
updated_by_id: 1,
)
ObjectManager::Attribute.add( ObjectManager::Attribute.add(
object: 'User', object: 'User',
name: 'note', name: 'note',
@ -594,7 +632,6 @@ class UpdateObjectManager2 < ActiveRecord::Migration
display: 'Active', display: 'Active',
data_type: 'active', data_type: 'active',
data_option: { data_option: {
null: true,
default: true, default: true,
}, },
editable: false, editable: false,

View file

@ -1,8 +0,0 @@
class UpdateTicketArticle < ActiveRecord::Migration
def up
add_column :ticket_articles, :content_type, :string, limit: 20, null: false, default: 'text/plain'
end
def down
end
end

View file

@ -1,16 +0,0 @@
class AddDevelopMode < ActiveRecord::Migration
def up
Setting.create_if_not_exists(
title: 'Develop System',
name: 'developer_mode',
area: 'Core::Develop',
description: 'Defines if application is in developer mode (useful for developer, all users have the same password, password reset will work without email delivery).',
options: {},
state: false,
frontend: true
)
end
def down
end
end

View file

@ -1,47 +0,0 @@
class CreateVip < ActiveRecord::Migration
def up
add_column :users, :vip, :boolean, default: false
ObjectManager::Attribute.add(
object: 'User',
name: 'vip',
display: 'VIP',
data_type: 'boolean',
data_option: {
null: true,
default: false,
item_class: 'formGroup--halfSize',
options: {
false: 'no',
true: 'yes',
},
translate: true,
},
editable: false,
active: true,
screens: {
edit: {
Admin: {
null: true,
},
Agent: {
null: true,
},
},
view: {
'-all-' => {
shown: false,
},
},
},
pending_migration: false,
position: 1490,
created_by_id: 1,
updated_by_id: 1,
)
end
def down
end
end

View file

@ -1,100 +0,0 @@
class UpdateObjectManager3 < ActiveRecord::Migration
def up
ObjectManager::Attribute.add(
object: 'User',
name: 'active',
display: 'Active',
data_type: 'active',
data_option: {
default: true,
},
editable: false,
active: true,
screens: {
signup: {},
invite_agent: {},
edit: {
Admin: {
null: false,
},
},
view: {
'-all-' => {
shown: false,
},
},
},
pending_migration: false,
position: 1800,
created_by_id: 1,
updated_by_id: 1,
)
ObjectManager::Attribute.add(
object: 'Organization',
name: 'active',
display: 'Active',
data_type: 'active',
data_option: {
default: true,
},
editable: false,
active: true,
screens: {
edit: {
Admin: {
null: false,
},
},
view: {
'-all-' => {
shown: false,
},
},
},
pending_migration: false,
position: 1800,
created_by_id: 1,
updated_by_id: 1,
)
ObjectManager::Attribute.add(
object: 'User',
name: 'password',
display: 'Password',
data_type: 'input',
data_option: {
type: 'password',
maxlength: 100,
null: true,
autocomplete: 'off',
item_class: 'formGroup--halfSize',
},
editable: false,
active: true,
screens: {
signup: {
'-all-' => {
null: false,
},
},
invite_agent: {},
edit: {
Admin: {
null: true,
},
},
view: {}
},
pending_migration: false,
position: 1400,
created_by_id: 1,
updated_by_id: 1,
)
end
def down
end
end

View file

@ -1,9 +0,0 @@
class RenameAvatarTypo < ActiveRecord::Migration
def up
rename_column :avatars, :inital, :initial
end
def down
rename_column :avatars, :initial, :inital
end
end

View file

@ -1,30 +0,0 @@
class UpdateGeoIpConfig < ActiveRecord::Migration
def up
Setting.create_or_update(
title: 'Geo IP Backend',
name: 'geo_ip_backend',
area: 'System::Geo',
description: 'Defines the backend for geo ip lookups.',
options: {
form: [
{
display: '',
null: true,
name: 'geo_ip_backend',
tag: 'select',
options: {
'' => '-',
'GeoIp::ZammadGeoIp' => 'Zammad GeoIP Service',
},
},
],
},
state: 'GeoIp::ZammadGeoIp',
frontend: false
)
end
def down
end
end

View file

@ -1130,6 +1130,55 @@ Setting.create_if_not_exists(
frontend: true frontend: true
) )
Setting.create_if_not_exists(
title: 'Elasticsearch Endpoint URL',
name: 'es_url',
area: 'SearchIndex::Elasticsearch',
description: 'Define endpoint of Elastic Search.',
state: '',
frontend: false
)
Setting.create_if_not_exists(
title: 'Elasticsearch Endpoint User',
name: 'es_user',
area: 'SearchIndex::Elasticsearch',
description: 'Define http basic auth user of Elasticsearch.',
state: '',
frontend: false
)
Setting.create_if_not_exists(
title: 'Elastic Search Endpoint Password',
name: 'es_password',
area: 'SearchIndex::Elasticsearch',
description: 'Define http basic auth password of Elasticsearch.',
state: '',
frontend: false
)
Setting.create_if_not_exists(
title: 'Elastic Search Endpoint Index',
name: 'es_index',
area: 'SearchIndex::Elasticsearch',
description: 'Define Elasticsearch index name.',
state: 'zammad',
frontend: false
)
Setting.create_if_not_exists(
title: 'Elastic Search Attachment Extentions',
name: 'es_attachment_ignore',
area: 'SearchIndex::Elasticsearch',
description: 'Define attachment extentions which are ignored for Elasticsearch.',
state: [ '.png', '.jpg', '.jpeg', '.mpeg', '.mpg', '.mov', '.bin', '.exe', '.box', '.mbox' ],
frontend: false
)
Setting.create_if_not_exists(
title: 'Elastic Search Attachment Size',
name: 'es_attachment_max_size_in_mb',
area: 'SearchIndex::Elasticsearch',
description: 'Define max. attachment size for Elasticsearch.',
state: 50,
frontend: false
)
Setting.create_if_not_exists( Setting.create_if_not_exists(
title: 'Import Mode', title: 'Import Mode',
name: 'import_mode', name: 'import_mode',