Skip to content

Commit

Permalink
Fix up examples for rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremycole committed Jun 6, 2020
1 parent a75d471 commit c322440
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 48 deletions.
5 changes: 5 additions & 0 deletions examples/describer/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
inherit_from:
- ../../.rubocop.yml
Naming/ClassAndModuleCamelCase:
Enabled: false

82 changes: 42 additions & 40 deletions examples/describer/employees_db.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
require "innodb/record_describer"
# frozen_string_literal: true

require 'innodb/record_describer'

# CREATE TABLE employees (
# emp_no INT NOT NULL,
Expand All @@ -12,12 +14,12 @@

class Employees_employees_PRIMARY < Innodb::RecordDescriber
type :clustered
key "emp_no", :INT, :NOT_NULL
row "birth_date", :MEDIUMINT, :NOT_NULL
row "first_name", "VARCHAR(14)", :NOT_NULL
row "last_name", "VARCHAR(16)", :NOT_NULL
row "gender", :TINYINT, :UNSIGNED, :NOT_NULL
row "hire_date", :MEDIUMINT, :NOT_NULL
key 'emp_no', :INT, :NOT_NULL
row 'birth_date', :MEDIUMINT, :NOT_NULL
row 'first_name', 'VARCHAR(14)', :NOT_NULL
row 'last_name', 'VARCHAR(16)', :NOT_NULL
row 'gender', :TINYINT, :UNSIGNED, :NOT_NULL
row 'hire_date', :MEDIUMINT, :NOT_NULL
end

# CREATE TABLE departments (
Expand All @@ -29,14 +31,14 @@ class Employees_employees_PRIMARY < Innodb::RecordDescriber

class Employees_departments_PRIMARY < Innodb::RecordDescriber
type :clustered
key "dept_no", "CHAR(4)", :NOT_NULL
row "dept_name", "VARCHAR(40)", :NOT_NULL
key 'dept_no', 'CHAR(4)', :NOT_NULL
row 'dept_name', 'VARCHAR(40)', :NOT_NULL
end

class Employees_departments_dept_name < Innodb::RecordDescriber
type :secondary
key "dept_name", "VARCHAR(40)", :NOT_NULL
row "dept_no", "CHAR(4)", :NOT_NULL
key 'dept_name', 'VARCHAR(40)', :NOT_NULL
row 'dept_no', 'CHAR(4)', :NOT_NULL
end

# CREATE TABLE dept_manager (
Expand All @@ -53,22 +55,22 @@ class Employees_departments_dept_name < Innodb::RecordDescriber

class Employees_dept_manager_PRIMARY < Innodb::RecordDescriber
type :clustered
key "emp_no", :INT, :NOT_NULL
key "dept_no", "CHAR(4)", :NOT_NULL
row "from_date", :MEDIUMINT, :NOT_NULL
row "to_date", :MEDIUMINT, :NOT_NULL
key 'emp_no', :INT, :NOT_NULL
key 'dept_no', 'CHAR(4)', :NOT_NULL
row 'from_date', :MEDIUMINT, :NOT_NULL
row 'to_date', :MEDIUMINT, :NOT_NULL
end

class Employees_dept_manager_emp_no < Innodb::RecordDescriber
type :secondary
key "emp_no", :INT, :NOT_NULL
row "dept_no", "CHAR(4)", :NOT_NULL
key 'emp_no', :INT, :NOT_NULL
row 'dept_no', 'CHAR(4)', :NOT_NULL
end

class Employees_dept_manager_dept_no < Innodb::RecordDescriber
type :secondary
key "dept_no", "CHAR(4)", :NOT_NULL
row "emp_no", :INT, :NOT_NULL
key 'dept_no', 'CHAR(4)', :NOT_NULL
row 'emp_no', :INT, :NOT_NULL
end

# CREATE TABLE dept_emp (
Expand All @@ -85,22 +87,22 @@ class Employees_dept_manager_dept_no < Innodb::RecordDescriber

class Employees_dept_emp_PRIMARY < Innodb::RecordDescriber
type :clustered
key "emp_no", :INT, :NOT_NULL
key "dept_no", "CHAR(4)", :NOT_NULL
row "from_date", :MEDIUMINT, :NOT_NULL
row "to_date", :MEDIUMINT, :NOT_NULL
key 'emp_no', :INT, :NOT_NULL
key 'dept_no', 'CHAR(4)', :NOT_NULL
row 'from_date', :MEDIUMINT, :NOT_NULL
row 'to_date', :MEDIUMINT, :NOT_NULL
end

class Employees_dept_emp_emp_no < Innodb::RecordDescriber
type :secondary
key "emp_no", :INT, :NOT_NULL
row "dept_no", "CHAR(4)", :NOT_NULL
key 'emp_no', :INT, :NOT_NULL
row 'dept_no', 'CHAR(4)', :NOT_NULL
end

class Employees_dept_emp_dept_no < Innodb::RecordDescriber
type :secondary
key "dept_no", "CHAR(4)", :NOT_NULL
row "emp_no", :INT, :NOT_NULL
key 'dept_no', 'CHAR(4)', :NOT_NULL
row 'emp_no', :INT, :NOT_NULL
end

# CREATE TABLE titles (
Expand All @@ -115,17 +117,17 @@ class Employees_dept_emp_dept_no < Innodb::RecordDescriber

class Employees_titles_PRIMARY < Innodb::RecordDescriber
type :clustered
key "emp_no", :INT, :NOT_NULL
key "title", "VARCHAR(50)", :NOT_NULL
key "from_date", :MEDIUMINT, :NOT_NULL
row "to_date", :MEDIUMINT, :NOT_NULL
key 'emp_no', :INT, :NOT_NULL
key 'title', 'VARCHAR(50)', :NOT_NULL
key 'from_date', :MEDIUMINT, :NOT_NULL
row 'to_date', :MEDIUMINT, :NOT_NULL
end

class Employees_titles_emp_no < Innodb::RecordDescriber
type :secondary
key "emp_no", :INT, :NOT_NULL
row "title", "VARCHAR(50)", :NOT_NULL
row "from_date", :MEDIUMINT, :NOT_NULL
key 'emp_no', :INT, :NOT_NULL
row 'title', 'VARCHAR(50)', :NOT_NULL
row 'from_date', :MEDIUMINT, :NOT_NULL
end

# CREATE TABLE salaries (
Expand All @@ -140,14 +142,14 @@ class Employees_titles_emp_no < Innodb::RecordDescriber

class Employees_salaries_PRIMARY < Innodb::RecordDescriber
type :clustered
key "emp_no", :INT, :NOT_NULL
key "from_date", :MEDIUMINT, :NOT_NULL
row "salary", :INT, :NOT_NULL
row "to_date", :MEDIUMINT, :NOT_NULL
key 'emp_no', :INT, :NOT_NULL
key 'from_date', :MEDIUMINT, :NOT_NULL
row 'salary', :INT, :NOT_NULL
row 'to_date', :MEDIUMINT, :NOT_NULL
end

class Employees_salaries_emp_no < Innodb::RecordDescriber
type :secondary
key "emp_no", :INT, :NOT_NULL
row "from_date", :MEDIUMINT, :NOT_NULL
key 'emp_no', :INT, :NOT_NULL
row 'from_date', :MEDIUMINT, :NOT_NULL
end
14 changes: 8 additions & 6 deletions examples/describer/hello_world.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
require "innodb/record_describer"
# frozen_string_literal: true

require 'innodb/record_describer'

# CREATE TABLE hello_world (
# id INT NOT NULL,
Expand All @@ -13,13 +15,13 @@

class HelloWorld_PRIMARY < Innodb::RecordDescriber
type :clustered
key "id", :INT, :NOT_NULL
row "message", "VARCHAR(100)", :NOT_NULL
row "author", "VARCHAR(100)", :NOT_NULL
key 'id', :INT, :NOT_NULL
row 'message', 'VARCHAR(100)', :NOT_NULL
row 'author', 'VARCHAR(100)', :NOT_NULL
end

class HelloWorld_message < Innodb::RecordDescriber
type :secondary
key "message", "VARCHAR(100)", :NOT_NULL
row "id", :INT, :NOT_NULL
key 'message', 'VARCHAR(100)', :NOT_NULL
row 'id', :INT, :NOT_NULL
end
4 changes: 2 additions & 2 deletions examples/describer/simple_describer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

class SimpleDescriber < Innodb::RecordDescriber
type :clustered
key "i", :INT, :NOT_NULL
row "s", "VARCHAR(100)", :NOT_NULL
key 'i', :INT, :NOT_NULL
row 's', 'VARCHAR(100)', :NOT_NULL
end

0 comments on commit c322440

Please sign in to comment.