Some datables cleanups.

This commit is contained in:
Martin Edenhofer 2012-11-06 22:43:13 +01:00
parent 43b14dfad6
commit 4a6681697f
14 changed files with 24 additions and 136 deletions

View file

@ -7,7 +7,7 @@ class App.ControllerForm extends App.Controller
@form = @formGen()
# @log 'form', @form
if @el
@el.append( @form )
@el.prepend( @form )
html: =>
@form.html()

View file

@ -116,10 +116,10 @@ curl http://localhost/api/users.json -v -u #{login}:#{password} -H "Content-Type
def create
user = User.new( User.param_cleanup(params) )
user.updated_by_id = (current_user && current_user.id) || 1
user.created_by_id = (current_user && current_user.id) || 1
begin
user.save
# if it's a signup, add user to customer role
if user.created_by_id == 1
@ -155,6 +155,8 @@ curl http://localhost/api/users.json -v -u #{login}:#{password} -H "Content-Type
end
end
user.save
# send inviteation if needed
if params[:invite]

View file

@ -73,8 +73,8 @@ class CreateBase < ActiveRecord::Migration
t.references :email_address, :null => true
t.column :name, :string, :limit => 100, :null => false
t.column :assignment_timeout, :integer, :null => true
t.column :follow_up_possible, :string, :limit => 100, :default => 'yes', :null => true
t.column :follow_up_assignment, :boolean, :default => 1
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
@ -132,6 +132,18 @@ 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
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.timestamps
end
add_index :translations, [:source]
add_index :translations, [:locale]
end
end

View file

@ -210,7 +210,7 @@ class CreateTicket < ActiveRecord::Migration
t.column :link_object_target_value, :integer, :null => false
t.timestamps
end
add_index :links, [:link_object_source_id, :link_object_source_value, :link_object_target_id, :link_object_target_value, :link_types_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'
end
def self.down

View file

@ -1,19 +0,0 @@
class CreateTranslation < ActiveRecord::Migration
def up
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.timestamps
end
add_index :translations, [:source]
add_index :translations, [:locale]
end
def down
drop_table :translations
end
end

View file

@ -1,22 +0,0 @@
class GroupUpdate < ActiveRecord::Migration
def up
# t.references :signature, :null => true
add_column :groups, :signature_id, :integer, :null => true
add_column :groups, :assignment_timeout, :integer, :null => true
add_column :groups, :follow_up_possible, :string, :limit => 100, :default => 'yes', :null => true
add_column :groups, :follow_up_assignment, :boolean, :default => 1
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 :created_by_id, :integer, :null => false
t.timestamps
end
add_index :signatures, [:name], :unique => true
end
def down
end
end

View file

@ -1,8 +0,0 @@
class OverviewUpdate < ActiveRecord::Migration
def up
add_column :overviews, :role_id, :integer, :null => true
end
def down
end
end

View file

@ -1,43 +0,0 @@
class CreateChangeById < ActiveRecord::Migration
def up
add_column :channels, :updated_by_id, :integer, :null => true
add_column :overviews, :created_by_id, :integer, :null => true
add_column :overviews, :updated_by_id, :integer, :null => true
add_column :users, :updated_by_id, :integer, :null => true
add_column :signatures, :updated_by_id, :integer, :null => true
add_column :groups, :updated_by_id, :integer, :null => true
add_column :roles, :updated_by_id, :integer, :null => true
add_column :organizations, :updated_by_id, :integer, :null => true
add_column :ticket_state_types, :updated_by_id, :integer, :null => true
add_column :ticket_state_types, :created_by_id, :integer, :null => true
add_column :ticket_states, :updated_by_id, :integer, :null => true
add_column :ticket_states, :created_by_id, :integer, :null => true
add_column :ticket_priorities, :updated_by_id, :integer, :null => true
add_column :ticket_priorities, :created_by_id, :integer, :null => true
add_column :tickets, :updated_by_id, :integer, :null => true
add_column :ticket_article_types, :updated_by_id, :integer, :null => true
add_column :ticket_article_types, :created_by_id, :integer, :null => true
add_column :ticket_article_senders, :updated_by_id, :integer, :null => true
add_column :ticket_article_senders, :created_by_id, :integer, :null => true
add_column :ticket_articles, :updated_by_id, :integer, :null => true
add_column :networks, :updated_by_id, :integer, :null => true
add_column :networks, :created_by_id, :integer, :null => true
add_column :network_category_types, :updated_by_id, :integer, :null => true
add_column :network_category_types, :created_by_id, :integer, :null => true
add_column :network_privacies, :updated_by_id, :integer, :null => true
add_column :network_privacies, :created_by_id, :integer, :null => true
add_column :network_categories, :updated_by_id, :integer, :null => true
add_column :network_categories, :created_by_id, :integer, :null => true
add_column :network_items, :updated_by_id, :integer, :null => true
add_column :network_item_comments, :updated_by_id, :integer, :null => true
add_column :network_item_plus, :updated_by_id, :integer, :null => true
add_column :network_category_subscriptions, :updated_by_id, :integer, :null => true
add_column :network_item_subscriptions, :updated_by_id, :integer, :null => true
add_column :templates, :updated_by_id, :integer, :null => true
add_column :translations, :created_by_id, :integer, :null => true
add_column :translations, :updated_by_id, :integer, :null => true
end
def down
end
end

View file

@ -1,21 +0,0 @@
class SignatureUpdate < ActiveRecord::Migration
def up
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.timestamps
end
add_index :email_addresses, [:email], :unique => true
add_column :groups, :email_address_id, :integer, :null => true
end
def down
end
end

View file

@ -1,8 +0,0 @@
class UsersUpdate < ActiveRecord::Migration
def up
add_column :users, :last_login, :timestamp, :null => true
end
def down
end
end

View file

@ -1,8 +0,0 @@
class OverviewUpdate2 < ActiveRecord::Migration
def up
add_column :overviews, :group_by, :string, :limit => 250, :null => true
end
def down
end
end

View file

@ -1556,7 +1556,9 @@ Network::Category.create(
:allow_comments => true,
:network_category_type_id => Network::Category::Type.where(:name => 'Idea').first.id,
:network_privacy_id => Network::Privacy.where(:name => 'logged in').first.id,
:allow_comments => true
:allow_comments => true,
:updated_by_id => 1,
:created_by_id => 1,
)
Network::Category.create(
:name => 'Bug Reports',
@ -1572,7 +1574,8 @@ item = Network::Item.create(
:title => 'Example Announcement',
:body => 'Some announcement....',
:network_category_id => Network::Category.where(:name => 'Announcements').first.id,
:created_by_id => User.where(:login => '-').first.id
:updated_by_id => 1,
:created_by_id => 1,
)
Network::Item::Comment.create(
:network_item_id => item.id,