arql 0.1.16 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81fc8de01356a51e51a685776132970d45d7990ca067f2991185478e7e24956f
4
- data.tar.gz: 462e71f0b050e49f9d0dea8e7cc1291c1974ea33829f2267a18ace2029613bda
3
+ metadata.gz: 811e8dae81062f4ea1204c7c4cebb854242814508548871ee71701e9edcdab75
4
+ data.tar.gz: ee843b527ff37e365be55e56f8efc7665a134540a5039c8f802ad4338377bbcf
5
5
  SHA512:
6
- metadata.gz: 810b515c930029a0f7f9b725ee0d49630b76b45f13e307c147792643266ae0f2521d2588ddb1a069a4841e93aa2b757c3fdc566686d9963c5f08dbbcb20a4d07
7
- data.tar.gz: b2b008f8054f9c46b1453aaa272204188f321a17a0c414192c40635ce1b7825b34c093753e3ed14aa8d98c25dc5669f0762a1f86732c914b0209033926bd26ef
6
+ metadata.gz: 9f7f59f9b49504d801d07080e0b0ee53132efd057560398e186a34d5a2e1c67c31975616aa070fed0b9401c90c3a37a60a7a4537bf3bd74cd4ff10f5b50c9cbb
7
+ data.tar.gz: 66ec1f0ba4a2c48ad3e89e145b063be6843edaf1c8e0bdd7412cacbd56d11f2bec4369b9d916dec8940211a1cdf74943e7ec0639484f89332f2b344bcada793d
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- arql (0.1.16)
4
+ arql (0.1.17)
5
5
  activerecord (~> 6.0.3)
6
6
  activerecord-oracle_enhanced-adapter
7
7
  activerecord-sqlserver-adapter
data/README.md CHANGED
@@ -282,6 +282,10 @@ ARQL ❯ Person.all.to_a.to_insert_sql
282
282
  => "INSERT INTO `person` (`id`,`name`,`age`,`gender`,`grade`,`blood_type`) VALUES (1, 'Jack', 30, NULL, NULL, NULL), (2, 'Jack', 11, 1, NULL, NULL), (3, 'Jack', 12, 1, NULL, NULL), (4, 'Jack', 30, 1, NULL, NULL), (5, 'Jack', 12, 2, NULL, NULL), (6, 'Jack', 2, 2, 2, NULL), (7, 'Jack', 3, 2, 2, NULL), (8, 'Jack', 30, 2, 2, 'AB'), (9, 'Jack', 30, 2, 2, 'AB'), (10, 'Jack', 30, 2, 2, 'AB'), (11, 'Jackson', 30, 2, 2, 'AB') ON DUPLICATE KEY UPDATE `id`=`id`;"
283
283
  ```
284
284
 
285
+ #### to_create_sql
286
+
287
+ You can call `to_create_sql` on any ActiveRecord model clas to get create table SQL of the model class / table.
288
+
285
289
  #### t
286
290
 
287
291
  You can call `t` method on any ActiveRecord model instance to print a pretty table of attributes names and values of the object.
@@ -50,6 +50,10 @@ module Arql
50
50
  ActiveRecord::InsertAll.new(self, group.map(&:attributes), on_duplicate: on_duplicate).send(:to_sql) + ';'
51
51
  end.join("\n")
52
52
  end
53
+
54
+ def to_create_sql
55
+ ActiveRecord::Base.connection.exec_query("show create table #{table_name}").rows.last.last
56
+ end
53
57
  end
54
58
  end
55
59
 
@@ -1,3 +1,3 @@
1
1
  module Arql
2
- VERSION = "0.1.16"
2
+ VERSION = "0.1.17"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liu Xiang