⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 db.pm

📁 bugzilla
💻 PM
📖 第 1 页 / 共 5 页
字号:
    $dbh->bz_add_column('whine_schedules', 'mailto_type',        {TYPE => 'INT2', NOTNULL => 1, DEFAULT => '0'});    _add_longdescs_already_wrapped();    # Moved enum types to separate tables so we need change the old enum     # types to standard varchars in the bugs table.    $dbh->bz_alter_column('bugs', 'bug_status',                          {TYPE => 'varchar(64)', NOTNULL => 1});    # 2005-03-23 Tomas.Kopal@altap.cz - add default value to resolution,    # bug 286695    $dbh->bz_alter_column('bugs', 'resolution',        {TYPE => 'varchar(64)', NOTNULL => 1, DEFAULT => "''"});    $dbh->bz_alter_column('bugs', 'priority',                          {TYPE => 'varchar(64)', NOTNULL => 1});    $dbh->bz_alter_column('bugs', 'bug_severity',                          {TYPE => 'varchar(64)', NOTNULL => 1});    $dbh->bz_alter_column('bugs', 'rep_platform',                          {TYPE => 'varchar(64)', NOTNULL => 1}, '');    $dbh->bz_alter_column('bugs', 'op_sys',                          {TYPE => 'varchar(64)', NOTNULL => 1});    # When migrating quips from the '$datadir/comments' file to the DB,    # the user ID should be NULL instead of 0 (which is an invalid user ID).    if ($dbh->bz_column_info('quips', 'userid')->{NOTNULL}) {        $dbh->bz_alter_column('quips', 'userid', {TYPE => 'INT3'});        print "Changing owner to NULL for quips where the owner is",              " unknown...\n";        $dbh->do('UPDATE quips SET userid = NULL WHERE userid = 0');    }    # Right now, we only create the "thetext" index on MySQL.    if ($dbh->isa('Bugzilla::DB::Mysql')) {        $dbh->bz_add_index('longdescs', 'longdescs_thetext_idx',                           {TYPE => 'FULLTEXT', FIELDS => [qw(thetext)]});    }    _convert_attachments_filename_from_mediumtext();    $dbh->bz_add_column('quips', 'approved',                        {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'TRUE'});    # 2002-12-20 Bug 180870 - remove manual shadowdb replication code    $dbh->bz_drop_table("shadowlog");    _rename_votes_count_and_force_group_refresh();    # 2004/02/15 - Summaries shouldn't be null - see bug 220232    if (!exists $dbh->bz_column_info('bugs', 'short_desc')->{NOTNULL}) {        $dbh->bz_alter_column('bugs', 'short_desc',                              {TYPE => 'MEDIUMTEXT', NOTNULL => 1}, '');    }    $dbh->bz_add_column('products', 'classification_id',                        {TYPE => 'INT2', NOTNULL => 1, DEFAULT => '1'});    _fix_group_with_empty_name();    $dbh->bz_add_index('bugs_activity', 'bugs_activity_who_idx', [qw(who)]);    # Add defaults for some fields that should have them but didn't.    $dbh->bz_alter_column('bugs', 'status_whiteboard',        {TYPE => 'MEDIUMTEXT', NOTNULL => 1, DEFAULT => "''"});    $dbh->bz_alter_column('bugs', 'keywords',        {TYPE => 'MEDIUMTEXT', NOTNULL => 1, DEFAULT => "''"});    $dbh->bz_alter_column('bugs', 'votes',                          {TYPE => 'INT3', NOTNULL => 1, DEFAULT => '0'});    $dbh->bz_alter_column('bugs', 'lastdiffed', {TYPE => 'DATETIME'});    # 2005-03-09 qa_contact should be NULL instead of 0, bug 285534    if ($dbh->bz_column_info('bugs', 'qa_contact')->{NOTNULL}) {        $dbh->bz_alter_column('bugs', 'qa_contact', {TYPE => 'INT3'});        $dbh->do("UPDATE bugs SET qa_contact = NULL WHERE qa_contact = 0");    }    # 2005-03-27 initialqacontact should be NULL instead of 0, bug 287483    if ($dbh->bz_column_info('components', 'initialqacontact')->{NOTNULL}) {        $dbh->bz_alter_column('components', 'initialqacontact',                               {TYPE => 'INT3'});        $dbh->do("UPDATE components SET initialqacontact = NULL " .                  "WHERE initialqacontact = 0");    }    _migrate_email_prefs_to_new_table();    _initialize_dependency_tree_changes_email_pref();    _change_all_mysql_booleans_to_tinyint();    # make classification_id field type be consistent with DB:Schema    $dbh->bz_alter_column('products', 'classification_id',                          {TYPE => 'INT2', NOTNULL => 1, DEFAULT => '1'});    # initialowner was accidentally NULL when we checked-in Schema,    # when it really should be NOT NULL.    $dbh->bz_alter_column('components', 'initialowner',                          {TYPE => 'INT3', NOTNULL => 1}, 0);    # 2005-03-28 - bug 238800 - index flags.type_id for editflagtypes.cgi    $dbh->bz_add_index('flags', 'flags_type_id_idx', [qw(type_id)]);    # For a short time, the flags_type_id_idx was misnamed in upgraded installs.    $dbh->bz_drop_index('flags', 'type_id');    # 2005-04-28 - LpSolit@gmail.com - Bug 7233: add an index to versions    $dbh->bz_alter_column('versions', 'value',                          {TYPE => 'varchar(64)', NOTNULL => 1});    _add_versions_product_id_index();    if (!exists $dbh->bz_column_info('milestones', 'sortkey')->{DEFAULT}) {        $dbh->bz_alter_column('milestones', 'sortkey',                              {TYPE => 'INT2', NOTNULL => 1, DEFAULT => 0});    }    # 2005-06-14 - LpSolit@gmail.com - Bug 292544    $dbh->bz_alter_column('bugs', 'creation_ts', {TYPE => 'DATETIME'});    _fix_whine_queries_title_and_op_sys_value();    _fix_attachments_submitter_id_idx();    _copy_attachments_thedata_to_attach_data();    _fix_broken_all_closed_series();    # 2005-08-14 bugreport@peshkin.net -- Bug 304583    # Get rid of leftover DERIVED group permissions    use constant GRANT_DERIVED => 1;    $dbh->do("DELETE FROM user_group_map WHERE grant_type = " . GRANT_DERIVED);    # PUBLIC is a reserved word in Oracle.    $dbh->bz_rename_column('series', 'public', 'is_public');    # 2005-09-28 bugreport@peshkin.net Bug 149504    $dbh->bz_add_column('attachments', 'isurl',                        {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 0});    # 2005-10-21 LpSolit@gmail.com - Bug 313020    $dbh->bz_add_column('namedqueries', 'query_type',                        {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 0});    # 2005-11-04 LpSolit@gmail.com - Bug 305927    $dbh->bz_alter_column('groups', 'userregexp',                          {TYPE => 'TINYTEXT', NOTNULL => 1, DEFAULT => "''"});    # 2005-09-26 - olav@bkor.dhs.org - Bug 119524    $dbh->bz_alter_column('logincookies', 'cookie',        {TYPE => 'varchar(16)', PRIMARYKEY => 1, NOTNULL => 1});     _clean_control_characters_from_short_desc();        # 2005-12-07 altlst@sonic.net -- Bug 225221    $dbh->bz_add_column('longdescs', 'comment_id',        {TYPE => 'MEDIUMSERIAL', NOTNULL => 1, PRIMARYKEY => 1});    _stop_storing_inactive_flags();    _change_short_desc_from_mediumtext_to_varchar();    # 2006-07-01 wurblzap@gmail.com -- Bug 69000    $dbh->bz_add_column('namedqueries', 'id',        {TYPE => 'MEDIUMSERIAL', NOTNULL => 1, PRIMARYKEY => 1});    _move_namedqueries_linkinfooter_to_its_own_table();    _add_classifications_sortkey();    _move_data_nomail_into_db();    # The products table lacked sensible defaults.    $dbh->bz_alter_column('products', 'milestoneurl',                          {TYPE => 'TINYTEXT', NOTNULL => 1, DEFAULT => "''"});    $dbh->bz_alter_column('products', 'disallownew',                          {TYPE => 'BOOLEAN', NOTNULL => 1,  DEFAULT => 0});    $dbh->bz_alter_column('products', 'votesperuser',                           {TYPE => 'INT2', NOTNULL => 1, DEFAULT => 0});    $dbh->bz_alter_column('products', 'votestoconfirm',                          {TYPE => 'INT2', NOTNULL => 1, DEFAULT => 0});    # 2006-08-04 LpSolit@gmail.com - Bug 305941    $dbh->bz_drop_column('profiles', 'refreshed_when');    $dbh->bz_drop_column('groups', 'last_changed');    # 2006-08-06 LpSolit@gmail.com - Bug 347521    $dbh->bz_alter_column('flagtypes', 'id',          {TYPE => 'SMALLSERIAL', NOTNULL => 1, PRIMARYKEY => 1});    $dbh->bz_alter_column('keyworddefs', 'id',        {TYPE => 'SMALLSERIAL', NOTNULL => 1, PRIMARYKEY => 1});    # 2006-08-19 LpSolit@gmail.com - Bug 87795    $dbh->bz_alter_column('tokens', 'userid', {TYPE => 'INT3'});    $dbh->bz_drop_index('bugs', 'bugs_short_desc_idx');    # The profiles table was missing some defaults.    $dbh->bz_alter_column('profiles', 'disabledtext',        {TYPE => 'MEDIUMTEXT', NOTNULL => 1, DEFAULT => "''"});    $dbh->bz_alter_column('profiles', 'realname',        {TYPE => 'varchar(255)', NOTNULL => 1, DEFAULT => "''"});    _update_longdescs_who_index();    $dbh->bz_add_column('setting', 'subclass', {TYPE => 'varchar(32)'});    $dbh->bz_alter_column('longdescs', 'thetext',         { TYPE => 'MEDIUMTEXT', NOTNULL => 1 }, '');    # 2006-10-20 LpSolit@gmail.com - Bug 189627    $dbh->bz_add_column('group_control_map', 'editcomponents',                        {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'FALSE'});    $dbh->bz_add_column('group_control_map', 'editbugs',                        {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'FALSE'});    $dbh->bz_add_column('group_control_map', 'canconfirm',                        {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'FALSE'});    # 2006-11-07 LpSolit@gmail.com - Bug 353656    $dbh->bz_add_column('longdescs', 'type',                        {TYPE => 'INT2', NOTNULL => 1, DEFAULT => '0'});    $dbh->bz_add_column('longdescs', 'extra_data', {TYPE => 'varchar(255)'});    $dbh->bz_add_column('versions', 'id',         {TYPE => 'MEDIUMSERIAL', NOTNULL => 1, PRIMARYKEY => 1});    $dbh->bz_add_column('milestones', 'id',        {TYPE => 'MEDIUMSERIAL', NOTNULL => 1, PRIMARYKEY => 1});    _fix_uppercase_custom_field_names();    _fix_uppercase_index_names();    ################################################################    # New --TABLE-- changes should go *** A B O V E *** this point #    ################################################################    Bugzilla::Hook::process('install-update_db');}# Subroutines should be ordered in the order that they are called.# Thus, newer subroutines should be at the bottom.sub _update_pre_checksetup_bugzillas {    my $dbh = Bugzilla->dbh;    # really old fields that were added before checksetup.pl existed    # but aren't in very old bugzilla's (like 2.1)    # Steve Stock (sstock@iconnect-inc.com)    $dbh->bz_add_column('bugs', 'target_milestone',        {TYPE => 'varchar(20)', NOTNULL => 1, DEFAULT => "'---'"});    $dbh->bz_add_column('bugs', 'qa_contact', {TYPE => 'INT3'});    $dbh->bz_add_column('bugs', 'status_whiteboard',                       {TYPE => 'MEDIUMTEXT', NOTNULL => 1, DEFAULT => "''"});    $dbh->bz_add_column('products', 'disallownew',                        {TYPE => 'BOOLEAN', NOTNULL => 1}, 0);    $dbh->bz_add_column('products', 'milestoneurl',                        {TYPE => 'TINYTEXT', NOTNULL => 1}, '');    $dbh->bz_add_column('components', 'initialqacontact',                        {TYPE => 'TINYTEXT'});    $dbh->bz_add_column('components', 'description',                        {TYPE => 'MEDIUMTEXT', NOTNULL => 1}, '');}sub _add_bug_vote_cache {    my $dbh = Bugzilla->dbh;    # 1999-10-11 Restructured voting database to add a cached value in each     # bug recording how many total votes that bug has.  While I'm at it,     # I removed the unused "area" field from the bugs database.  It is     # distressing to realize that the bugs table has reached the maximum     # number of indices allowed by MySQL (16), which may make future     # enhancements awkward.    # (P.S. All is not lost; it appears that the latest betas of MySQL     # support a new table format which will allow 32 indices.)    $dbh->bz_drop_column('bugs', 'area');    if (!$dbh->bz_column_info('bugs', 'votes')) {        $dbh->bz_add_column('bugs', 'votes', {TYPE => 'INT3', NOTNULL => 1,                                              DEFAULT => 0});        $dbh->bz_add_index('bugs', 'bugs_votes_idx', [qw(votes)]);    }    $dbh->bz_add_column('products', 'votesperuser',                        {TYPE => 'INT2', NOTNULL => 1}, 0);}sub _update_product_name_definition {    my $dbh = Bugzilla->dbh;    # The product name used to be very different in various tables.    #    # It was   varchar(16)   in bugs    #          tinytext      in components    #          tinytext      in products    #          tinytext      in versions    #    # tinytext is equivalent to varchar(255), which is quite huge, so I change    # them all to varchar(64).    # Only do this if these fields still exist - they're removed in    # a later change    if ($dbh->bz_column_info('products', 'product')) {        $dbh->bz_alter_column('bugs',       'product',                             {TYPE => 'varchar(64)', NOTNULL => 1});        $dbh->bz_alter_column('components', 'program', {TYPE => 'varchar(64)'});        $dbh->bz_alter_column('products',   'product', {TYPE => 'varchar(64)'});        $dbh->bz_alter_column('versions',   'program',                              {TYPE => 'varchar(64)', NOTNULL => 1});    }}sub _add_bug_keyword_cache {    my $dbh = Bugzilla->dbh;    # 2000-01-16 Added a "keywords" field to the bugs table, which    # contains a string copy of the entries of the keywords table for this

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -