Project

General

Profile

Bug #1911

MySQL database migration fails when using the mysql2 gem

Added by Martin Wilke almost 10 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Sam Kottler
Category:
DB migrations
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

Hi,

If I want to use mysql support and run db import i it fails to import with this:

[root@gomo_web /usr/local/opt/foreman/foreman]# bundle exec rake db:migrate RAILS_ENV=production
/usr/local/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:10: warning: already initialized constant ENC_NONE
/usr/local/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:11: warning: already initialized constant ENC_EUC
/usr/local/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:12: warning: already initialized constant ENC_SJIS
/usr/local/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:13: warning: already initialized constant ENC_UTF8
CreateHosts: migrating ==================================================
AddCreatedAtToAllTables: migrating ======================================
-- add_column("inventory_facts", :created_at, :datetime)
> 0.0070s
-
add_column("schema_migrations", :created_at, :datetime)
-> 0.0060s
AddCreatedAtToAllTables: migrated (0.0225s) =============================

RemoveDuplicatedIndexOnAllTables: migrating =============================
RemoveDuplicatedIndexOnAllTables: migrated (0.0061s) ==================== AddEnvironmentToHost: migrating =========================================
AddEnvironmentToHost: migrated (0.0012s) ================================ AddInventoryServiceTables: migrating ====================================
AddInventoryServiceTables: migrated (0.0009s) ===========================

-- add_column(:hosts, :mac, :string, {:limit=>17, :default=>""})
> 0.0079s
-
add_column(:hosts, :sp_mac, :string, {:limit=>17, :default=>""})
> 0.0081s
-
add_column(:hosts, :sp_ip, :string, {:limit=>15, :default=>""})
> 0.0076s
-
add_column(:hosts, :sp_name, :string, {:default=>""})
> 0.0077s
-
add_column(:hosts, :root_pass, :string, {:limit=>64})
> 0.0082s
-
add_column(:hosts, :serial, :string, {:limit=>12})
> 0.0080s
-
add_column(:hosts, :puppetmaster, :string)
> 0.0078s
-
add_column(:hosts, :puppet_status, :integer, {:default=>0, :null=>false})
> 0.0162s
-
add_column(:hosts, :domain_id, :integer)
> 0.0078s
-
add_column(:hosts, :architecture_id, :integer)
> 0.0083s
-
add_column(:hosts, :operatingsystem_id, :integer)
> 0.0077s
-
add_column(:hosts, :environment_id, :integer)
> 0.0079s
-
add_column(:hosts, :subnet_id, :integer)
> 0.0083s
-
add_column(:hosts, :sp_subnet_id, :integer)
> 0.0078s
-
add_column(:hosts, :ptable_id, :integer)
> 0.0078s
-
add_column(:hosts, :medium_id, :integer)
> 0.0083s
-
add_column(:hosts, :build, :boolean, {:default=>true})
> 0.0081s
-
add_column(:hosts, :comment, :text)
> 0.0090s
-
add_column(:hosts, :disk, :text)
> 0.0082s
-
add_column(:hosts, :installed_at, :datetime)
-> 0.0087s
CreateHosts: migrated (0.3749s) =========================================

AddAuditsTable: migrating ===============================================
-- create_table(:audits, {:force=>true})
> 0.0060s
-
add_index(:audits, [:auditable_id, :auditable_type], {:name=>"auditable_index"})
> 0.0068s
-
add_index(:audits, [:user_id, :user_type], {:name=>"user_index"})
> 0.0066s
-
add_index(:audits, :created_at)
> 0.0062s
-
add_index(:audits, [:auditable_parent_id, :auditable_parent_type], {:name=>"auditable_parent_index"})
-> 0.0064s
AddAuditsTable: migrated (0.0325s) ====================================== CreateArchitectures: migrating ==========================================
-- create_table(:architectures)
> 0.0041s
-
create_table(:architectures_operatingsystems, {:id=>false})
-> 0.0037s
CreateArchitectures: migrated (0.0080s) ================================= CreateMedia: migrating ==================================================
-- create_table(:media)
-> 0.0042s
CreateMedia: migrated (0.0275s) ========================================= CreateDomains: migrating ================================================
-- create_table(:domains)
-> 0.0048s
CreateDomains: migrated (0.0049s) ======================================= CreateSubnets: migrating ================================================
-- create_table(:subnets)
-> 0.0054s
CreateSubnets: migrated (0.0055s) ======================================= CreateOperatingsystems: migrating =======================================
-- create_table(:operatingsystems)
-> 0.0044s
CreateOperatingsystems: migrated (0.0045s) ============================== CreateModels: migrating =================================================
-- create_table(:models)
> 0.0040s
-
add_column(:hosts, :model_id, :integer)
-> 0.0080s
CreateModels: migrated (0.0123s) ======================================== CreateEnvironments: migrating ===========================================
-- create_table(:environments)
> 0.0041s
-
create_table(:environments_puppetclasses, {:id=>false})
-> 0.0038s
CreateEnvironments: migrated (0.0082s) ================================== CreateReports: migrating ================================================
-- create_table(:reports)
-> 0.0049s
CreateReports: migrated (0.0050s) ======================================= CreatePtables: migrating ================================================
-- create_table(:ptables)
> 0.0043s
-
create_table(:operatingsystems_ptables, {:id=>false})
-> 0.0042s
CreatePtables: migrated (0.0232s) ======================================= CreatePuppetclasses: migrating ==========================================
-- create_table(:puppetclasses)
> 0.0043s
-
create_table(:hosts_puppetclasses, {:id=>false})
> 0.0035s
-
create_table(:operatingsystems_puppetclasses, {:id=>false})
-> 0.0035s
CreatePuppetclasses: migrated (0.0117s) ================================= CreateParameters: migrating =============================================
-- create_table(:parameters)
-> 0.0040s
CreateParameters: migrated (0.0042s) ==================================== CreateAuthSources: migrating ============================================
-- create_table(:auth_sources)
-> 0.0052s
CreateAuthSources: migrated (0.0053s) =================================== CreateHostgroups: migrating =============================================
-- create_table(:hostgroups)
> 0.0043s
-
create_table(:hostgroups_puppetclasses, {:id=>false})
> 0.0036s
-
add_column(:hosts, :hostgroup_id, :integer)
> 0.0083s
-
add_column(:parameters, :hostgroup_id, :integer)
-> 0.0059s
CreateHostgroups: migrated (0.0226s) ==================================== AddTypeToParameter: migrating ===========================================
-- add_column(:parameters, :type, :string)
-> 0.0066s
AddTypeToParameter: migrated (0.0067s) ================================== AddDomainToParameter: migrating =========================================
-- add_column(:parameters, :domain_id, :integer)
-> 0.0060s
AddDomainToParameter: migrated (0.0061s) ================================ ChangeReportFieldTypeToText: migrating ==================================
-- execute("ALTER TABLE reports MODIFY log text;")
-> 0.0012s
ChangeReportFieldTypeToText: migrated (0.0014s) ========================= ChangeHostBuildDefaultToFalse: migrating ================================
-- change_column(:hosts, :build, :boolean, {:default=>false})
-> 0.0044s
ChangeHostBuildDefaultToFalse: migrated (0.0127s) ======================= AddIndexToHost: migrating ===============================================
-- add_index("hosts", "last_report")
> 0.0070s
-
add_index("hosts", "installed_at")
> 0.0067s
-
add_index("hosts", "puppet_status")
> 0.0067s
-
add_index("hosts", :domain_id, {:name=>"host_domain_id_ix"})
> 0.0069s
-
add_index("hosts", :architecture_id, {:name=>"host_arch_id_ix"})
> 0.0076s
-
add_index("hosts", :operatingsystem_id, {:name=>"host_os_id_ix"})
> 0.0078s
-
add_index("hosts", :environment_id, {:name=>"host_env_id_ix"})
> 0.0068s
-
add_index("hosts", :medium_id, {:name=>"host_medium_id_ix"})
> 0.0064s
-
add_index("hosts", :hostgroup_id, {:name=>"host_group_id_ix"})
-> 0.0064s
AddIndexToHost: migrated (0.0632s) ====================================== AddIndexToParameters: migrating =========================================
-- add_index(:parameters, [:host_id, :type])
> 0.0064s
-
add_index(:parameters, [:hostgroup_id, :type])
> 0.0063s
-
add_index(:parameters, [:domain_id, :type])
> 0.0060s
-
add_index(:parameters, :type)
-> 0.0066s
AddIndexToParameters: migrated (0.0258s) ================================ AddIndexToReports: migrating ============================================
-- add_index(:reports, [:reported_at, :host_id])
-> 0.0060s
AddIndexToReports: migrated (0.0061s) =================================== CreateUsers: migrating ==================================================
-- create_table(:users)
-> 0.0049s
CreateUsers: migrated (0.0051s) ========================================= CreateSessions: migrating ===============================================
-- create_table(:sessions)
> 0.0043s
-
add_index(:sessions, :session_id)
> 0.0066s
-
add_index(:sessions, :updated_at)
-> 0.0060s
CreateSessions: migrated (0.0172s) ====================================== AddStatusToReport: migrating ============================================
-- add_column(:reports, :status, :integer)
> 0.0068s
-
add_index(:reports, :status)
> 0.0068s
-
add_index(:reports, :host_id)
> 0.0070s
-
add_index(:reports, :reported_at)
-> 0.0063s
AddStatusToReport: migrated (0.0273s) =================================== CalcExistingReports: migrating ==========================================
CalcExistingReports: migrated (0.0024s) ================================= CreateLookupKeys: migrating =============================================
-- create_table(:lookup_keys)
> 0.1111s
-
add_index(:lookup_keys, :key)
-> 0.0071s
CreateLookupKeys: migrated (0.1185s) ==================================== CreateLookupValues: migrating ===========================================
-- create_table(:lookup_values)
> 0.0043s
-
add_index(:lookup_values, :priority)
-> 0.0069s
CreateLookupValues: migrated (0.0115s) ================================== ChangeMysqlReportsColumn: migrating =====================================
-- execute("ALTER TABLE reports MODIFY log mediumtext;")
-> 0.0089s
ChangeMysqlReportsColumn: migrated (0.0092s) ============================ AddFamilyToOs: migrating ================================================
-- add_column(:operatingsystems, :family_id, :integer)
-> 0.0075s
AddFamilyToOs: migrated (0.0089s) ======================================= UpdateFactNamesAndValuesToBin: migrating ================================
-- execute("ALTER TABLE fact_names MODIFY name varchar(255) COLLATE utf8_bin NOT NULL")
> 0.0066s
-
execute("ALTER TABLE fact_values MODIFY value varchar(255) COLLATE utf8_bin NOT NULL")
-> 0.0073s
UpdateFactNamesAndValuesToBin: migrated (0.0142s) ======================= AddReleasenameToOs: migrating ===========================================
-- add_column(:operatingsystems, :release_name, :string, {:limit=>64})
-> 0.0061s
AddReleasenameToOs: migrated (0.0157s) ================================== CreateUsergroups: migrating =============================================
-- create_table(:usergroups)
> 0.0045s
-
create_table(:usergroup_members)
-> 0.0046s
CreateUsergroups: migrated (0.0093s) ==================================== AddOwnerToHosts: migrating ==============================================
-- add_column(:hosts, :owner_id, :integer)
> 0.0147s
-
add_column(:hosts, :owner_type, :string)
-> 0.0207s
AddOwnerToHosts: migrated (0.1380s) ===================================== AddUbuntuCustomLvmPtable: migrating =====================================
AddUbuntuCustomLvmPtable: migrated (0.0253s) ============================ CreateMediaOperatingsystemsAndMigrateData: migrating ====================
-- create_table(:media_operatingsystems, {:id=>false})
> 0.0045s
-
remove_column(:media, :operatingsystem_id)
-> 0.0061s
CreateMediaOperatingsystemsAndMigrateData: migrated (0.0174s) =========== MigrateInstallationMediumUri: migrating =================================
MigrateInstallationMediumUri: migrated (0.0186s) ======================== SimplifyParameters: migrating ===========================================
-- remove_index(:parameters, [:host_id, :type])
> 0.0067s
-
remove_index(:parameters, [:hostgroup_id, :type])
> 0.0066s
-
remove_index(:parameters, [:domain_id, :type])
> 0.0065s
-
rename_column(:parameters, :host_id, :reference_id)
> 0.0089s
-
add_index(:parameters, [:reference_id, :type])
> 0.0068s
-
Everything migrated ok so we remove the old columns
-- remove_column(:parameters, :hostgroup_id)
> 0.0081s
-
remove_column(:parameters, :domain_id)
-> 0.0075s
SimplifyParameters: migrated (0.0583s) ================================== UpdateOsMinor: migrating ================================================
-- change_column(:operatingsystems, :minor, :string, {:limit=>16, :default=>"", :null=>false})
-> 0.0073s
UpdateOsMinor: migrated (0.0105s) ======================================= ChangeFamilyInOs: migrating =============================================
-- add_column(:operatingsystems, :type, :string, {:limit=>16})
> 0.0061s
-
add_index(:operatingsystems, :type)
> 0.0071s
-
remove_column(:operatingsystems, :family_id)
-> 0.0074s
ChangeFamilyInOs: migrated (0.0220s) ==================================== CreateNotices: migrating ================================================
-- create_table(:notices)
> 0.0044s
-
create_table(:user_notices, {:id=>false})
-> 0.0037s
CreateNotices: migrated (0.0083s) ======================================= AddInternalAuth: migrating ==============================================
-- add_column(:users, :password_hash, :string, {:limit=>128})
> 0.0061s
-
add_column(:users, :password_salt, :string, {:limit=>128})
> 0.0062s
-
Mail is invalid
AddInternalAuth: migrated (0.2338s) ===================================== CreateRoles: migrating ==================================================
-- add_column(:users, :role_id, :integer)
> 0.0067s
-
create_table("roles", {:force=>true})
> 0.0060s
-
create_table(:user_roles)
-> 0.0041s
CreateRoles: migrated (0.0172s) ========================================= AddUserDomainsAndHostgroups: migrating ==================================
-- create_table(:user_domains, {:id=>false})
> 0.0037s
-
create_table(:user_hostgroups, {:id=>false})
-> 0.0036s
AddUserDomainsAndHostgroups: migrated (0.0076s) ========================= CreateUserFacts: migrating ==============================================
-- create_table(:user_facts)
-> 0.0044s
CreateUserFacts: migrated (0.0045s) ===================================== AddEnabledToHosts: migrating ============================================
-- add_column(:hosts, :enabled, :boolean, {:default=>true})
-> 0.0150s
AddEnabledToHosts: migrated (0.0151s) =================================== AddMyBooleansToUser: migrating ==========================================
-- add_column(:users, :domains_andor, :string, {:limit=>3, :default=>"or"})
> 0.0060s
-
add_column(:users, :hostgroups_andor, :string, {:limit=>3, :default=>"or"})
> 0.0061s
-
add_column(:users, :facts_andor, :string, {:limit=>3, :default=>"or"})
-> 0.0068s
AddMyBooleansToUser: migrated (0.0192s) ================================= CreateMessages: migrating ===============================================
-- create_table(:messages)
> 0.0038s
-
execute("ALTER TABLE messages ENGINE = MYISAM")
> 0.0029s
-
execute("ALTER TABLE messages ADD FULLTEXT (value)")
-> 0.0018s
CreateMessages: migrated (0.0090s) ====================================== CreateSources: migrating ================================================
-- create_table(:sources)
> 0.0040s
-
execute("ALTER TABLE sources ENGINE = MYISAM")
> 0.0029s
-
execute("ALTER TABLE sources ADD FULLTEXT (value)")
-> 0.0018s
CreateSources: migrated (0.0091s) ======================================= CreateLogs: migrating ===================================================
-- create_table(:logs)
> 0.0045s
-
add_index(:logs, :report_id)
> 0.0067s
-
add_index(:logs, :message_id)
> 0.0066s
-
add_index(:logs, :level_id)
-> 0.0064s
CreateLogs: migrated (0.0246s) ========================================== AddMetricsToReport: migrating ===========================================
-- add_column(:reports, :metrics, :text)
-> 0.0095s
AddMetricsToReport: migrated (0.0096s) ================================== ConvertReports: migrating ===============================================
-- About to convert all of the 0 reports log field into a more DB optimized way... this might take a while.....
-- remove_column(:reports, :log)
-> 0.0088s
ConvertReports: migrated (0.0129s) ====================================== AddOwnedFilterToUser: migrating =========================================
-- add_column(:users, :filter_on_owner, :boolean)
-> 0.0064s
AddOwnedFilterToUser: migrated (0.0065s) ================================ CorrectMedia: migrating =================================================
-- table_exists?(:medias)
-> 0.0015s
CorrectMedia: migrated (0.0016s) ======================================== CreateConfigTemplates: migrating ========================================
-- create_table(:config_templates)
-> 0.0046s
CreateConfigTemplates: migrated (0.0048s) =============================== CreateTemplateCombinations: migrating ===================================
-- create_table(:template_combinations)
-> 0.0175s
CreateTemplateCombinations: migrated (0.0176s) ========================== CreateOperatingsystemsConfigTemplates: migrating ========================
-- create_table(:config_templates_operatingsystems, {:id=>false})
-> 0.0039s
CreateOperatingsystemsConfigTemplates: migrated (0.0040s) =============== CreateTemplateKinds: migrating ==========================================
-- create_table(:template_kinds)
-> 0.0039s
CreateTemplateKinds: migrated (0.0408s) ================================= CreateOsDefaultTemplates: migrating =====================================
-- create_table(:os_default_templates)
-> 0.0043s
CreateOsDefaultTemplates: migrated (0.0045s) ============================ AddDefaultTemplates: migrating ==========================================
AddDefaultTemplates: migrated (0.2886s) ================================= AddSubSystemsToSubnet: migrating ========================================
-- add_column(:subnets, :dhcp_id, :integer)
> 0.0070s
-
add_column(:subnets, :tftp_id, :integer)
> 0.0060s
-
rename_column(:subnets, :number, :network)
-> 0.0082s
AddSubSystemsToSubnet: migrated (0.0215s) =============================== CreateProxies: migrating ================================================
-- create_table(:smart_proxies)
-> 0.0043s
CreateProxies: migrated (0.0044s) ======================================= AddProxyToDomain: migrating =============================================
-- add_column(:domains, :dns_id, :integer)
> 0.0061s
-
remove_column(:domains, :dnsserver)
> 0.0063s
-
remove_column(:domains, :gateway)
-> 0.0061s
AddProxyToDomain: migrated (0.0187s) ==================================== AddGrubbyTemplate: migrating ============================================
AddGrubbyTemplate: migrated (0.0089s) =================================== CreateHypervisors: migrating ============================================
-- create_table(:hypervisors)
-> 0.0047s
CreateHypervisors: migrated (0.0048s) =================================== AddHostGroupDefaults: migrating =========================================
-- add_column(:hostgroups, :environment_id, :integer)
> 0.0058s
-
add_column(:hostgroups, :operatingsystem_id, :integer)
> 0.0058s
-
add_column(:hostgroups, :architecture_id, :integer)
> 0.0065s
-
add_column(:hostgroups, :medium_id, :integer)
> 0.0060s
-
add_column(:hostgroups, :ptable_id, :integer)
> 0.0061s
-
add_column(:hostgroups, :root_pass, :string)
> 0.0059s
-
add_column(:hostgroups, :puppetmaster, :string)
-> 0.0060s
AddHostGroupDefaults: migrated (0.0429s) ================================ AddDefaultPxeMenuTemplate: migrating ====================================
AddDefaultPxeMenuTemplate: migrated (0.0088s) =========================== CreateProxyFeatures: migrating ==========================================
-- create_table(:features)
> 0.0049s
-
create_table(:features_smart_proxies, {:id=>false})
-> 0.0039s
CreateProxyFeatures: migrated (0.0286s) ================================= ChangePuppetmasterColumn: migrating =====================================
-- rename_column(:hosts, :puppetmaster, :puppetmaster_name)
> 0.0190s
-
add_column(:hosts, :puppetproxy_id, :integer)
> 0.0155s
-
rename_column(:hostgroups, :puppetmaster, :puppetmaster_name)
> 0.0080s
-
add_column(:hostgroups, :puppetproxy_id, :integer)
-> 0.0058s
ChangePuppetmasterColumn: migrated (0.0487s) ============================ AddManagedToHosts: migrating ============================================
-- add_column(:hosts, :managed, :boolean)
-> 0.0152s
AddManagedToHosts: migrated (0.0163s) =================================== RevertFaceNamesAndValuesToTextRecords: migrating ========================
-- execute("ALTER TABLE fact_values MODIFY value text COLLATE utf8_bin NOT NULL;")
-> 0.0073s
RevertFaceNamesAndValuesToTextRecords: migrated (0.0076s) =============== AddPriorityToParameter: migrating =======================================
-- add_column(:parameters, :priority, :integer)
-> 0.0077s
AddPriorityToParameter: migrated (0.0112s) ============================== AddMediaPathToMedium: migrating =========================================
-- add_column(:media, :media_path, :string, {:limit=>128})
> 0.0058s
-
add_column(:media, :config_path, :string, {:limit=>128})
> 0.0059s
-
add_column(:media, :image_path, :string, {:limit=>128})
-> 0.0062s
AddMediaPathToMedium: migrated (0.0182s) ================================ AddImageToHost: migrating ===============================================
-- add_column(:hosts, :use_image, :boolean)
> 0.0155s
-
add_column(:hosts, :image_file, :string, {:limit=>128})
> 0.0153s
-
add_column(:hostgroups, :use_image, :boolean)
> 0.0061s
-
add_column(:hostgroups, :image_file, :string, {:limit=>128})
-> 0.0062s
AddImageToHost: migrated (0.0436s) ====================================== RemoveUnusedFieldsFromPuppetClasses: migrating ==========================
-- remove_column(:puppetclasses, :nameindicator)
> 0.0060s
-
remove_column(:puppetclasses, :operatingsystem_id)
-> 0.0059s
RemoveUnusedFieldsFromPuppetClasses: migrated (0.0120s) ================= AddTableBookmarks: migrating ============================================
-- create_table(:bookmarks, {:force=>true})
> 0.0058s
-
add_index(:bookmarks, :name)
> 0.0077s
-
add_index(:bookmarks, :controller)
> 0.0062s
-
add_index(:bookmarks, [:owner_id, :owner_type])
-> 0.0061s
AddTableBookmarks: migrated (0.0553s) =================================== AddSolarisTemplates: migrating ==========================================
AddSolarisTemplates: migrated (0.0724s) ================================= AddSolarisDisks: migrating ==============================================
AddSolarisDisks: migrated (0.0285s) ===================================== AddLookUpKeyIdToPuppetClass: migrating ==================================
-- add_column(:lookup_keys, :puppetclass_id, :integer)
> 0.0082s
-
add_index(:lookup_keys, :puppetclass_id)
> 0.0067s
-
add_column(:lookup_keys, :default_value, :string)
> 0.0072s
-
add_column(:lookup_keys, :path, :string)
> 0.0073s
-
add_index(:lookup_keys, :path)
> 0.0072s
-
add_column(:lookup_keys, :description, :string)
> 0.0085s
-
add_column(:lookup_keys, :validator_type, :string)
> 0.0079s
-
add_column(:lookup_keys, :validator_rule, :string)
> 0.0087s
-
rename_column(:lookup_values, :priority, :match)
> 0.0082s
-
add_index(:lookup_values, :match)
-> 0.0071s
AddLookUpKeyIdToPuppetClass: migrated (0.0779s) ========================= AddSparcInfoToModel: migrating ==========================================
-- add_column(:models, :vendor_class, :string, {:limit=>32})
> 0.0060s
-
add_column(:models, :hardware_model, :string, {:limit=>16})
-> 0.0058s
AddSparcInfoToModel: migrated (0.0120s) ================================= AddAncestryToHostgroup: migrating =======================================
-- add_column(:hostgroups, :ancestry, :string)
> 0.0061s
-
add_index(:hostgroups, :ancestry)
-> 0.0075s
AddAncestryToHostgroup: migrated (0.0138s) ============================== CreateSettings: migrating ===============================================
-- create_table(:settings)
> 0.0050s
-
add_index(:settings, :name, {:unique=>true})
-> 0.0072s
CreateSettings: migrated (0.0124s) ====================================== UpdateAuditsTable: migrating ============================================
UpdateAuditsTable: migrated (0.0016s) =================================== CreateHostClass: migrating ==============================================
-- rename_table(:hosts_puppetclasses, :host_classes)
> 0.0011s
-
add_column(:host_classes, :id, :primary_key)
-> 0.0060s
CreateHostClass: migrated (0.0073s) ===================================== AddSuseTemplates: migrating =============================================
AddSuseTemplates: migrated (0.0599s) ==================================== AddVmDefaultsToHostgroup: migrating =====================================
-- add_column(:hostgroups, :vm_defaults, :text)
-> 0.0072s
AddVmDefaultsToHostgroup: migrated (0.0073s) ============================ AddSubnetAndDomainToHostGroups: migrating ===============================
-- column_exists?(:hostgroups, :subnet_id)
> 0.0018s
-
add_column(:hostgroups, :subnet_id, :integer)
> 0.0075s
-
column_exists?(:hostgroups, :domain_id)
> 0.0019s
-
add_column(:hostgroups, :domain_id, :integer)
-> 0.0070s
AddSubnetAndDomainToHostGroups: migrated (0.0186s) ====================== RenameChangesToAuditedChanges: migrating ================================
-- rename_column(:audits, :changes, :audited_changes)
-> 0.0114s
RenameChangesToAuditedChanges: migrated (0.0115s) ======================= AddRemoteAddressToAudits: migrating =====================================
-- add_column(:audits, :remote_address, :string)
-> 0.0095s
AddRemoteAddressToAudits: migrated (0.0096s) ============================ RenameParentToAssociation: migrating ====================================
-- rename_column(:audits, :auditable_parent_id, :association_id)
> 0.0113s
-
rename_column(:audits, :auditable_parent_type, :association_type)
-> 0.0117s
RenameParentToAssociation: migrated (0.0232s) =========================== AddGatewayAndDnsToSubnets: migrating ====================================
-- add_column(:subnets, :gateway, :string)
> 0.0060s
-
add_column(:subnets, :dns_primary, :string)
> 0.0059s
-
add_column(:subnets, :dns_secondary, :string)
-> 0.0065s
AddGatewayAndDnsToSubnets: migrated (0.0187s) =========================== EnsureAllHostnamesAreLowercase: migrating ===============================
-- execute("UPDATE hosts SET name=LOWER")
-> 0.0004s
EnsureAllHostnamesAreLowercase: migrated (0.0005s) ====================== AddFromAndToRangesToSubnets: migrating ==================================
-- add_column(:subnets, :from, :string)
> 0.0061s
-
add_column(:subnets, :to, :string)
> 0.0060s
-
remove_column(:subnets, :ranges)
-> 0.0060s
AddFromAndToRangesToSubnets: migrated (0.0185s) ========================= CreateSubnetDomain: migrating ===========================================
-- create_table(:subnet_domains)
> 0.0042s
-
remove_column(:subnets, :domain_id)
-> 0.0070s
CreateSubnetDomain: migrated (0.1343s) ================================== CreateComputeResources: migrating =======================================
-- create_table(:compute_resources)
-> 0.0046s
CreateComputeResources: migrated (0.0048s) ============================== AddUuidAndComputeIdToHost: migrating ====================================
-- add_column(:hosts, :uuid, :string)
> 0.0155s
-
add_column(:hosts, :compute_resource_id, :integer)
-> 0.0161s
AddUuidAndComputeIdToHost: migrated (0.0317s) =========================== AddWindowsTemplates: migrating ==========================================
AddWindowsTemplates: migrated (0.0581s) ================================= AddPuppetMasterProxyToHostAndHostGroup: migrating =======================
-- rename_column(:hosts, :puppetproxy_id, :puppet_ca_proxy_id)
> 0.0206s
-
add_column(:hosts, :puppet_proxy_id, :integer)
> 0.0157s
-
rename_column(:hostgroups, :puppetproxy_id, :puppet_ca_proxy_id)
> 0.0100s
-
add_column(:hostgroups, :puppet_proxy_id, :integer)
> 0.0077s
-
remove_column(:hosts, :puppetmaster_name)
> 0.0164s
-
remove_column(:hostgroups, :puppetmaster_name)
-> 0.0080s
AddPuppetMasterProxyToHostAndHostGroup: migrated (0.1661s) ============== UpdateReportFieldToLargeInt: migrating ==================================
-- change_column(:reports, :status, :bigint)
> 0.0106s
-
change_column(:hosts, :puppet_status, :bigint)
-> 0.0197s
UpdateReportFieldToLargeInt: migrated (0.0306s) ========================= CreateImages: migrating =================================================
-- create_table(:images)
-> 0.0053s
CreateImages: migrated (0.0054s) ======================================== AddCertNameToHost: migrating ============================================
-- add_column(:hosts, :certname, :string)
> 0.0155s
-
add_index("hosts", :certname)
-> 0.0087s
AddCertNameToHost: migrated (0.0244s) =================================== CreateKeyPairs: migrating ===============================================
-- create_table(:key_pairs)
-> 0.0051s
CreateKeyPairs: migrated (0.0052s) ====================================== AddDnsIdToSubnet: migrating =============================================
-- add_column(:subnets, :dns_id, :integer)
-> 0.0065s
AddDnsIdToSubnet: migrated (0.0066s) ==================================== AddImageIdToHost: migrating =============================================
-- add_column(:hosts, :image_id, :integer)
-> 0.0161s
AddImageIdToHost: migrated (0.0163s) ==================================== AddUserComputeResources: migrating ======================================
-- create_table(:user_compute_resources, {:id=>false})
-> 0.0034s
AddUserComputeResources: migrated (0.0036s) ============================= AddComputeResourcesBooleanToUser: migrating =============================
-- add_column(:users, :compute_resources_andor, :string, {:limit=>3, :default=>"or"})
-> 0.0061s
AddComputeResourcesBooleanToUser: migrated (0.0062s) ==================== AddEpelSnippets: migrating ==============================================
AddEpelSnippets: migrated (0.0068s) ===================================== ConvertParamsToText: migrating ==========================================
-- change_column("parameters", :value, :text, {:limit=>false})
rake aborted!
An error has occurred, all later migrations canceled:

No text type has character length false

Tasks: TOP => db:migrate
(See full trace by running task with --trace)

I have no clue whats exactly wrong is but it seems that all tables are there.

A another problem is importing facts:

[root@gomo_web /usr/local/opt/foreman/foreman]# rake --trace puppet:import:hosts_and_facts RAILS_ENV=production
/usr/local/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:10: warning: already initialized constant ENC_NONE
/usr/local/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:11: warning: already initialized constant ENC_EUC
/usr/local/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:12: warning: already initialized constant ENC_SJIS
/usr/local/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:13: warning: already initialized constant ENC_UTF8
  • Invoke puppet:import:hosts_and_facts (first_time)
  • Invoke environment (first_time)
  • Execute environment
  • Execute puppet:import:hosts_and_facts
    Importing from /var/puppet/yaml/facts
    Importing gomo_web
    rake aborted!
    Mysql::Error: Column 'name' cannot be null: INSERT INTO `hosts` (`created_at`, `owner_id`, `use_image`, `uuid`, `owner_type`, `architecture_id`, `last_report`, `disk`, `hostgroup_id`, `image_file`, `sp_ip`, `domain_id`, `updated_at`, `compute_resource_id`, `sp_subnet_id`, `sp_mac`, `last_compile`, `puppet_ca_proxy_id`, `environment_id`, `sp_name`, `last_freshcheck`, `managed`, `environment`, `enabled`, `root_pass`, `operatingsystem_id`, `image_id`, `installed_at`, `mac`, `subnet_id`, `puppet_proxy_id`, `medium_id`, `ip`, `name`, `serial`, `model_id`, `certname`, `build`, `source_file_id`, `comment`, `puppet_status`, `ptable_id`) VALUES ('2012-10-22 10:25:13', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '', NULL, '2012-10-22 10:25:13', NULL, NULL, '', NULL, NULL, NULL, '', NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0, NULL)
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/mysql_adapter.rb:289:in `query'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/mysql_adapter.rb:289:in `execute'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/abstract_adapter.rb:202:in `log'
    /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.17/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/abstract_adapter.rb:200:in `log'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/mysql_adapter.rb:289:in `execute'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/abstract/database_statements.rb:282:in `insert_sql'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/mysql_adapter.rb:300:in `insert_sql'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/abstract/database_statements.rb:44:in `insert'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/abstract/query_cache.rb:16:in `insert'
    /usr/local/lib/ruby/gems/1.8/gems/arel-2.0.10/lib/arel/select_manager.rb:217:in `insert'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/relation.rb:14:in `__send__'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/relation.rb:14:in `insert'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/persistence.rb:281:in `create'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/timestamp.rb:47:in `create'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/callbacks.rb:277:in `create'
    /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.17/lib/active_support/callbacks.rb:419:in `_run_create_callbacks'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/callbacks.rb:277:in `create'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/persistence.rb:257:in `create_or_update'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/callbacks.rb:273:in `create_or_update'
    /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.17/lib/active_support/callbacks.rb:519:in `_run_save_callbacks'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/callbacks.rb:273:in `create_or_update'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/persistence.rb:40:in `save'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/validations.rb:43:in `save'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/attribute_methods/dirty.rb:21:in `save'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/transactions.rb:240:in `save'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/transactions.rb:292:in `with_transaction_returning_status'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/transactions.rb:207:in `transaction'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/transactions.rb:290:in `with_transaction_returning_status'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/transactions.rb:240:in `save'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/transactions.rb:251:in `rollback_active_record_state!'
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/transactions.rb:239:in `save'
    /usr/local/opt/foreman/foreman/app/models/host.rb:401:in `importHostAndFacts'
    /usr/local/opt/foreman/foreman/lib/tasks/puppet.rake:53
    /usr/local/opt/foreman/foreman/lib/tasks/puppet.rake:50:in `each'
    /usr/local/opt/foreman/foreman/lib/tasks/puppet.rake:50
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
    /usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/bin/rake:33
    /usr/local/bin/rake:23:in `load'
    /usr/local/bin/rake:23
    Tasks: TOP => puppet:import:hosts_and_facts

Please let me know if you need more information.

Thx

Associated revisions

Revision 915f89fe (diff)
Added by Sam Kottler almost 10 years ago

Fixes #1911 - removes limit from change_column's in a few migrations

History

#1 Updated by Ohad Levy almost 10 years ago

  • Priority changed from High to Normal

if you use puppet 2.x does it work? puppet 3.0.x is unstable at the moment and does not work with foreman.

#2 Updated by Robert Birnie almost 10 years ago

I'm getting this same error with mysql gem and centos. It fails to do rake db:migrate with error "No text type has character length false" the migration in question is:

class ConvertParamsToText < ActiveRecord::Migration
def self.up
change_column 'parameters', :value, :text, :limit => false
change_column 'lookup_values', :value, :text, :limit => false
end

def self.down
change_column 'parameters', :value, :string
change_column 'lookup_values', :value, :string
end
end

Error is:

ConvertParamsToText: migrating ==========================================
-- change_column("parameters", :value, :text, {:limit=>false})
rake aborted!
An error has occurred, all later migrations canceled:

No text type has character length false

#3 Updated by Robert Birnie almost 10 years ago

Looks like the issue is related to mysql version 5.1

#4 Updated by Robert Birnie almost 10 years ago

Ok. My workaround. use adapter: mysql and do rake db:migrate

this'll go till the error above. Then change the adapter: mysql2 and do db:migrate again. This'll then complete successfully.

Starting out with mysql2 gives this on first entry:

  • Execute db:migrate
    CreateHosts: migrating ==================================================
    rake aborted!
    An error has occurred, all later migrations canceled:

Mysql2::Error: BLOB/TEXT column 'title' used in key specification without a key length: CREATE INDEX `index_resources_on_title_and_restype` ON `resources` (`title`, `restype`)

and my database.yml

production:
adapter: mysql2
database: foreman

#5 Updated by Ohad Levy almost 10 years ago

  • Status changed from New to Feedback

does removing the


:limit => false

solves the issue all together?

#6 Updated by Sam Kottler almost 10 years ago

  • Assignee set to Sam Kottler

I've run across this before. Looking into it now.

#7 Updated by Sam Kottler almost 10 years ago

I can't reproduce this on MySQL 5.1 with a CentOS 6.3 machine on Puppet 2 or 3 with the mysql2 gem.

Can you provide more information to help me track this issue down about the exact MySQL version and Foreman version?

#8 Updated by Sam Kottler almost 10 years ago

  • Subject changed from puppet3 mysql db:migration / facts fails to import to MySQL database migration fails when using the mysql2 gem

#9 Updated by Sam Kottler almost 10 years ago

  • Status changed from Feedback to Ready For Testing

I was able to reproduce this on an Ubuntu 12.04 machine. It's not specific to mysql2.

Submitted a PR - https://github.com/theforeman/foreman/pull/233.

#10 Updated by Robert Birnie almost 10 years ago

This fixes it for me. Thanks Sam.

#11 Updated by Sam Kottler almost 10 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF