Error with the last commit
remydev opened this issue · 4 comments
Sorry since the last commit, I have a compilation error.
And I confirm that when updating shards(v9), I have a git error with a "shards update". Belongs to me, it's more a shards mistake. I think it's better to wait for now, from what I've seen, the problem seems to be ongoing in the shards depot.
# src/orm.cr
require "clear"
url = ENV["POSTGRES_URL"]? || "postgres://postgres@localhost/projetc"
Clear::SQL.init(url, connection_pool_size: 5)
require "./orm/*"
Error in src/main.cr:16: while requiring "./orm.cr"
require "./orm.cr"
^
in src/orm.cr:1: while requiring "clear"
require "clear"
^
in lib/clear/src/clear.cr:19: while requiring "./clear/core"
require "./clear/core"
^
in lib/clear/src/clear/core.cr:16: while requiring "./model/**"
require "./model/**"
^
in lib/clear/src/clear/model/model.cr:84: while requiring "./reflection/**"
require "./reflection/**"
^
in lib/clear/src/clear/model/reflection/column.cr:4: expanding macro
include Clear::Model
^
in macro 'included' expanded macro: included:1, line 22:
1. @@initialized = false
2.
3. # :nodoc:
4. macro __on_init__
5. class ::{{@type}}
6. def self.__main_init__
7. previous_def
8. {{yield}}
9. end
10.
11. end
12. end
13.
14. # :nodoc:
15. def self.__initialize_once__
16. unless @@initialized
17. __main_init__
18. @@initialized = true
19. end
20. end
21.
>�[1m 22. __initialize_once__
23.
instantiating '__initialize_once__()'
in lib/clear/src/clear/model/reflection/column.cr:4: expanding macro
include Clear::Model
^
in macro 'included' expanded macro: included:1, line 17:
1. @@initialized = false
2.
3. # :nodoc:
4. macro __on_init__
5. class ::{{@type}}
6. def self.__main_init__
7. previous_def
8. {{yield}}
9. end
10.
11. end
12. end
13.
14. # :nodoc:
15. def self.__initialize_once__
16. unless @@initialized
>�[1m 17. __main_init__
18. @@initialized = true
19. end
20. end
21.
22. __initialize_once__
23.
instantiating '__main_init__()'
in macro 'generate' /home/remy/dev_env/remyaltideal/altideal/lib/clear/src/clear/model/modules/relations/belongs_to_macro.cr:3, line 62:
1.
2.
3.
4.
5. column table_name : ::Union(String, ::Nil), primary: false, presence: true
6. getter _cached_table : Clear::Reflection::Table?
7.
8. # The method table is a `belongs_to` relation
9. # to Clear::Reflection::Table
10. def table : Clear::Reflection::Table | Nil
11. if cached = @cached_table
12. cached
13. else
14. cache = @cache
15.
16. if cache && cache.active? "table"
17.
18. @cached_table = cache.hit("table",
19. self.table_name_column.to_sql_value, Clear::Reflection::Table
20. ).first?
21.
22.
23. else
24.
25. @cached_table = Clear::Reflection::Table.query.where{ raw(Clear::Reflection::Table.pkey) == self.table_name }.first
26.
27. end
28. end
29. end # / *
30.
31.
32. def table! : Clear::Reflection::Table
33. table.not_nil!
34. end # / *!
35.
36.
37. def table=(x : Clear::Reflection::Table | Nil)
38. if x && x.persisted?
39. raise "#{x.pkey_column.name} must be defined when assigning a belongs_to relation." unless x.pkey_column.defined?
40. @table_name_column.value = x.pkey
41. end
42.
43. @cached_table = x
44. end
45.
46.
47. # :nodoc:
48. # save the belongs_to model first if needed
49. def _bt_save_table
50. c = @cached_table
51. return if c.nil?
52.
53. unless c.persisted?
54. if c.save
55. @table_name_column.value = c.pkey
56. else
57. add_error("table", c.print_errors)
58. end
59. end
60. end # / _bt_save_*
61.
>�[1m 62. __on_init__ do
63. Clear::Reflection::Column.before(:validate) do |mdl|
64. mdl.as(self)._bt_save_table
65. end
66. end
67.
68. class Collection
69. def with_table(fetch_columns = false, &block : Clear::Reflection::Table::Collection -> ) : self
70. before_query do
71. sub_query = self.dup.clear_select.select("#{Clear::Reflection::Column.table}.table_name")
72.
73. cached_qry = Clear::Reflection::Table.query.where{ raw(Clear::Reflection::Table.pkey).in?(sub_query) }
74.
75. block.call(cached_qry)
76.
77. @cache.active "table"
78.
79. cached_qry.each(fetch_columns: fetch_columns) do |mdl|
80. @cache.set("table", mdl.pkey, [mdl])
81. end
82. end
83.
84. self
85. end # / with_*
86.
87. def with_table(fetch_columns = false) : self
88. with_table(fetch_columns){}
89. self
90. end # / with_*
91.
92. end # / Collection
93.
94.
expanding macro
in macro '__on_init__' expanded macro: included:4, line 5:
1. class ::Clear::Reflection::Column
2. def self.__main_init__
3. previous_def
4. begin Clear::Reflection::Column.before(:validate) do |mdl|
>�[1m 5. (mdl.as(self))._bt_save_table
6. end end
7. end
8.
9. end
10.
instantiating 'Clear::Reflection::Column#_bt_save_table()'
in macro '__generate_relations__' /home/remy/dev_env/remyaltideal/altideal/lib/clear/src/clear/model/modules/has_relations.cr:160, line 4:
1.
2.
3.
>�[1m 4. Relations::BelongsToMacro.generate(Clear::Reflection::Column, table, Clear::Reflection::Table, true, table_name,
5. false, false, String?)
6.
7.
8.
9.
expanding macro
in macro 'generate' /home/remy/dev_env/remyaltideal/altideal/lib/clear/src/clear/model/modules/relations/belongs_to_macro.cr:3, line 54:
1.
2.
3.
4.
5. column table_name : ::Union(String, ::Nil), primary: false, presence: true
6. getter _cached_table : Clear::Reflection::Table?
7.
8. # The method table is a `belongs_to` relation
9. # to Clear::Reflection::Table
10. def table : Clear::Reflection::Table | Nil
11. if cached = @cached_table
12. cached
13. else
14. cache = @cache
15.
16. if cache && cache.active? "table"
17.
18. @cached_table = cache.hit("table",
19. self.table_name_column.to_sql_value, Clear::Reflection::Table
20. ).first?
21.
22.
23. else
24.
25. @cached_table = Clear::Reflection::Table.query.where{ raw(Clear::Reflection::Table.pkey) == self.table_name }.first
26.
27. end
28. end
29. end # / *
30.
31.
32. def table! : Clear::Reflection::Table
33. table.not_nil!
34. end # / *!
35.
36.
37. def table=(x : Clear::Reflection::Table | Nil)
38. if x && x.persisted?
39. raise "#{x.pkey_column.name} must be defined when assigning a belongs_to relation." unless x.pkey_column.defined?
40. @table_name_column.value = x.pkey
41. end
42.
43. @cached_table = x
44. end
45.
46.
47. # :nodoc:
48. # save the belongs_to model first if needed
49. def _bt_save_table
50. c = @cached_table
51. return if c.nil?
52.
53. unless c.persisted?
>�[1m 54. if c.save
55. @table_name_column.value = c.pkey
56. else
57. add_error("table", c.print_errors)
58. end
59. end
60. end # / _bt_save_*
61.
62. __on_init__ do
63. Clear::Reflection::Column.before(:validate) do |mdl|
64. mdl.as(self)._bt_save_table
65. end
66. end
67.
68. class Collection
69. def with_table(fetch_columns = false, &block : Clear::Reflection::Table::Collection -> ) : self
70. before_query do
71. sub_query = self.dup.clear_select.select("#{Clear::Reflection::Column.table}.table_name")
72.
73. cached_qry = Clear::Reflection::Table.query.where{ raw(Clear::Reflection::Table.pkey).in?(sub_query) }
74.
75. block.call(cached_qry)
76.
77. @cache.active "table"
78.
79. cached_qry.each(fetch_columns: fetch_columns) do |mdl|
80. @cache.set("table", mdl.pkey, [mdl])
81. end
82. end
83.
84. self
85. end # / with_*
86.
87. def with_table(fetch_columns = false) : self
88. with_table(fetch_columns){}
89. self
90. end # / with_*
91.
92. end # / Collection
93.
94.
instantiating 'Clear::Reflection::Table#save()'
in lib/clear/src/clear/model/modules/has_saving.cr:97: instantiating 'with_triggers(Symbol)'
with_triggers(:save) do
^~~~~~~~~~~~~
in lib/clear/src/clear/model/modules/has_hooks.cr:16: instantiating 'Clear::SQL:Module#transaction()'
Clear::SQL.transaction do
^~~~~~~~~~~
in lib/clear/src/clear/sql/sql.cr:118: instantiating 'Clear::SQL::ConnectionPool.class#with_connection(String)'
Clear::SQL::ConnectionPool.with_connection(connection) do |cnx|
^~~~~~~~~~~~~~~
in lib/clear/src/clear/sql/sql.cr:118: instantiating 'Clear::SQL::ConnectionPool.class#with_connection(String)'
Clear::SQL::ConnectionPool.with_connection(connection) do |cnx|
^~~~~~~~~~~~~~~
in lib/clear/src/clear/model/modules/has_hooks.cr:16: instantiating 'Clear::SQL:Module#transaction()'
Clear::SQL.transaction do
^~~~~~~~~~~
in lib/clear/src/clear/model/modules/has_saving.cr:97: instantiating 'with_triggers(Symbol)'
with_triggers(:save) do
^~~~~~~~~~~~~
in lib/clear/src/clear/model/modules/has_saving.cr:109: instantiating 'with_triggers(Symbol)'
with_triggers(:create) do
^~~~~~~~~~~~~
in lib/clear/src/clear/model/modules/has_hooks.cr:16: instantiating 'Clear::SQL:Module#transaction()'
Clear::SQL.transaction do
^~~~~~~~~~~
in lib/clear/src/clear/sql/sql.cr:118: instantiating 'Clear::SQL::ConnectionPool.class#with_connection(String)'
Clear::SQL::ConnectionPool.with_connection(connection) do |cnx|
^~~~~~~~~~~~~~~
in lib/clear/src/clear/sql/sql.cr:118: instantiating 'Clear::SQL::ConnectionPool.class#with_connection(String)'
Clear::SQL::ConnectionPool.with_connection(connection) do |cnx|
^~~~~~~~~~~~~~~
in lib/clear/src/clear/model/modules/has_hooks.cr:16: instantiating 'Clear::SQL:Module#transaction()'
Clear::SQL.transaction do
^~~~~~~~~~~
in lib/clear/src/clear/model/modules/has_saving.cr:109: instantiating 'with_triggers(Symbol)'
with_triggers(:create) do
^~~~~~~~~~~~~
in lib/clear/src/clear/model/modules/has_saving.cr:112: instantiating 'Clear::SQL::InsertQuery#execute(String)'
hash = query.execute(@@connection)
^~~~~~~
in lib/clear/src/clear/sql/insert_query.cr:82: instantiating 'fetch(String)'
fetch(connection_name) { |x| o = x }
^~~~~
in lib/clear/src/clear/sql/insert_query.cr:44: instantiating 'Clear::SQL:Module#log_query(String)'
Clear::SQL.log_query to_sql do
^~~~~~~~~
in lib/clear/src/clear/sql/insert_query.cr:44: instantiating 'Clear::SQL:Module#log_query(String)'
Clear::SQL.log_query to_sql do
^~~~~~~~~
in lib/clear/src/clear/sql/insert_query.cr:47: instantiating 'Clear::SQL::ConnectionPool.class#with_connection(String)'
Clear::SQL::ConnectionPool.with_connection(connection_name) do |cnx|
^~~~~~~~~~~~~~~
in lib/clear/src/clear/sql/insert_query.cr:47: instantiating 'Clear::SQL::ConnectionPool.class#with_connection(String)'
Clear::SQL::ConnectionPool.with_connection(connection_name) do |cnx|
^~~~~~~~~~~~~~~
in lib/clear/src/clear/sql/insert_query.cr:48: instantiating 'DB::Database#query(String)'
cnx.query(to_sql) do |rs|
^~~~~
in lib/clear/src/clear/sql/insert_query.cr:48: instantiating 'DB::Database#query(String)'
cnx.query(to_sql) do |rs|
^~~~~
in lib/clear/src/clear/sql/insert_query.cr:49: instantiating 'fetch_result_set(Hash(String, Array(JSON::Any) | Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::StringArray) | Bool | Char | Clear::Expression::UnsafeSql | Float32 | Float64 | Hash(String, JSON::Any) | Int16 | Int32 | Int64 | Int8 | JSON::Any | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | Nil), PG::ResultSet)'
fetch_result_set(h, rs) { |x| yield(x) }
^~~~~~~~~~~~~~~~
in lib/clear/src/clear/sql/insert_query.cr:59: instantiating 'loop()'
loop do
^~~~
in lib/clear/src/clear/sql/insert_query.cr:59: instantiating 'loop()'
loop do
^~~~
in lib/clear/src/clear/sql/insert_query.cr:60: instantiating 'PG::ResultSet#each_column()'
rs.each_column do |col|
^~~~~~~~~~~
in lib/clear/src/clear/sql/insert_query.cr:60: instantiating 'PG::ResultSet#each_column()'
rs.each_column do |col|
^~~~~~~~~~~
in lib/clear/src/clear/sql/insert_query.cr:61: �[1mno overload matches 'Hash(String, Array(JSON::Any) | Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::StringArray) | Bool | Char | Clear::Expression::UnsafeSql | Float32 | Float64 | Hash(String, JSON::Any) | Int16 | Int32 | Int64 | Int8 | JSON::Any | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | Nil)#[]=' with types String, (Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Bool | Char | Float32 | Float64 | Int16 | Int32 | Int64 | JSON::Any | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Numeric | Slice(UInt8) | String | Time | UInt32 | Nil)
Overloads are:
- Hash(K, V)#[]=(key : K, value : V)
Couldn't find overloads for these types:
- Hash(String, Array(JSON::Any) | Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::StringArray) | Bool | Char | Clear::Expression::UnsafeSql | Float32 | Float64 | Hash(String, JSON::Any) | Int16 | Int32 | Int64 | Int8 | JSON::Any | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | Nil)#[]=(key : String, value : Array(PG::NumericArray))
- Hash(String, Array(JSON::Any) | Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::StringArray) | Bool | Char | Clear::Expression::UnsafeSql | Float32 | Float64 | Hash(String, JSON::Any) | Int16 | Int32 | Int64 | Int8 | JSON::Any | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | Nil)#[]=(key : String, value : Array(PG::TimeArray))
h[col] = rs.read
^
That's a problem with the shards
program which update the dependencies but not the shard itself.
Try to do this in your project:
$ rm -r lib/clear
$ rm lib/clear.sha1
$ shards update
Then you should be able to build your project again.
Tell me if it works for you 😄
Sorry, but the following simple code crashes, on two different environments.
https://github.com/remydev/clear_test/
I have the same mistake as mentioned with a shards build
Hello,
Just add branch: master
in your shard.yml:
clear:
github: anykeyh/clear
branch: master
Ok, works!
But this is the first time I've forced a master branch.
And it doesn't work with shards v0.9
Thanks