Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not dump some relationships when using percona mysql #57

Open
exodist opened this issue May 16, 2024 · 1 comment
Open

Does not dump some relationships when using percona mysql #57

exodist opened this issue May 16, 2024 · 1 comment

Comments

@exodist
Copy link

exodist commented May 16, 2024

Relevent Schema:

CREATE TABLE runs (
    run_idx         BIGINT          NOT NULL AUTO_INCREMENT PRIMARY KEY,
    run_id          BINARY(16)      NOT NULL,
    [...]
    UNIQUE(run_id)
);

CREATE TABLE run_fields (
    run_field_idx   BIGINT          NOT NULL AUTO_INCREMENT PRIMARY KEY,
    run_id          BINARY(16)      NOT NULL,
    [...]
    FOREIGN KEY (run_id) REFERENCES runs(run_id) ON DELETE CASCADE
);

CREATE TABLE jobs (
    job_idx         BIGINT              NOT NULL AUTO_INCREMENT PRIMARY KEY,
    job_key         BINARY(16)          NOT NULL,
    [...]
    UNIQUE(job_key)
);

CREATE TABLE job_parameters (
    job_parameters_idx  BIGINT      NOT NULL AUTO_INCREMENT PRIMARY KEY,
    job_key             BINARY(16)  NOT NULL REFERENCES jobs(job_key) ON DELETE CASCADE,
    [...]
    UNIQUE(job_key)
);

When I load this into MariaDB and then dump the schema the xxx_parameter relationships dump fine, but when I load into Percona mysql they are omitted. Here are the diffs:

diff lib/App/Yath/Schema/MySQL/Run.pm lib/App/Yath/Schema/Percona/Run.pm                                                                                                                            
2c2
< package App::Yath::Schema::MySQL::Run;
---
> package App::Yath::Schema::Percona::Run;
54c54
<     default_value => "current_timestamp()",
---
>     default_value => \"current_timestamp",
131,136d130
< __PACKAGE__->might_have(
<   "run_parameter",
<   "App::Yath::Schema::Result::RunParameter",
<   { "foreign.run_id" => "self.run_id" },
<   { cascade_copy => 0, cascade_delete => 1 },
< );
151c145
< # Created by DBIx::Class::Schema::Loader v0.07052 @ 2024-05-15 16:47:33
---
> # Created by DBIx::Class::Schema::Loader v0.07052 @ 2024-05-15 16:47:39
166c160
< App::Yath::Schema::MySQL::Run - Autogenerated result class for Run in MySQL.
---
> App::Yath::Schema::Percona::Run - Autogenerated result class for Run in Percona.
diff lib/App/Yath/Schema/MySQL/Job.pm lib/App/Yath/Schema/Percona/Job.pm
2c2
< package App::Yath::Schema::MySQL::Job;
---
> package App::Yath::Schema::Percona::Job;
107,112d106
< __PACKAGE__->might_have(
<   "job_parameter",
<   "App::Yath::Schema::Result::JobParameter",
<   { "foreign.job_key" => "self.job_key" },
<   { cascade_copy => 0, cascade_delete => 1 },
< );
138c132
< # Created by DBIx::Class::Schema::Loader v0.07052 @ 2024-05-15 16:47:33
---
> # Created by DBIx::Class::Schema::Loader v0.07052 @ 2024-05-15 16:47:39
141d134
< __PACKAGE__->inflate_column('job_id' => { inflate => \&uuid_inflate, deflate => \&uuid_deflate });
142a136
> __PACKAGE__->inflate_column('job_id' => { inflate => \&uuid_inflate, deflate => \&uuid_deflate });
155c149
< App::Yath::Schema::MySQL::Job - Autogenerated result class for Job in MySQL.
---
> App::Yath::Schema::Percona::Job - Autogenerated result class for Job in Percona.
diff lib/App/Yath/Schema/MySQL/JobParameter.pm lib/App/Yath/Schema/Percona/JobParameter.pm
2c2
< package App::Yath::Schema::MySQL::JobParameter;
---
> package App::Yath::Schema::Percona::JobParameter;
27c27
<   { data_type => "binary", is_foreign_key => 1, is_nullable => 0, size => 16 },
---
>   { data_type => "binary", is_nullable => 0, size => 16 },
29c29
<   { data_type => "longtext", is_nullable => 1 },
---
>   { data_type => "json", is_nullable => 1 },
33,38d32
< __PACKAGE__->belongs_to(
<   "job",
<   "App::Yath::Schema::Result::Job",
<   { job_key => "job_key" },
<   { is_deferrable => 1, on_delete => "CASCADE", on_update => "RESTRICT" },
< );
41c35
< # Created by DBIx::Class::Schema::Loader v0.07052 @ 2024-05-15 16:47:33
---
> # Created by DBIx::Class::Schema::Loader v0.07052 @ 2024-05-15 16:47:39
56c50
< App::Yath::Schema::MySQL::JobParameter - Autogenerated result class for JobParameter in MySQL.
---
> App::Yath::Schema::Percona::JobParameter - Autogenerated result class for JobParameter in Percona.
diff lib/App/Yath/Schema/MySQL/RunParameter.pm lib/App/Yath/Schema/Percona/RunParameter.pm
2c2
< package App::Yath::Schema::MySQL::RunParameter;
---
> package App::Yath::Schema::Percona::RunParameter;
27c27
<   { data_type => "binary", is_foreign_key => 1, is_nullable => 0, size => 16 },
---
>   { data_type => "binary", is_nullable => 0, size => 16 },
29c29
<   { data_type => "longtext", is_nullable => 1 },
---
>   { data_type => "json", is_nullable => 1 },
33,38d32
< __PACKAGE__->belongs_to(
<   "run",
<   "App::Yath::Schema::Result::Run",
<   { run_id => "run_id" },
<   { is_deferrable => 1, on_delete => "CASCADE", on_update => "RESTRICT" },
< );
41c35
< # Created by DBIx::Class::Schema::Loader v0.07052 @ 2024-05-15 16:47:33
---
> # Created by DBIx::Class::Schema::Loader v0.07052 @ 2024-05-15 16:47:39
56c50
< App::Yath::Schema::MySQL::RunParameter - Autogenerated result class for RunParameter in MySQL.
---
> App::Yath::Schema::Percona::RunParameter - Autogenerated result class for RunParameter in Percona.

The only difference I am aware of is MariaDB vs Percona. I am happy to post the full schema and how I am generating things if that is necessary.

@exodist
Copy link
Author

exodist commented May 16, 2024

oh, also note binary(16) is used because percona does not yet support UUID fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant