When renaming a jobset, add a redirect from the old name

[?]
Apr 23, 2014, 9:12 PM
BXHG3HYLCKXL35S2MCIBTXTP6UO55NASYE7XCLQP4PXPSVDMUIAQC

Dependencies

  • [2] ZFEN2MAO Simplify jobset cloning
  • [3] YI3BZG5N Cleanup Jobset serialization
  • [4] LZVO64YG Merge in the first bits of the API work
  • [5] ZWCTAZGL added newsitems, added some admin options to clear various caches.
  • [6] TQVKZQUG Use the REST API in the web interface for editing jobsets
  • [7] X27GNHDV * Basic job info in the database.
  • [8] 3HZY24CX * Make jobsets viewable under
  • [9] IRRNAEVL Use notFound instead of status_not_found
  • [10] KSBB33RE Add a dashboard
  • [11] SB2V735V Keep track of the database schema version
  • [12] ODNCGFQ5 * Improved the navigation bar: don't include all projects (since that
  • [13] 7ECJWNVX Cleanup Project model
  • [14] Y6AHH4TH Remove the logfile and logSize columns from the database
  • [*] D5QIOJGP * Move everything up one directory.
  • [*] FYO6NECE hydra
  • [*] KN3VYE5P * Cleaned up the foreign key constraints.
  • [*] JM3DPYOM generated schema with new dbix class schema loader, grrrrrr
  • [*] N22GPKYT * Put info about logs / build products in the DB.

Change contents

  • replacement in src/lib/Hydra/Controller/Jobset.pm at line 23
    [4.245][4.123:284]()
    notFound($c, "Jobset ‘$jobsetName’ doesn't exist.")
    if !$c->stash->{jobset} && !($c->action->name eq "jobset" and $c->request->method eq "PUT");
    [4.245]
    [4.699]
    if (!$c->stash->{jobset} && !($c->action->name eq "jobset" and $c->request->method eq "PUT")) {
    my $rename = $project->jobsetrenames->find({ from_ => $jobsetName });
    notFound($c, "Jobset ‘$jobsetName’ doesn't exist.") unless defined $rename;
    $c->stash->{jobset} = $project->jobsets->find({ name => $rename->to_ }) or die;
    }
  • edit in src/lib/Hydra/Controller/Jobset.pm at line 199
    [4.1112]
    [4.1112]
    my $oldName = $jobset->name;
  • replacement in src/lib/Hydra/Controller/Jobset.pm at line 204
    [4.1361][4.1361:1474]()
    if $jobsetName ne $jobset->name && defined $c->stash->{project}->jobsets->find({ name => $jobsetName });
    [4.1361]
    [4.1667]
    if $jobsetName ne $oldName && defined $c->stash->{project}->jobsets->find({ name => $jobsetName });
  • edit in src/lib/Hydra/Controller/Jobset.pm at line 231
    [4.2285]
    [2.64]
    $jobset->project->jobsetrenames->search({ from_ => $jobsetName })->delete;
    $jobset->project->jobsetrenames->create({ from_ => $oldName, to_ => $jobsetName })
    if $jobsetName ne $oldName;
  • file addition: JobsetRenames.pm (----------)
    [16.477]
    use utf8;
    package Hydra::Schema::JobsetRenames;
    # Created by DBIx::Class::Schema::Loader
    # DO NOT MODIFY THE FIRST PART OF THIS FILE
    =head1 NAME
    Hydra::Schema::JobsetRenames
    =cut
    use strict;
    use warnings;
    use base 'DBIx::Class::Core';
    =head1 COMPONENTS LOADED
    =over 4
    =item * L<Hydra::Component::ToJSON>
    =back
    =cut
    __PACKAGE__->load_components("+Hydra::Component::ToJSON");
    =head1 TABLE: C<JobsetRenames>
    =cut
    __PACKAGE__->table("JobsetRenames");
    =head1 ACCESSORS
    =head2 project
    data_type: 'text'
    is_foreign_key: 1
    is_nullable: 0
    =head2 from_
    data_type: 'text'
    is_nullable: 0
    =head2 to_
    data_type: 'text'
    is_foreign_key: 1
    is_nullable: 0
    =cut
    __PACKAGE__->add_columns(
    "project",
    { data_type => "text", is_foreign_key => 1, is_nullable => 0 },
    "from_",
    { data_type => "text", is_nullable => 0 },
    "to_",
    { data_type => "text", is_foreign_key => 1, is_nullable => 0 },
    );
    =head1 PRIMARY KEY
    =over 4
    =item * L</project>
    =item * L</from_>
    =back
    =cut
    __PACKAGE__->set_primary_key("project", "from_");
    =head1 RELATIONS
    =head2 jobset
    Type: belongs_to
    Related object: L<Hydra::Schema::Jobsets>
    =cut
    __PACKAGE__->belongs_to(
    "jobset",
    "Hydra::Schema::Jobsets",
    { name => "to_", project => "project" },
    { is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" },
    );
    =head2 project
    Type: belongs_to
    Related object: L<Hydra::Schema::Projects>
    =cut
    __PACKAGE__->belongs_to(
    "project",
    "Hydra::Schema::Projects",
    { name => "project" },
    { is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" },
    );
    # Created by DBIx::Class::Schema::Loader v0.07033 @ 2014-04-23 23:13:51
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SBpKWF9swFc9T1Uc0VFlgA
    # You can replace this text with custom code or comments, and it will be preserved on regeneration
    1;
  • edit in src/lib/Hydra/Schema/Jobsets.pm at line 273
    [17.3194]
    [17.3194]
    =head2 jobsetrenames
    Type: has_many
    Related object: L<Hydra::Schema::JobsetRenames>
  • edit in src/lib/Hydra/Schema/Jobsets.pm at line 280
    [17.3195]
    [4.22309]
    =cut
    __PACKAGE__->has_many(
    "jobsetrenames",
    "Hydra::Schema::JobsetRenames",
    { "foreign.project" => "self.project", "foreign.to_" => "self.name" },
    undef,
    );
  • replacement in src/lib/Hydra/Schema/Jobsets.pm at line 323
    [4.1963][4.1963:2105]()
    # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-10-14 15:46:29
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:DTAGxP5RFvcNxP/ciJGo4Q
    [4.1963]
    [3.0]
    # Created by DBIx::Class::Schema::Loader v0.07033 @ 2014-04-23 23:13:51
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CO0aE+jrjB+UrwGRzWZLlw
  • edit in src/lib/Hydra/Schema/Projects.pm at line 153
    [18.2211]
    [19.20800]
    =head2 jobsetrenames
    Type: has_many
    Related object: L<Hydra::Schema::JobsetRenames>
  • edit in src/lib/Hydra/Schema/Projects.pm at line 160
    [19.20801]
    [4.24803]
    =cut
    __PACKAGE__->has_many(
    "jobsetrenames",
    "Hydra::Schema::JobsetRenames",
    { "foreign.project" => "self.name" },
    undef,
    );
  • replacement in src/lib/Hydra/Schema/Projects.pm at line 300
    [4.7308][4.2323:2465]()
    # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-10-14 15:46:29
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PdNQ2mf5azBB6nI+iAm8fQ
    [4.7308]
    [4.171]
    # Created by DBIx::Class::Schema::Loader v0.07033 @ 2014-04-23 22:48:21
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:l8eN9UAavdqnL7Sjv4rmFw
  • edit in src/sql/hydra.sql at line 73
    [18.5726]
    [18.5726]
    );
    create table JobsetRenames (
    project text not null,
    from_ text not null,
    to_ text not null,
    primary key (project, from_),
    foreign key (project) references Projects(name) on delete cascade on update cascade,
    foreign key (project, to_) references Jobsets(project, name) on delete cascade on update cascade
  • file addition: upgrade-26.sql (----------)
    [16.3004]
    create table JobsetRenames (
    project text not null,
    from_ text not null,
    to_ text not null,
    primary key (project, from_),
    foreign key (project) references Projects(name) on delete cascade on update cascade,
    foreign key (project, to_) references Jobsets(project, name) on delete cascade on update cascade
    );