From: Moritz Bunkus Date: Fri, 24 May 2013 12:33:56 +0000 (+0200) Subject: Spaltentyp "custom_variable_configs.type" und ".module" auf TEXT geändert X-Git-Tag: release-3.1.0beta1~302 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=ab56c1a046909c2d193c65335c34cc11b0630a46;p=kivitendo-erp.git Spaltentyp "custom_variable_configs.type" und ".module" auf TEXT geändert --- diff --git a/SL/DB/MetaSetup/CustomVariableConfig.pm b/SL/DB/MetaSetup/CustomVariableConfig.pm index 5ee01c19d..c4077f805 100644 --- a/SL/DB/MetaSetup/CustomVariableConfig.pm +++ b/SL/DB/MetaSetup/CustomVariableConfig.pm @@ -11,16 +11,16 @@ __PACKAGE__->meta->setup( columns => [ id => { type => 'integer', not_null => 1, sequence => 'custom_variable_configs_id' }, - name => { type => 'text' }, - description => { type => 'text' }, - type => { type => 'varchar', length => 20 }, - module => { type => 'varchar', length => 20 }, + name => { type => 'text', not_null => 1 }, + description => { type => 'text', not_null => 1 }, + type => { type => 'text', not_null => 1 }, + module => { type => 'text', not_null => 1 }, default_value => { type => 'text' }, options => { type => 'text' }, - searchable => { type => 'boolean' }, - includeable => { type => 'boolean' }, - included_by_default => { type => 'boolean' }, - sortkey => { type => 'integer' }, + searchable => { type => 'boolean', not_null => 1 }, + includeable => { type => 'boolean', not_null => 1 }, + included_by_default => { type => 'boolean', not_null => 1 }, + sortkey => { type => 'integer', not_null => 1 }, itime => { type => 'timestamp', default => 'now()' }, mtime => { type => 'timestamp' }, flags => { type => 'text' }, diff --git a/sql/Pg-upgrade2/custom_variable_configs_column_type_text.sql b/sql/Pg-upgrade2/custom_variable_configs_column_type_text.sql new file mode 100644 index 000000000..98ebbbc05 --- /dev/null +++ b/sql/Pg-upgrade2/custom_variable_configs_column_type_text.sql @@ -0,0 +1,30 @@ +-- @tag: custom_variable_configs_column_type_text +-- @description: Spaltentypen in 'custom_varialbe_configs' anpassen & schärfere Restriktionen +-- @depends: release_3_0_0 +-- @charset: utf-8 +ALTER TABLE custom_variable_configs ALTER COLUMN type TYPE TEXT; +ALTER TABLE custom_variable_configs ALTER COLUMN module TYPE TEXT; + +UPDATE custom_variable_configs SET searchable = FALSE WHERE searchable IS NULL; +UPDATE custom_variable_configs SET includeable = FALSE WHERE includeable IS NULL; +UPDATE custom_variable_configs SET included_by_default = FALSE WHERE included_by_default IS NULL; + +ALTER TABLE custom_variable_configs ALTER COLUMN searchable SET NOT NULL; +ALTER TABLE custom_variable_configs ALTER COLUMN includeable SET NOT NULL; +ALTER TABLE custom_variable_configs ALTER COLUMN included_by_default SET NOT NULL; +ALTER TABLE custom_variable_configs ALTER COLUMN name SET NOT NULL; +ALTER TABLE custom_variable_configs ALTER COLUMN description SET NOT NULL; +ALTER TABLE custom_variable_configs ALTER COLUMN type SET NOT NULL; +ALTER TABLE custom_variable_configs ALTER COLUMN module SET NOT NULL; +ALTER TABLE custom_variable_configs ALTER COLUMN sortkey SET NOT NULL; + +ALTER TABLE custom_variable_configs +ADD CONSTRAINT custom_variable_configs_name_description_type_module_not_empty +CHECK ( type <> '' + AND module <> '' + AND name <> '' + AND description <> ''); + +ALTER TABLE custom_variable_configs +ADD CONSTRAINT custom_variable_configs_options_not_empty_for_select +CHECK ((type <> 'select') OR (COALESCE(options, '') <> ''));