Skip to content

Commit

Permalink
Add sorting_pos to bridge tables between nodes and objects
Browse files Browse the repository at this point in the history
many-to-many rels readded manually as the loader is ignoring them now.
  • Loading branch information
melmothx committed Feb 4, 2024
1 parent ee51d62 commit f568b85
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 83 deletions.
11 changes: 2 additions & 9 deletions lib/AmuseWikiFarm/Schema/Result/Aggregation.pm
Original file line number Diff line number Diff line change
Expand Up @@ -280,20 +280,13 @@ __PACKAGE__->belongs_to(
{ is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" },
);

=head2 nodes

Type: many_to_many
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-02-04 10:21:08
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:u64oudOvWQ0hvzb8HQbEKA

Composing rels: L</node_aggregations> -> node
=cut

__PACKAGE__->many_to_many("nodes", "node_aggregations", "node");


# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-01-31 14:33:44
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:wXStTsaW0wNLj4y7zsjDPw

use AmuseWikiFarm::Log::Contextual;

sub sqlt_deploy_hook {
Expand Down
11 changes: 2 additions & 9 deletions lib/AmuseWikiFarm/Schema/Result/AggregationSeries.pm
Original file line number Diff line number Diff line change
Expand Up @@ -184,20 +184,13 @@ __PACKAGE__->belongs_to(
{ is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" },
);

=head2 nodes

Type: many_to_many
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-02-04 10:21:08
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TFmMgjtA0OU5orrTG0cFPQ

Composing rels: L</node_aggregation_series> -> node
=cut

__PACKAGE__->many_to_many("nodes", "node_aggregation_series", "node");


# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-01-31 14:33:44
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ne33d+bTABqBYyS+fnDy4A

sub bump_oai_pmh_records {
my $self = shift;
foreach my $agg ($self->aggregations) {
Expand Down
16 changes: 4 additions & 12 deletions lib/AmuseWikiFarm/Schema/Result/Category.pm
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,6 @@ __PACKAGE__->has_many(
{ cascade_copy => 0, cascade_delete => 0 },
);

=head2 nodes
Type: many_to_many
Composing rels: L</node_categories> -> node
=cut

__PACKAGE__->many_to_many("nodes", "node_categories", "node");

=head2 titles
Type: many_to_many
Expand All @@ -220,8 +210,10 @@ Composing rels: L</title_categories> -> title
__PACKAGE__->many_to_many("titles", "title_categories", "title");


# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-04-05 08:15:44
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hdrQWlxYWWxzRpXlv/uGqw
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-02-04 10:21:08
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xJaYkc1CT49O3v91CoySSA

__PACKAGE__->many_to_many("nodes", "node_categories", "node");

=head2 published_titles
Expand Down
38 changes: 3 additions & 35 deletions lib/AmuseWikiFarm/Schema/Result/Node.pm
Original file line number Diff line number Diff line change
Expand Up @@ -270,53 +270,21 @@ __PACKAGE__->belongs_to(
{ is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" },
);

=head2 aggregation_series

Type: many_to_many
Composing rels: L</node_aggregation_series> -> aggregation_series
=cut
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-02-04 10:21:08
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VtwWxn/LpdpAg+FBdohlhw

__PACKAGE__->many_to_many(
"aggregation_series",
"node_aggregation_series",
"aggregation_series",
);

=head2 aggregations
Type: many_to_many
Composing rels: L</node_aggregations> -> aggregation
=cut

__PACKAGE__->many_to_many("aggregations", "node_aggregations", "aggregation");

=head2 categories
Type: many_to_many
Composing rels: L</node_categories> -> category
=cut

__PACKAGE__->many_to_many("categories", "node_categories", "category");

=head2 titles
Type: many_to_many
Composing rels: L</node_titles> -> title
=cut

__PACKAGE__->many_to_many("titles", "node_titles", "title");


# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-01-20 15:08:10
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:e2qKuKUuWxgCTWN71140JA


use AmuseWikiFarm::Log::Contextual;
use Text::Amuse::Functions qw/muse_to_object
Expand Down
12 changes: 10 additions & 2 deletions lib/AmuseWikiFarm/Schema/Result/NodeAggregation.pm
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,21 @@ __PACKAGE__->table("node_aggregation");
is_foreign_key: 1
is_nullable: 0
=head2 sorting_pos
data_type: 'integer'
default_value: 0
is_nullable: 0
=cut

__PACKAGE__->add_columns(
"node_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"aggregation_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"sorting_pos",
{ data_type => "integer", default_value => 0, is_nullable => 0 },
);

=head1 PRIMARY KEY
Expand Down Expand Up @@ -106,8 +114,8 @@ __PACKAGE__->belongs_to(
);


# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-01-20 15:09:01
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Gvydp8JTZB69wD83NghIcg
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-02-04 10:21:08
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9r/PhbV8mr/OIQIJeSwtMQ


# You can replace this text with custom code or comments, and it will be preserved on regeneration
Expand Down
12 changes: 10 additions & 2 deletions lib/AmuseWikiFarm/Schema/Result/NodeAggregationSeries.pm
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,21 @@ __PACKAGE__->table("node_aggregation_series");
is_foreign_key: 1
is_nullable: 0
=head2 sorting_pos
data_type: 'integer'
default_value: 0
is_nullable: 0
=cut

__PACKAGE__->add_columns(
"node_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"aggregation_series_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"sorting_pos",
{ data_type => "integer", default_value => 0, is_nullable => 0 },
);

=head1 PRIMARY KEY
Expand Down Expand Up @@ -106,8 +114,8 @@ __PACKAGE__->belongs_to(
);


# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-01-20 15:09:01
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dHdenrCYOUDNAm0ej+EQgA
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-02-04 10:21:08
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jQ757lcY5yGHx+lsMTlAyQ


# You can replace this text with custom code or comments, and it will be preserved on regeneration
Expand Down
12 changes: 10 additions & 2 deletions lib/AmuseWikiFarm/Schema/Result/NodeCategory.pm
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,21 @@ __PACKAGE__->table("node_category");
is_foreign_key: 1
is_nullable: 0
=head2 sorting_pos
data_type: 'integer'
default_value: 0
is_nullable: 0
=cut

__PACKAGE__->add_columns(
"node_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"category_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"sorting_pos",
{ data_type => "integer", default_value => 0, is_nullable => 0 },
);

=head1 PRIMARY KEY
Expand Down Expand Up @@ -106,8 +114,8 @@ __PACKAGE__->belongs_to(
);


# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-04-05 08:15:44
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RWGDLCdvwWeFJRelLu9tlg
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-02-04 10:21:08
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4g7nMXOV/cnqnKyUSd6fxQ


# You can replace this text with custom code or comments, and it will be preserved on regeneration
Expand Down
12 changes: 10 additions & 2 deletions lib/AmuseWikiFarm/Schema/Result/NodeTitle.pm
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,21 @@ __PACKAGE__->table("node_title");
is_foreign_key: 1
is_nullable: 0
=head2 sorting_pos
data_type: 'integer'
default_value: 0
is_nullable: 0
=cut

__PACKAGE__->add_columns(
"node_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"title_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"sorting_pos",
{ data_type => "integer", default_value => 0, is_nullable => 0 },
);

=head1 PRIMARY KEY
Expand Down Expand Up @@ -106,8 +114,8 @@ __PACKAGE__->belongs_to(
);


# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-04-05 08:15:44
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Pqdn0CX4NwTwuMYNzus2yg
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-02-04 10:21:08
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hKaGU7vcdU8K/SP8KX1Dug


# You can replace this text with custom code or comments, and it will be preserved on regeneration
Expand Down
12 changes: 2 additions & 10 deletions lib/AmuseWikiFarm/Schema/Result/Title.pm
Original file line number Diff line number Diff line change
Expand Up @@ -635,20 +635,12 @@ Composing rels: L</text_months> -> monthly_archive

__PACKAGE__->many_to_many("monthly_archives", "text_months", "monthly_archive");

=head2 nodes

Type: many_to_many
Composing rels: L</node_titles> -> node
=cut
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-02-04 10:21:08
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5n6Fealtc8VPxubYQ/2o9A

__PACKAGE__->many_to_many("nodes", "node_titles", "node");


# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-10-01 08:37:40
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:JTCv/5sd8mgcXY0VgPYPTg

=head2 translations
Resultset with the same Title class with the same C<uid> in the
Expand Down
4 changes: 4 additions & 0 deletions sql/sqlite.sql
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ CREATE TABLE node_title (
ON DELETE CASCADE ON UPDATE CASCADE,
title_id INTEGER NOT NULL REFERENCES title(id)
ON DELETE CASCADE ON UPDATE CASCADE,
sorting_pos INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY (node_id, title_id)
);

Expand All @@ -614,6 +615,7 @@ CREATE TABLE node_category (
ON DELETE CASCADE ON UPDATE CASCADE,
category_id INTEGER NOT NULL REFERENCES category(id)
ON DELETE CASCADE ON UPDATE CASCADE,
sorting_pos INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY (node_id, category_id)
);

Expand All @@ -622,6 +624,7 @@ CREATE TABLE node_aggregation (
ON DELETE CASCADE ON UPDATE CASCADE,
aggregation_id INTEGER NOT NULL REFERENCES aggregation(aggregation_id)
ON DELETE CASCADE ON UPDATE CASCADE,
sorting_pos INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY (node_id, aggregation_id)
);

Expand All @@ -630,6 +633,7 @@ CREATE TABLE node_aggregation_series (
ON DELETE CASCADE ON UPDATE CASCADE,
aggregation_series_id INTEGER NOT NULL REFERENCES aggregation_series(aggregation_series_id)
ON DELETE CASCADE ON UPDATE CASCADE,
sorting_pos INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY (node_id, aggregation_series_id)
);

Expand Down

0 comments on commit f568b85

Please sign in to comment.