Merged some migrations.

This commit is contained in:
Martin Edenhofer 2015-07-01 10:50:42 +02:00
parent a872f78e24
commit 45a79e2120
11 changed files with 245 additions and 301 deletions

View file

@ -10,33 +10,33 @@ class CreateBase < ActiveRecord::Migration
add_index :sessions, :updated_at
create_table :users do |t|
t.references :organization, null: true
t.column :login, :string, limit: 100, null: false
t.column :firstname, :string, limit: 100, null: true, default: ''
t.column :lastname, :string, limit: 100, null: true, default: ''
t.column :email, :string, limit: 140, null: true, default: ''
t.column :image, :string, limit: 100, null: true
t.column :image_source, :string, limit: 200, null: true
t.column :web, :string, limit: 100, null: true, default: ''
t.column :password, :string, limit: 100, null: true
t.column :phone, :string, limit: 100, null: true, default: ''
t.column :fax, :string, limit: 100, null: true, default: ''
t.column :mobile, :string, limit: 100, null: true, default: ''
t.column :department, :string, limit: 200, null: true, default: ''
t.column :street, :string, limit: 120, null: true, default: ''
t.column :zip, :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 :vip, :boolean, default: false
t.column :verified, :boolean, null: false, default: false
t.column :active, :boolean, null: false, default: true
t.column :note, :string, limit: 250, null: true, default: ''
t.column :last_login, :timestamp, null: true
t.column :source, :string, limit: 200, null: true
t.column :login_failed, :integer, null: false, default: 0
t.column :preferences, :string, limit: 8000, null: true
t.column :updated_by_id, :integer, null: false
t.column :created_by_id, :integer, null: false
t.references :organization, null: true
t.string :login, limit: 100, null: false
t.string :firstname, limit: 100, null: true, default: ''
t.string :lastname, limit: 100, null: true, default: ''
t.string :email, limit: 140, null: true, default: ''
t.string :image, limit: 100, null: true
t.string :image_source, limit: 200, null: true
t.string :web, limit: 100, null: true, default: ''
t.string :password, limit: 100, null: true
t.string :phone, limit: 100, null: true, default: ''
t.string :fax, limit: 100, null: true, default: ''
t.string :mobile, limit: 100, null: true, default: ''
t.string :department, limit: 200, null: true, default: ''
t.string :street, limit: 120, null: true, default: ''
t.string :zip, limit: 100, null: true, default: ''
t.string :city, limit: 100, null: true, default: ''
t.string :country, limit: 100, null: true, default: ''
t.boolean :vip, default: false
t.boolean :verified, null: false, default: false
t.boolean :active, null: false, default: true
t.string :note, limit: 250, null: true, default: ''
t.timestamp :last_login, null: true
t.string :source, limit: 200, null: true
t.integer :login_failed, null: false, default: 0
t.string :preferences, limit: 8000, null: true
t.integer :updated_by_id, null: false
t.integer :created_by_id, null: false
t.timestamps
end
add_index :users, [:login], unique: true
@ -52,59 +52,59 @@ class CreateBase < ActiveRecord::Migration
add_index :users, [:created_by_id]
create_table :signatures do |t|
t.column :name, :string, limit: 100, null: false
t.column :body, :string, limit: 5000, null: true
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.string :name, limit: 100, null: false
t.string :body, limit: 5000, null: true
t.boolean :active, null: false, default: true
t.string :note, limit: 250, null: true
t.integer :updated_by_id, null: false
t.integer :created_by_id, null: false
t.timestamps
end
add_index :signatures, [:name], unique: true
create_table :email_addresses do |t|
t.column :realname, :string, limit: 250, null: false
t.column :email, :string, limit: 250, 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.string :realname, limit: 250, null: false
t.string :email, limit: 250, null: false
t.boolean :active, null: false, default: true
t.string :note, limit: 250, null: true
t.integer :updated_by_id, null: false
t.integer :created_by_id, null: false
t.timestamps
end
add_index :email_addresses, [:email], unique: true
create_table :groups do |t|
t.references :signature, null: true
t.references :email_address, null: true
t.column :name, :string, limit: 160, null: false
t.column :assignment_timeout, :integer, null: true
t.column :follow_up_possible, :string, limit: 100, null: false, default: 'yes'
t.column :follow_up_assignment, :boolean, null: false, default: true
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.references :signature, null: true
t.references :email_address, null: true
t.string :name, limit: 160, null: false
t.integer :assignment_timeout, null: true
t.string :follow_up_possible, limit: 100, null: false, default: 'yes'
t.boolean :follow_up_assignment, null: false, default: true
t.boolean :active, null: false, default: true
t.string :note, limit: 250, null: true
t.integer :updated_by_id, null: false
t.integer :created_by_id, null: false
t.timestamps
end
add_index :groups, [:name], unique: true
create_table :roles do |t|
t.column :name, :string, limit: 100, 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.string :name, limit: 100, null: false
t.boolean :active, null: false, default: true
t.string :note, limit: 250, null: true
t.integer :updated_by_id, null: false
t.integer :created_by_id, null: false
t.timestamps
end
add_index :roles, [:name], unique: true
create_table :organizations do |t|
t.column :name, :string, limit: 100, null: false
t.column :shared, :boolean, null: false, default: true
t.column :active, :boolean, null: false, default: true
t.column :note, :string, limit: 250, null: true, default: ''
t.column :updated_by_id, :integer, null: false
t.column :created_by_id, :integer, null: false
t.string :name, limit: 100, null: false
t.boolean :shared, null: false, default: true
t.boolean :active, null: false, default: true
t.string :note, limit: 250, null: true, default: ''
t.integer :updated_by_id, null: false
t.integer :created_by_id, null: false
t.timestamps
end
add_index :organizations, [:name], unique: true
@ -131,11 +131,11 @@ class CreateBase < ActiveRecord::Migration
add_index :organizations_users, [:organization_id]
create_table :authorizations do |t|
t.string :provider, limit: 250, null: false
t.string :uid, limit: 250, null: false
t.string :token, limit: 250, null: true
t.string :secret, limit: 250, null: true
t.string :username, limit: 250, null: true
t.string :provider, limit: 250, null: false
t.string :uid, limit: 250, null: false
t.string :token, limit: 250, null: true
t.string :secret, limit: 250, null: true
t.string :username, limit: 250, null: true
t.references :user, null: false
t.timestamps
end
@ -143,34 +143,46 @@ class CreateBase < ActiveRecord::Migration
add_index :authorizations, [:user_id]
add_index :authorizations, [:username]
create_table :locales do |t|
t.string :locale, limit: 20, null: false
t.string :alias, limit: 20, null: true
t.string :name, limit: 255, null: false
t.boolean :active, null: false, default: true
t.timestamps
end
add_index :locales, [:locale], unique: true
add_index :locales, [:name], unique: true
create_table :translations do |t|
t.column :locale, :string, limit: 10, null: false
t.column :source, :string, limit: 255, null: false
t.column :target, :string, limit: 255, null: false
t.column :target_initial, :string, limit: 255, null: false
t.column :updated_by_id, :integer, null: false
t.column :created_by_id, :integer, null: false
t.string :locale, limit: 10, null: false
t.string :source, limit: 255, null: false
t.string :target, limit: 255, null: false
t.string :target_initial, limit: 255, null: false
t.string :format, limit: 20, null: false, default: 'string'
t.integer :updated_by_id, null: false
t.integer :created_by_id, null: false
t.timestamps
end
add_index :translations, [:source]
add_index :translations, [:locale]
create_table :object_lookups do |t|
t.column :name, :string, limit: 250, null: false
t.string :name, limit: 250, null: false
t.timestamps
end
add_index :object_lookups, [:name], unique: true
add_index :object_lookups, [:name], unique: true
create_table :type_lookups do |t|
t.column :name, :string, limit: 250, null: false
t.string :name, limit: 250, null: false
t.timestamps
end
add_index :type_lookups, [:name], unique: true
create_table :tokens do |t|
t.references :user, null: false
t.string :name, limit: 100, null: false
t.string :action, limit: 40, null: false
t.references :user, null: false
t.boolean :persistent
t.string :name, limit: 100, null: false
t.string :action, limit: 40, null: false
t.timestamps
end
add_index :tokens, :user_id
@ -178,62 +190,62 @@ class CreateBase < ActiveRecord::Migration
add_index :tokens, :created_at
create_table :packages do |t|
t.column :name, :string, limit: 250, null: false
t.column :version, :string, limit: 50, null: false
t.column :vendor, :string, limit: 150, null: false
t.column :state, :string, limit: 50, null: false
t.column :updated_by_id, :integer, null: false
t.column :created_by_id, :integer, null: false
t.string :name, limit: 250, null: false
t.string :version, limit: 50, null: false
t.string :vendor, limit: 150, null: false
t.string :state, limit: 50, null: false
t.integer :updated_by_id, null: false
t.integer :created_by_id, null: false
t.timestamps
end
create_table :package_migrations do |t|
t.column :name, :string, limit: 250, null: false
t.column :version, :string, limit: 250, null: false
t.string :name, limit: 250, null: false
t.string :version, limit: 250, null: false
t.timestamps
end
create_table :taskbars do |t|
t.column :user_id, :integer, null: false
t.column :last_contact, :datetime, null: false
t.column :client_id, :string, null: false
t.column :key, :string, limit: 100, null: false
t.column :callback, :string, limit: 100, null: false
t.column :state, :string, limit: 8000, null: true
t.column :params, :string, limit: 2000, null: true
t.column :prio, :integer, null: false
t.column :notify, :boolean, null: false, default: false
t.column :active, :boolean, null: false, default: false
t.integer :user_id, null: false
t.datetime :last_contact, null: false
t.string :client_id, null: false
t.string :key, limit: 100, null: false
t.string :callback, limit: 100, null: false
t.string :state, limit: 8000, null: true
t.string :params, limit: 2000, null: true
t.integer :prio, null: false
t.boolean :notify, null: false, default: false
t.boolean :active, null: false, default: false
t.timestamps
end
add_index :taskbars, [:user_id]
add_index :taskbars, [:client_id]
create_table :tags do |t|
t.references :tag_item, null: false
t.references :tag_object, null: false
t.column :o_id, :integer, null: false
t.column :created_by_id, :integer, null: false
t.references :tag_item, null: false
t.references :tag_object, null: false
t.integer :o_id, null: false
t.integer :created_by_id, null: false
t.timestamps
end
add_index :tags, [:o_id]
add_index :tags, [:tag_object_id]
create_table :tag_objects do |t|
t.column :name, :string, limit: 250, null: false
t.string :name, limit: 250, null: false
t.timestamps
end
add_index :tag_objects, [:name], unique: true
add_index :tag_objects, [:name], unique: true
create_table :tag_items do |t|
t.column :name, :string, limit: 250, null: false
t.string :name, limit: 250, null: false
t.timestamps
end
add_index :tag_items, [:name], unique: true
add_index :tag_items, [:name], unique: true
create_table :recent_views do |t|
t.references :recent_view_object, null: false
t.column :o_id, :integer, null: false
t.column :created_by_id, :integer, null: false
t.references :recent_view_object, null: false
t.integer :o_id, null: false
t.integer :created_by_id, null: false
t.timestamps
end
add_index :recent_views, [:o_id]
@ -242,12 +254,12 @@ class CreateBase < ActiveRecord::Migration
add_index :recent_views, [:recent_view_object_id]
create_table :activity_streams do |t|
t.references :activity_stream_type, null: false
t.references :activity_stream_object, null: false
t.references :role, null: true
t.references :group, null: true
t.column :o_id, :integer, null: false
t.column :created_by_id, :integer, null: false
t.references :activity_stream_type, null: false
t.references :activity_stream_object, null: false
t.references :role, null: true
t.references :group, null: true
t.integer :o_id, null: false
t.integer :created_by_id, null: false
t.timestamps
end
add_index :activity_streams, [:o_id]
@ -259,17 +271,17 @@ class CreateBase < ActiveRecord::Migration
add_index :activity_streams, [:activity_stream_type_id]
create_table :histories do |t|
t.references :history_type, null: false
t.references :history_object, null: false
t.references :history_attribute, null: true
t.column :o_id, :integer, null: false
t.column :related_o_id, :integer, null: true
t.column :related_history_object_id, :integer, null: true
t.column :id_to, :integer, null: true
t.column :id_from, :integer, null: true
t.column :value_from, :string, limit: 250, null: true
t.column :value_to, :string, limit: 250, null: true
t.column :created_by_id, :integer, null: false
t.references :history_type, null: false
t.references :history_object, null: false
t.references :history_attribute, null: true
t.integer :o_id, null: false
t.integer :related_o_id, null: true
t.integer :related_history_object_id, null: true
t.integer :id_to, null: true
t.integer :id_from, null: true
t.string :value_from, limit: 250, null: true
t.string :value_to, limit: 250, null: true
t.integer :created_by_id, null: false
t.timestamps
end
add_index :histories, [:o_id]
@ -284,33 +296,33 @@ class CreateBase < ActiveRecord::Migration
add_index :histories, [:value_to]
create_table :history_types do |t|
t.column :name, :string, limit: 250, null: false
t.string :name, limit: 250, null: false
t.timestamps
end
add_index :history_types, [:name], unique: true
add_index :history_types, [:name], unique: true
create_table :history_objects do |t|
t.column :name, :string, limit: 250, null: false
t.column :note, :string, limit: 250, null: true
t.string :name, limit: 250, null: false
t.string :note, limit: 250, null: true
t.timestamps
end
add_index :history_objects, [:name], unique: true
add_index :history_objects, [:name], unique: true
create_table :history_attributes do |t|
t.column :name, :string, limit: 250, null: false
t.string :name, limit: 250, null: false
t.timestamps
end
add_index :history_attributes, [:name], unique: true
add_index :history_attributes, [:name], unique: true
create_table :settings do |t|
t.column :title, :string, limit: 200, null: false
t.column :name, :string, limit: 200, null: false
t.column :area, :string, limit: 100, null: false
t.column :description, :string, limit: 2000, null: false
t.column :options, :string, limit: 2000, null: true
t.column :state, :string, limit: 2000, null: true
t.column :state_initial, :string, limit: 2000, null: true
t.column :frontend, :boolean, null: false
t.string :title, limit: 200, null: false
t.string :name, limit: 200, null: false
t.string :area, limit: 100, null: false
t.string :description, limit: 2000, null: false
t.string :options, limit: 2000, null: true
t.string :state, limit: 2000, null: true
t.string :state_initial, limit: 2000, null: true
t.boolean :frontend, null: false
t.timestamps
end
add_index :settings, [:name], unique: true
@ -320,36 +332,82 @@ class CreateBase < ActiveRecord::Migration
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.integer :o_id, limit: 8, null: false
t.string :preferences, limit: 2500, null: true
t.string :size, limit: 50, null: true
t.string :filename, limit: 250, null: false
t.integer :created_by_id, 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.string :name, limit: 250, null: false
t.string :note, limit: 250, null: true
t.timestamps
end
add_index :store_objects, [:name], unique: true
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.string :sha, limit: 128, null: false
t.string :provider, limit: 20, null: true
t.timestamps
end
add_index :store_files, [:sha], unique: true
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.string :sha, limit: 128, null: false
t.binary :data, limit: 200.megabytes, null: true
t.timestamps
end
add_index :store_provider_dbs, [:sha], unique: true
add_index :store_provider_dbs, [:sha], unique: true
create_table :avatars do |t|
t.integer :o_id, null: false
t.integer :object_lookup_id, null: false
t.boolean :default, null: false, default: false
t.boolean :deletable, null: false, default: true
t.boolean :initial, null: false, default: false
t.integer :store_full_id, null: true
t.integer :store_resize_id, null: true
t.string :store_hash, limit: 32, null: true
t.string :source, limit: 100, null: false
t.string :source_url, limit: 512, null: true
t.integer :updated_by_id, null: false
t.integer :created_by_id, null: false
t.timestamps
end
add_index :avatars, [:o_id, :object_lookup_id]
add_index :avatars, [:store_hash]
add_index :avatars, [:source]
add_index :avatars, [:default]
create_table :online_notifications do |t|
t.integer :o_id, null: false
t.integer :object_lookup_id, null: false
t.integer :type_lookup_id, null: false
t.integer :user_id, null: false
t.boolean :seen, null: false, default: false
t.integer :created_by_id, null: false
t.timestamps
end
add_index :online_notifications, [:user_id]
create_table :delayed_jobs, force: true do |t|
t.integer :priority, default: 0 # Allows some jobs to jump to the front of the queue
t.integer :attempts, default: 0 # Provides for retries, but still fail eventually.
t.text :handler # YAML-encoded string of the object that will do work
t.text :last_error # reason for last failure (See Note below)
t.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
t.datetime :locked_at # Set when a client is working on this object
t.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
t.string :locked_by # Who is working on this object (if locked)
t.string :queue # The name of the queue this job is in
t.timestamps
end
add_index :delayed_jobs, [:priority, :run_at], name: 'delayed_jobs_priority'
end
end

View file

@ -302,9 +302,39 @@ class CreateTicket < ActiveRecord::Migration
add_index :templates_groups, [:template_id]
add_index :templates_groups, [:group_id]
create_table :channels do |t|
t.references :group, null: true
t.column :adapter, :string, limit: 100, null: false
t.column :area, :string, limit: 100, null: false
t.column :options, :string, limit: 2000, 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 :channels, [:area]
add_index :channels, [:adapter]
create_table :slas do |t|
t.column :name, :string, limit: 150, null: true
t.column :first_response_time, :integer, null: true
t.column :update_time, :integer, null: true
t.column :close_time, :integer, null: true
t.column :condition, :string, limit: 5000, null: true
t.column :data, :string, limit: 5000, null: true
t.column :timezone, :string, limit: 50, 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 :slas, [:name], unique: true
end
def self.down
drop_table :slas
drop_table :channels
drop_table :templates_groups
drop_table :templates
drop_table :text_modules_groups

View file

@ -1,22 +0,0 @@
class CreateDelayedJobs < ActiveRecord::Migration
def self.up
create_table :delayed_jobs, force: true do |table|
table.integer :priority, default: 0 # Allows some jobs to jump to the front of the queue
table.integer :attempts, default: 0 # Provides for retries, but still fail eventually.
table.text :handler # YAML-encoded string of the object that will do work
table.text :last_error # reason for last failure (See Note below)
table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
table.datetime :locked_at # Set when a client is working on this object
table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
table.string :locked_by # Who is working on this object (if locked)
table.string :queue # The name of the queue this job is in
table.timestamps
end
add_index :delayed_jobs, [:priority, :run_at], name: 'delayed_jobs_priority'
end
def self.down
drop_table :delayed_jobs
end
end

View file

@ -1,22 +0,0 @@
class CreateChannel < ActiveRecord::Migration
def up
create_table :channels do |t|
t.references :group, null: true
t.column :adapter, :string, limit: 100, null: false
t.column :area, :string, limit: 100, null: false
t.column :options, :string, limit: 2000, 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 :channels, [:area]
add_index :channels, [:adapter]
end
def down
drop_table :channels
end
end

View file

@ -1,21 +0,0 @@
class CreateSla < ActiveRecord::Migration
def up
create_table :slas do |t|
t.column :name, :string, limit: 150, null: true
t.column :first_response_time, :integer, null: true
t.column :update_time, :integer, null: true
t.column :close_time, :integer, null: true
t.column :condition, :string, limit: 5000, null: true
t.column :data, :string, limit: 5000, null: true
t.column :timezone, :string, limit: 50, 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 :slas, [:name], unique: true
end
def down
end
end

View file

@ -1,17 +0,0 @@
class CreateOnlineNotification < ActiveRecord::Migration
def up
create_table :online_notifications do |t|
t.column :o_id, :integer, null: false
t.column :object_lookup_id, :integer, null: false
t.column :type_lookup_id, :integer, null: false
t.column :user_id, :integer, null: false
t.column :seen, :boolean, null: false, default: false
t.column :created_by_id, :integer, null: false
t.timestamps
end
add_index :online_notifications, [:user_id]
end
def down
end
end

View file

@ -1,26 +0,0 @@
class CreateAvatar < ActiveRecord::Migration
def up
create_table :avatars do |t|
t.column :o_id, :integer, null: false
t.column :object_lookup_id, :integer, null: false
t.column :default, :boolean, null: false, default: false
t.column :deletable, :boolean, null: false, default: true
t.column :initial, :boolean, null: false, default: false
t.column :store_full_id, :integer, null: true
t.column :store_resize_id, :integer, null: true
t.column :store_hash, :string, limit: 32, null: true
t.column :source, :string, limit: 100, null: false
t.column :source_url, :string, limit: 512, null: true
t.column :updated_by_id, :integer, null: false
t.column :created_by_id, :integer, null: false
t.timestamps
end
add_index :avatars, [:o_id, :object_lookup_id]
add_index :avatars, [:store_hash]
add_index :avatars, [:source]
add_index :avatars, [:default]
end
def down
end
end

View file

@ -1,8 +0,0 @@
class TokenPersistent < ActiveRecord::Migration
def up
add_column :tokens, :persistent, :boolean
end
def down
end
end

View file

@ -1,25 +0,0 @@
class CreateLocale < ActiveRecord::Migration
def up
create_table :locales do |t|
t.string :locale, limit: 20, null: false
t.string :alias, limit: 20, null: true
t.string :name, limit: 255, null: false
t.boolean :active, null: false, default: true
t.timestamps null: false
end
add_index :locales, [:locale], unique: true
add_index :locales, [:name], unique: true
Locale.create(
locale: 'en-us',
alias: 'en',
name: 'English (United States)',
)
end
def down
end
end

View file

@ -1,8 +0,0 @@
class UpdateTranslation < ActiveRecord::Migration
def up
add_column :translations, :format, :string, limit: 20, null: false, default: 'string'
end
def down
end
end

View file

@ -1780,6 +1780,11 @@ Network::Item::Comment.create(
)
# install locales and translations
Locale.create(
locale: 'en-us',
alias: 'en',
name: 'English (United States)',
)
Locale.load
Translation.load