meta-record 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/metarecord/generator_base.rb +1 -1
- data/lib/metarecord/generators/crails/destroy_generator.rb +1 -1
- data/lib/metarecord/generators/crails/edit_generator.rb +1 -1
- data/lib/metarecord/generators/crails/helpers/validations.rb +1 -1
- data/lib/metarecord/generators/rails/migrations/type_helpers.rb +17 -17
- data/lib/metarecord/manifest_generator.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 786c4b11d58a3d7f2deb98548948c2cd0d633e7b9668009238618f64676253b7
|
4
|
+
data.tar.gz: 58a44c730e52b5a8ab8b6e7b27ccbecb5d281c212d9adfdfcd4ab3c897712648
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fe116030201ba224440f225d60ffebf3c7b948433345dc67745d0d4879a55859d8e4fe4cbde9a6ea1a02e92415356f5218f6d08bdc1a7ba5d2ba3d67d6f6d5e
|
7
|
+
data.tar.gz: f3eb527ebc8ba619f8e0bdf66237419496b0972c5fa028f9d78800d1635d888c4c56ab0bd64c9025917517484686a076ba841eb34e44c16e79cabfde165a7250
|
@@ -150,7 +150,7 @@ class CrailsDestroyGenerator < GeneratorBase
|
|
150
150
|
_append "odb::result<#{relation[:class]}> models;"
|
151
151
|
_append "Query query;\n"
|
152
152
|
id_field = "#{get_singular_name relation[:field]}_ids"
|
153
|
-
_append "query = Query::#{id_field} + \"@>\" +
|
153
|
+
_append "query = Query::#{id_field} + \"@>\" + Crails::Odb::array_to_string(ids, \"int\");"
|
154
154
|
_append "database.find<#{relation[:class]}>(models, query);"
|
155
155
|
_append "for (auto model : odb::to_vector<#{relation[:class]}>(models))"
|
156
156
|
_append "{"
|
@@ -330,7 +330,7 @@ class CrailsEditGenerator < GeneratorBase
|
|
330
330
|
_append "odb::result<#{type}> results;"
|
331
331
|
_append "#{name}.clear();"
|
332
332
|
_append "database.find<#{type}>(results,"
|
333
|
-
_append " query::id + \"=\" +
|
333
|
+
_append " query::id + \"=\" + Crails::Odb::any(#{singular_name}_ids, \"int\")"
|
334
334
|
_append ");"
|
335
335
|
_append "for (auto model : results)"
|
336
336
|
_append " #{name}.push_back(std::make_shared<#{type}>(model));"
|
@@ -1,23 +1,23 @@
|
|
1
1
|
module RailsTypeHelpers
|
2
2
|
def get_record_type type
|
3
3
|
case type
|
4
|
-
when "
|
5
|
-
when "char"
|
6
|
-
when "unsigned char"
|
7
|
-
when "short"
|
8
|
-
when "unsigned short"
|
9
|
-
when "int"
|
10
|
-
when "unsigned int"
|
11
|
-
when "long"
|
12
|
-
when "long long"
|
13
|
-
when "unsigned long"
|
14
|
-
when "unsigned long long"
|
15
|
-
when "double"
|
16
|
-
when "long double"
|
17
|
-
when "float"
|
18
|
-
when "bool"
|
19
|
-
when "std::string"
|
20
|
-
when "std::time_t"
|
4
|
+
when "Crails::Odb::id_type" then :bigint
|
5
|
+
when "char" then :tinyint
|
6
|
+
when "unsigned char" then :smallint
|
7
|
+
when "short" then :smallint
|
8
|
+
when "unsigned short" then :mediumint
|
9
|
+
when "int" then :integer
|
10
|
+
when "unsigned int" then :integer
|
11
|
+
when "long" then :bigint
|
12
|
+
when "long long" then :bigint
|
13
|
+
when "unsigned long" then :bigint
|
14
|
+
when "unsigned long long" then :bigint
|
15
|
+
when "double" then :float
|
16
|
+
when "long double" then :float
|
17
|
+
when "float" then :float
|
18
|
+
when "bool" then :boolean
|
19
|
+
when "std::string" then :string
|
20
|
+
when "std::time_t" then :timestamp
|
21
21
|
else nil
|
22
22
|
end
|
23
23
|
end
|
@@ -28,7 +28,7 @@ class ManifestGenerator < GeneratorBase
|
|
28
28
|
db_options = options[:db] || Hash.new
|
29
29
|
column_name = db_options[:column] || "#{name}_id"
|
30
30
|
db_options.delete :column
|
31
|
-
@current_manifest_item[column_name] = { type: "
|
31
|
+
@current_manifest_item[column_name] = { type: "Crails::Odb::id_type", options: db_options }
|
32
32
|
end
|
33
33
|
|
34
34
|
def has_many type, name, options = {}
|