From 2e8b0469f0e37c6b64aed7fc7fba53cc8d67866e Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 17 Dec 2014 16:19:18 +0100 Subject: [PATCH] Merged several migrations. --- db/migrate/20120101000001_create_base.rb | 59 +++++++++++++++++++ db/migrate/20120101000010_create_ticket.rb | 2 +- db/migrate/20120101000080_create_token.rb | 17 ------ db/migrate/20121117121944_tags_create.rb | 28 --------- db/migrate/20121225162100_create_package.rb | 23 -------- .../20130101230004_change_ticket_state.rb | 8 --- db/migrate/20130104141228_change_user.rb | 8 --- ...20130212224310_change_user_login_failed.rb | 7 --- .../20141217000001_update_object_manager2.rb | 2 +- 9 files changed, 61 insertions(+), 93 deletions(-) delete mode 100644 db/migrate/20120101000080_create_token.rb delete mode 100644 db/migrate/20121117121944_tags_create.rb delete mode 100644 db/migrate/20121225162100_create_package.rb delete mode 100644 db/migrate/20130101230004_change_ticket_state.rb delete mode 100644 db/migrate/20130104141228_change_user.rb delete mode 100644 db/migrate/20130212224310_change_user_login_failed.rb diff --git a/db/migrate/20120101000001_create_base.rb b/db/migrate/20120101000001_create_base.rb index 003b568ea..2f38788e7 100644 --- a/db/migrate/20120101000001_create_base.rb +++ b/db/migrate/20120101000001_create_base.rb @@ -31,6 +31,8 @@ class CreateBase < ActiveRecord::Migration t.column :note, :string, :limit => 250, :null => true t.column :last_login, :timestamp, :null => true t.column :source, :string, :limit => 200, :null => true + t.column :locale, :string, :limit => 10, :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 @@ -46,6 +48,7 @@ class CreateBase < ActiveRecord::Migration add_index :users, [:source] 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 @@ -57,6 +60,7 @@ class CreateBase < ActiveRecord::Migration 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 @@ -68,6 +72,7 @@ class CreateBase < ActiveRecord::Migration end add_index :email_addresses, [:email], :unique => true + create_table :groups do |t| t.references :signature, :null => true t.references :email_address, :null => true @@ -93,6 +98,7 @@ class CreateBase < ActiveRecord::Migration 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 @@ -119,6 +125,7 @@ class CreateBase < ActiveRecord::Migration t.integer :organization_id end + create_table :authorizations do |t| t.string :provider, :limit => 250, :null => false t.string :uid, :limit => 250, :null => false @@ -132,6 +139,7 @@ class CreateBase < ActiveRecord::Migration add_index :authorizations, [:user_id] add_index :authorizations, [:username] + create_table :translations do |t| t.column :locale, :string, :limit => 10, :null => false t.column :source, :string, :limit => 255, :null => false @@ -144,6 +152,7 @@ class CreateBase < ActiveRecord::Migration add_index :translations, [:source] add_index :translations, [:locale] + create_table :object_lookups do |t| t.column :name, :string, :limit => 250, :null => false t.timestamps @@ -156,6 +165,56 @@ class CreateBase < ActiveRecord::Migration 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.timestamps + end + add_index :tokens, :user_id + add_index :tokens, [:name, :action], :unique => true + 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.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.timestamps + end + + + 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.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.timestamps + end + add_index :tag_objects, [:name], :unique => true + + create_table :tag_items do |t| + t.column :name, :string, :limit => 250, :null => false + t.timestamps + end + add_index :tag_items, [:name], :unique => true + end end diff --git a/db/migrate/20120101000010_create_ticket.rb b/db/migrate/20120101000010_create_ticket.rb index 607d4e22b..ed9d9d8bc 100644 --- a/db/migrate/20120101000010_create_ticket.rb +++ b/db/migrate/20120101000010_create_ticket.rb @@ -10,7 +10,7 @@ class CreateTicket < ActiveRecord::Migration add_index :ticket_state_types, [:name], :unique => true create_table :ticket_states do |t| - t.references :ticket_state_type, :null => false + t.references :state_type, :null => false t.column :name, :string, :limit => 250, :null => false t.column :note, :string, :limit => 250, :null => true t.column :active, :boolean, :null => false, :default => true diff --git a/db/migrate/20120101000080_create_token.rb b/db/migrate/20120101000080_create_token.rb deleted file mode 100644 index 0dcc2c5f3..000000000 --- a/db/migrate/20120101000080_create_token.rb +++ /dev/null @@ -1,17 +0,0 @@ -class CreateToken < ActiveRecord::Migration - def up - 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.timestamps - end - add_index :tokens, :user_id - add_index :tokens, [:name, :action], :unique => true - add_index :tokens, :created_at - end - - def down - drop_table :tokens - end -end diff --git a/db/migrate/20121117121944_tags_create.rb b/db/migrate/20121117121944_tags_create.rb deleted file mode 100644 index 2d8972421..000000000 --- a/db/migrate/20121117121944_tags_create.rb +++ /dev/null @@ -1,28 +0,0 @@ -class TagsCreate < ActiveRecord::Migration - def up - 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.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.timestamps - end - add_index :tag_objects, [:name], :unique => true - - create_table :tag_items do |t| - t.column :name, :string, :limit => 250, :null => false - t.timestamps - end - add_index :tag_items, [:name], :unique => true - end - - def down - end -end diff --git a/db/migrate/20121225162100_create_package.rb b/db/migrate/20121225162100_create_package.rb deleted file mode 100644 index f20b83237..000000000 --- a/db/migrate/20121225162100_create_package.rb +++ /dev/null @@ -1,23 +0,0 @@ -class CreatePackage < ActiveRecord::Migration - def up - 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.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.timestamps - end - end - - def down - drop_table :packages - drop_table :package_migrations - end -end diff --git a/db/migrate/20130101230004_change_ticket_state.rb b/db/migrate/20130101230004_change_ticket_state.rb deleted file mode 100644 index 295746d5e..000000000 --- a/db/migrate/20130101230004_change_ticket_state.rb +++ /dev/null @@ -1,8 +0,0 @@ -class ChangeTicketState < ActiveRecord::Migration - def up - rename_column :ticket_states, :ticket_state_type_id, :state_type_id - end - - def down - end -end diff --git a/db/migrate/20130104141228_change_user.rb b/db/migrate/20130104141228_change_user.rb deleted file mode 100644 index e469e26fd..000000000 --- a/db/migrate/20130104141228_change_user.rb +++ /dev/null @@ -1,8 +0,0 @@ -class ChangeUser < ActiveRecord::Migration - def up - add_column :users, :locale, :string, :limit => 10, :null => true - end - - def down - end -end diff --git a/db/migrate/20130212224310_change_user_login_failed.rb b/db/migrate/20130212224310_change_user_login_failed.rb deleted file mode 100644 index 3b47fdff8..000000000 --- a/db/migrate/20130212224310_change_user_login_failed.rb +++ /dev/null @@ -1,7 +0,0 @@ -class ChangeUserLoginFailed < ActiveRecord::Migration - def up - add_column :users, :login_failed, :integer, :null => false, :default => 0 - end - def down - end -end diff --git a/db/migrate/20141217000001_update_object_manager2.rb b/db/migrate/20141217000001_update_object_manager2.rb index 566ab2ec3..cdb654b59 100644 --- a/db/migrate/20141217000001_update_object_manager2.rb +++ b/db/migrate/20141217000001_update_object_manager2.rb @@ -1,7 +1,7 @@ class UpdateObjectManager2 < ActiveRecord::Migration def up - remove_index :object_manager_attributes, [:name] + #remove_index :object_manager_attributes, [:name] ObjectManager::Attribute.add( :object => 'User',