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

Mysql 8 no display attribute on fields #162

Open
montdidier opened this issue Jun 21, 2021 · 1 comment
Open

Mysql 8 no display attribute on fields #162

montdidier opened this issue Jun 21, 2021 · 1 comment

Comments

@montdidier
Copy link

montdidier commented Jun 21, 2021

Just thought I should feed back this to the original project.

For Mysql 8, display attributes on fields is deprecated, it can be fixed easily enough. I would setup a PR myself but already have one to the Shopify fork of LHM which we have switched to.

See here https://dev.mysql.com/worklog/task/?id=13127

PR to Shopify fork.

Shopify#101

diff --git a/lib/lhm/table.rb b/lib/lhm/table.rb
index c913169..a2663bd 100644
--- a/lib/lhm/table.rb
+++ b/lib/lhm/table.rb
@@ -18,7 +18,7 @@ def initialize(name, pk = 'id', ddl = nil)
 
     def satisfies_id_column_requirement?
       !!((id = columns['id']) &&
-        id[:type] =~ /(bigint|int)\(\d+\)/)
+        id[:type] =~ /(bigint|int)(\(\d+\))?/)
     end
 
     def destination_name
diff --git a/spec/unit/table_spec.rb b/spec/unit/table_spec.rb
index c75181f..d5ad1f9 100644
--- a/spec/unit/table_spec.rb
+++ b/spec/unit/table_spec.rb
@@ -32,6 +32,12 @@ def set_columns(table, columns)
       @table.satisfies_id_column_requirement?.must_equal true
     end
 
+    it 'should be satisifed if display attributes are not present (deprecated in mysql 8)' do
+      @table = Lhm::Table.new('table', 'id')
+      set_columns(@table, { 'id' => { :type => 'int' } })
+      @table.satisfies_id_column_requirement?.must_equal true
+    end
+
     it 'should not be satisfied if id is not numeric' do
       @table = Lhm::Table.new('table', 'id')
       set_columns(@table, { 'id' => { :type => 'varchar(255)' } })
@montdidier
Copy link
Author

The real question is if this particular repository is even supported anymore.

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

No branches or pull requests

1 participant