groonga-client-model 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8bb098148454489683ac35966f22fc18a32b8a3c
4
- data.tar.gz: 9ab10bad50574e82563929857c3a5d4a3b209767
3
+ metadata.gz: 53294810644c656d0b3131a95e1bee1816fe054b
4
+ data.tar.gz: 7aeda35aaf8a4c9db7ca66325a002839acee273f
5
5
  SHA512:
6
- metadata.gz: d5b863f329f13dc589514544397da3a4e10d9ff830fcb2a69bd6a686574fce6589642c2b132f436e95fbf70f84f1f24e65118bd03f2571a9a7a59ef1a232dd3b
7
- data.tar.gz: 6840fa4300924d4e9566cb8f3958e68590ca9f2eb187bb3174e2a5977c6325cf771b6ec414a24fa82e834bcdce50c1697a05c5a1e450a464c94826aafc6db030
6
+ metadata.gz: 54110c1264f47c3e44323d55da1e555de2c5f1f531465b4c50606cb88c59035dca85fbbff38f85ec683d06d5095bcaf213a1cda587c32191ac05a45b6417e9b4
7
+ data.tar.gz: 89a7c173a7bd08a4f564a5754da17602275a483708372639dccef30fef2ddb35521bdb6b72d754554bd8c492fb98329b930ac6807212a5e2b32c3d3ceeac47c5
@@ -1,5 +1,23 @@
1
1
  # NEWS
2
2
 
3
+ ## 1.0.2 - 2018-02-13
4
+
5
+ ### Improvements
6
+
7
+ * migration: Added `#rename_column` support.
8
+ [GitHub#8][Patch by Horimoto Yasuhiro]
9
+
10
+ ### Fixes
11
+
12
+ * Fixed a bug that `groonga:schema:load` doesn't load
13
+ `db/schema.grn`. [GitHub#1][Reported by okkez]
14
+
15
+ ### Thanks
16
+
17
+ * okkez
18
+
19
+ * Horimoto Yasuhiro
20
+
3
21
  ## 1.0.1 - 2016-03-09
4
22
 
5
23
  ### Improvements
@@ -179,6 +179,22 @@ module GroongaClientModel
179
179
  end
180
180
  end
181
181
 
182
+ def rename_column(table_name,
183
+ old_column_name, new_column_name)
184
+ if @reverting
185
+ @pending_actions << [:rename_column, table_name, new_column_name, old_column_name]
186
+ return
187
+ end
188
+
189
+ report(__method__, [table_name, old_column_name, new_column_name]) do
190
+ @client.request(:column_rename).
191
+ parameter(:table, table_name).
192
+ parameter(:name, old_column_name).
193
+ parameter(:new_name, new_column_name).
194
+ response
195
+ end
196
+ end
197
+
182
198
  def remove_column(table_name, column_name)
183
199
  if @reverting
184
200
  message = "can't revert remove_column(#{table_name}, #{column_name})"
@@ -343,9 +359,8 @@ module GroongaClientModel
343
359
  when "index", /\A(?:COLUMN_)?INDEX\z/i
344
360
  "COLUMN_INDEX"
345
361
  else
346
- message = "table type must be one of "
347
- message << "[:array, :hash_table, :patricia_trie, :double_array_trie]: "
348
- message << "#{type.inspect}"
362
+ message = "column type must be one of "
363
+ message << "[:scalar, :vector, :index]: #{type.inspect}"
349
364
  raise ArgumentError, message
350
365
  end
351
366
  end
@@ -28,9 +28,14 @@ namespace :groonga do
28
28
  end
29
29
 
30
30
  namespace :schema do
31
- desc "Loads db/schema.grn into the Groonga database"
31
+ schema_path = GroongaClientModel::SchemaLoader.default_path
32
+ desc "Loads #{schema_path} into the Groonga database"
32
33
  task load: ["config:load"] do
33
- schema_loader = GroongaClientModel::SchemaLoader.new(Rails.root)
34
+ full_schema_path = Rails.root + schema_path
35
+ unless full_schema_path.exist?
36
+ raise "Schema file doesn't exist: #{full_schema_path}"
37
+ end
38
+ schema_loader = GroongaClientModel::SchemaLoader.new(full_schema_path)
34
39
  schema_loader.load
35
40
  end
36
41
  end
@@ -18,6 +18,12 @@ require "groonga/command/parser"
18
18
 
19
19
  module GroongaClientModel
20
20
  class SchemaLoader
21
+ class << self
22
+ def default_path
23
+ "db/schema.grn"
24
+ end
25
+ end
26
+
21
27
  def initialize(schema)
22
28
  @schema = schema
23
29
  end
@@ -41,8 +41,8 @@ module GroongaClientModel
41
41
  base_dir = Pathname.pwd
42
42
  end
43
43
 
44
- schema_path = base_dir + "db" + "schema.grn"
45
- migrate_path = base_dir + "db" + "groonga" + "migrate"
44
+ schema_path = base_dir + SchemaLoader.default_path
45
+ migrate_path = base_dir + Migrator.default_search_path
46
46
  if schema_path.exist?
47
47
  schema_path.open do |schema_file|
48
48
  schema_loader = SchemaLoader.new(schema_file)
@@ -15,5 +15,5 @@
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
  module GroongaClientModel
18
- VERSION = "1.0.1"
18
+ VERSION = "1.0.2"
19
19
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../../../groonga-client
3
3
  specs:
4
- groonga-client (0.4.2)
4
+ groonga-client (0.4.3)
5
5
  gqtp (>= 1.0.4)
6
6
  groonga-command (>= 1.2.8)
7
7
  groonga-command-parser (>= 1.0.7)
@@ -10,7 +10,7 @@ PATH
10
10
  PATH
11
11
  remote: ../../../
12
12
  specs:
13
- groonga-client-model (1.0.1)
13
+ groonga-client-model (1.0.2)
14
14
  activemodel
15
15
  groonga-client (>= 0.4.2)
16
16
  groonga-command-parser
@@ -82,7 +82,7 @@ GEM
82
82
  groonga-command-parser (1.0.9)
83
83
  groonga-command (>= 1.3.2)
84
84
  json-stream
85
- hashie (3.5.1)
85
+ hashie (3.5.5)
86
86
  i18n (0.8.0)
87
87
  jbuilder (2.6.1)
88
88
  activesupport (>= 3.0.0, < 5.1)
@@ -1790,3 +1790,222 @@ PostTest: test_.create([Hash])
1790
1790
  select (45.8ms) select --filter "_id == 1" --limit "1" --match_columns "body" --table "posts"
1791
1791
  select (1.1ms) select --filter "_id == 2" --limit "1" --match_columns "body" --table "posts"
1792
1792
  shutdown (0.7ms) shutdown
1793
+ ---------------------------------------
1794
+ MigrationGeneratorTest: test_add_column
1795
+ ---------------------------------------
1796
+ ------------------------------------------
1797
+ MigrationGeneratorTest: test_remove_column
1798
+ ------------------------------------------
1799
+ ---------------------------------------
1800
+ MigrationGeneratorTest: test_set_config
1801
+ ---------------------------------------
1802
+ ------------------------------------------
1803
+ MigrationGeneratorTest: test_delete_config
1804
+ ------------------------------------------
1805
+ ----------------------------------------------
1806
+ MigrationGeneratorTest: test_set_config:_value
1807
+ ----------------------------------------------
1808
+ -----------------------------------------
1809
+ MigrationGeneratorTest: test_create_table
1810
+ -----------------------------------------
1811
+ -----------------------------------------------
1812
+ MigrationGeneratorTest: test_create_table:__key
1813
+ -----------------------------------------------
1814
+ ---------------------------------------------
1815
+ PostsControllerTest: test_should_destroy_post
1816
+ ---------------------------------------------
1817
+ object_exist (1.6ms) object_exist --name "schema_versions"
1818
+ table_create (1.2ms) table_create --flags "TABLE_PAT_KEY" --key_type "UInt64" --name "schema_versions"
1819
+ table_create (1.2ms) table_create --flags "TABLE_NO_KEY" --name "posts"
1820
+ column_create (1.7ms) column_create --flags "COLUMN_SCALAR" --name "title" --table "posts" --type "ShortText"
1821
+ column_create (1.6ms) column_create --flags "COLUMN_SCALAR" --name "body" --table "posts" --type "Text"
1822
+ load (1.5ms) load --table "schema_versions" --values "[{\"_key\":20170303120517}]"
1823
+ table_create (1.7ms) table_create --default_tokenizer "TokenBigram" --flags "TABLE_PAT_KEY" --key_type "ShortText" --name "terms" --normalizer "NormalizerAuto"
1824
+ schema (2.7ms) schema
1825
+ column_create (2.0ms) column_create --flags "COLUMN_INDEX|WITH_POSITION" --name "posts_body" --source "body" --table "terms" --type "posts"
1826
+ load (1.4ms) load --table "schema_versions" --values "[{\"_key\":20170303120527}]"
1827
+ table_create (1.5ms) table_create --flags "TABLE_HASH_KEY" --key_type "UInt32" --name "ages"
1828
+ load (1.4ms) load --table "schema_versions" --values "[{\"_key\":20170303120536}]"
1829
+ schema (2.8ms) schema
1830
+ load (2.2ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello\",\"body\":\"World\"}\n]"
1831
+ select (1.6ms) select --limit "0" --match_columns "body" --output_columns "_id" --table "posts"
1832
+ Processing by PostsController#destroy as HTML
1833
+ Parameters: {"id"=>"1"}
1834
+ select (50.8ms) select --filter "_id == \"1\"" --limit "1" --match_columns "body" --table "posts"
1835
+ delete (1.0ms) delete --filter "_id == 1" --table "posts"
1836
+ Redirected to http://test.host/posts
1837
+ Completed 302 Found in 54ms (Groonga: 51.7ms)
1838
+ select (0.8ms) select --limit "0" --match_columns "body" --output_columns "_id" --table "posts"
1839
+ shutdown (0.7ms) shutdown
1840
+ ----------------------------------------
1841
+ PostsControllerTest: test_should_get_new
1842
+ ----------------------------------------
1843
+ object_exist (2.4ms) object_exist --name "schema_versions"
1844
+ table_create (2.3ms) table_create --flags "TABLE_PAT_KEY" --key_type "UInt64" --name "schema_versions"
1845
+ table_create (2.1ms) table_create --flags "TABLE_NO_KEY" --name "posts"
1846
+ column_create (2.3ms) column_create --flags "COLUMN_SCALAR" --name "title" --table "posts" --type "ShortText"
1847
+ column_create (2.2ms) column_create --flags "COLUMN_SCALAR" --name "body" --table "posts" --type "Text"
1848
+ load (2.3ms) load --table "schema_versions" --values "[{\"_key\":20170303120517}]"
1849
+ table_create (2.4ms) table_create --default_tokenizer "TokenBigram" --flags "TABLE_PAT_KEY" --key_type "ShortText" --name "terms" --normalizer "NormalizerAuto"
1850
+ schema (4.6ms) schema
1851
+ column_create (3.3ms) column_create --flags "COLUMN_INDEX|WITH_POSITION" --name "posts_body" --source "body" --table "terms" --type "posts"
1852
+ load (2.3ms) load --table "schema_versions" --values "[{\"_key\":20170303120527}]"
1853
+ table_create (2.3ms) table_create --flags "TABLE_HASH_KEY" --key_type "UInt32" --name "ages"
1854
+ load (2.3ms) load --table "schema_versions" --values "[{\"_key\":20170303120536}]"
1855
+ load (3.7ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello\",\"body\":\"World\"}\n]"
1856
+ Processing by PostsController#new as HTML
1857
+ Rendered posts/_form.html.erb (21.4ms)
1858
+ Rendered posts/new.html.erb within layouts/application (25.8ms)
1859
+ Completed 200 OK in 243ms (Views: 242.7ms | Groonga: 0.0ms)
1860
+ shutdown (1.1ms) shutdown
1861
+ -----------------------------------------
1862
+ PostsControllerTest: test_should_get_edit
1863
+ -----------------------------------------
1864
+ object_exist (2.5ms) object_exist --name "schema_versions"
1865
+ table_create (2.2ms) table_create --flags "TABLE_PAT_KEY" --key_type "UInt64" --name "schema_versions"
1866
+ table_create (2.1ms) table_create --flags "TABLE_NO_KEY" --name "posts"
1867
+ column_create (2.3ms) column_create --flags "COLUMN_SCALAR" --name "title" --table "posts" --type "ShortText"
1868
+ column_create (2.2ms) column_create --flags "COLUMN_SCALAR" --name "body" --table "posts" --type "Text"
1869
+ load (2.5ms) load --table "schema_versions" --values "[{\"_key\":20170303120517}]"
1870
+ table_create (2.3ms) table_create --default_tokenizer "TokenBigram" --flags "TABLE_PAT_KEY" --key_type "ShortText" --name "terms" --normalizer "NormalizerAuto"
1871
+ schema (5.6ms) schema
1872
+ column_create (3.6ms) column_create --flags "COLUMN_INDEX|WITH_POSITION" --name "posts_body" --source "body" --table "terms" --type "posts"
1873
+ load (2.2ms) load --table "schema_versions" --values "[{\"_key\":20170303120527}]"
1874
+ table_create (2.4ms) table_create --flags "TABLE_HASH_KEY" --key_type "UInt32" --name "ages"
1875
+ load (2.4ms) load --table "schema_versions" --values "[{\"_key\":20170303120536}]"
1876
+ load (3.8ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello\",\"body\":\"World\"}\n]"
1877
+ Processing by PostsController#edit as HTML
1878
+ Parameters: {"id"=>"1"}
1879
+ select (51.2ms) select --filter "_id == \"1\"" --limit "1" --match_columns "body" --table "posts"
1880
+ Rendered posts/_form.html.erb (1.2ms)
1881
+ Rendered posts/edit.html.erb within layouts/application (1.9ms)
1882
+ Completed 200 OK in 56ms (Views: 3.6ms | Groonga: 51.2ms)
1883
+ shutdown (1.0ms) shutdown
1884
+ ------------------------------------------
1885
+ PostsControllerTest: test_should_show_post
1886
+ ------------------------------------------
1887
+ object_exist (2.5ms) object_exist --name "schema_versions"
1888
+ table_create (2.3ms) table_create --flags "TABLE_PAT_KEY" --key_type "UInt64" --name "schema_versions"
1889
+ table_create (2.2ms) table_create --flags "TABLE_NO_KEY" --name "posts"
1890
+ column_create (2.4ms) column_create --flags "COLUMN_SCALAR" --name "title" --table "posts" --type "ShortText"
1891
+ column_create (2.8ms) column_create --flags "COLUMN_SCALAR" --name "body" --table "posts" --type "Text"
1892
+ load (2.5ms) load --table "schema_versions" --values "[{\"_key\":20170303120517}]"
1893
+ table_create (2.5ms) table_create --default_tokenizer "TokenBigram" --flags "TABLE_PAT_KEY" --key_type "ShortText" --name "terms" --normalizer "NormalizerAuto"
1894
+ schema (4.7ms) schema
1895
+ column_create (3.4ms) column_create --flags "COLUMN_INDEX|WITH_POSITION" --name "posts_body" --source "body" --table "terms" --type "posts"
1896
+ load (2.3ms) load --table "schema_versions" --values "[{\"_key\":20170303120527}]"
1897
+ table_create (2.3ms) table_create --flags "TABLE_HASH_KEY" --key_type "UInt32" --name "ages"
1898
+ load (2.4ms) load --table "schema_versions" --values "[{\"_key\":20170303120536}]"
1899
+ load (3.8ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello\",\"body\":\"World\"}\n]"
1900
+ Processing by PostsController#show as HTML
1901
+ Parameters: {"id"=>"1"}
1902
+ select (59.2ms) select --filter "_id == \"1\"" --limit "1" --match_columns "body" --table "posts"
1903
+ Rendered posts/show.html.erb within layouts/application (0.6ms)
1904
+ Completed 200 OK in 63ms (Views: 2.4ms | Groonga: 59.2ms)
1905
+ shutdown (0.9ms) shutdown
1906
+ ------------------------------------------
1907
+ PostsControllerTest: test_should_get_index
1908
+ ------------------------------------------
1909
+ object_exist (2.7ms) object_exist --name "schema_versions"
1910
+ table_create (2.4ms) table_create --flags "TABLE_PAT_KEY" --key_type "UInt64" --name "schema_versions"
1911
+ table_create (2.3ms) table_create --flags "TABLE_NO_KEY" --name "posts"
1912
+ column_create (2.3ms) column_create --flags "COLUMN_SCALAR" --name "title" --table "posts" --type "ShortText"
1913
+ column_create (2.4ms) column_create --flags "COLUMN_SCALAR" --name "body" --table "posts" --type "Text"
1914
+ load (2.4ms) load --table "schema_versions" --values "[{\"_key\":20170303120517}]"
1915
+ table_create (2.4ms) table_create --default_tokenizer "TokenBigram" --flags "TABLE_PAT_KEY" --key_type "ShortText" --name "terms" --normalizer "NormalizerAuto"
1916
+ schema (4.7ms) schema
1917
+ column_create (3.4ms) column_create --flags "COLUMN_INDEX|WITH_POSITION" --name "posts_body" --source "body" --table "terms" --type "posts"
1918
+ load (3.7ms) load --table "schema_versions" --values "[{\"_key\":20170303120527}]"
1919
+ table_create (3.3ms) table_create --flags "TABLE_HASH_KEY" --key_type "UInt32" --name "ages"
1920
+ load (4.5ms) load --table "schema_versions" --values "[{\"_key\":20170303120536}]"
1921
+ load (4.7ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello\",\"body\":\"World\"}\n]"
1922
+ Processing by PostsController#index as HTML
1923
+ select (3.7ms) select --limit "-1" --match_columns "body" --table "posts"
1924
+ Rendered posts/index.html.erb within layouts/application (21.1ms)
1925
+ Completed 200 OK in 29ms (Views: 24.6ms | Groonga: 3.7ms)
1926
+ shutdown (1.5ms) shutdown
1927
+ --------------------------------------------
1928
+ PostsControllerTest: test_should_create_post
1929
+ --------------------------------------------
1930
+ object_exist (3.2ms) object_exist --name "schema_versions"
1931
+ table_create (3.2ms) table_create --flags "TABLE_PAT_KEY" --key_type "UInt64" --name "schema_versions"
1932
+ table_create (3.0ms) table_create --flags "TABLE_NO_KEY" --name "posts"
1933
+ column_create (2.3ms) column_create --flags "COLUMN_SCALAR" --name "title" --table "posts" --type "ShortText"
1934
+ column_create (3.0ms) column_create --flags "COLUMN_SCALAR" --name "body" --table "posts" --type "Text"
1935
+ load (3.4ms) load --table "schema_versions" --values "[{\"_key\":20170303120517}]"
1936
+ table_create (2.5ms) table_create --default_tokenizer "TokenBigram" --flags "TABLE_PAT_KEY" --key_type "ShortText" --name "terms" --normalizer "NormalizerAuto"
1937
+ schema (6.0ms) schema
1938
+ column_create (4.5ms) column_create --flags "COLUMN_INDEX|WITH_POSITION" --name "posts_body" --source "body" --table "terms" --type "posts"
1939
+ load (3.4ms) load --table "schema_versions" --values "[{\"_key\":20170303120527}]"
1940
+ table_create (3.3ms) table_create --flags "TABLE_HASH_KEY" --key_type "UInt32" --name "ages"
1941
+ load (3.5ms) load --table "schema_versions" --values "[{\"_key\":20170303120536}]"
1942
+ load (4.4ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello\",\"body\":\"World\"}\n]"
1943
+ select (3.6ms) select --limit "0" --match_columns "body" --output_columns "_id" --table "posts"
1944
+ Processing by PostsController#create as HTML
1945
+ Parameters: {"post"=>{"body"=>"World", "title"=>"Hello"}}
1946
+ load (4.2ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello\",\"body\":\"World\"}\n]"
1947
+ Redirected to http://test.host/posts/2
1948
+ Completed 302 Found in 7ms (Groonga: 4.2ms)
1949
+ select (3.0ms) select --limit "0" --match_columns "body" --output_columns "_id" --table "posts"
1950
+ shutdown (2.7ms) shutdown
1951
+ --------------------------------------------
1952
+ PostsControllerTest: test_should_update_post
1953
+ --------------------------------------------
1954
+ object_exist (3.5ms) object_exist --name "schema_versions"
1955
+ table_create (3.6ms) table_create --flags "TABLE_PAT_KEY" --key_type "UInt64" --name "schema_versions"
1956
+ table_create (3.3ms) table_create --flags "TABLE_NO_KEY" --name "posts"
1957
+ column_create (3.4ms) column_create --flags "COLUMN_SCALAR" --name "title" --table "posts" --type "ShortText"
1958
+ column_create (3.4ms) column_create --flags "COLUMN_SCALAR" --name "body" --table "posts" --type "Text"
1959
+ load (3.4ms) load --table "schema_versions" --values "[{\"_key\":20170303120517}]"
1960
+ table_create (3.4ms) table_create --default_tokenizer "TokenBigram" --flags "TABLE_PAT_KEY" --key_type "ShortText" --name "terms" --normalizer "NormalizerAuto"
1961
+ schema (7.8ms) schema
1962
+ column_create (4.0ms) column_create --flags "COLUMN_INDEX|WITH_POSITION" --name "posts_body" --source "body" --table "terms" --type "posts"
1963
+ load (3.3ms) load --table "schema_versions" --values "[{\"_key\":20170303120527}]"
1964
+ table_create (3.1ms) table_create --flags "TABLE_HASH_KEY" --key_type "UInt32" --name "ages"
1965
+ load (3.6ms) load --table "schema_versions" --values "[{\"_key\":20170303120536}]"
1966
+ load (5.7ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello\",\"body\":\"World\"}\n]"
1967
+ Processing by PostsController#update as HTML
1968
+ Parameters: {"post"=>{"body"=>"World", "title"=>"Hello"}, "id"=>"1"}
1969
+ select (56.1ms) select --filter "_id == \"1\"" --limit "1" --match_columns "body" --table "posts"
1970
+ load (1.4ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"_id\":1,\"body\":\"World\",\"title\":\"Hello\"}\n]"
1971
+ Redirected to http://test.host/posts/1
1972
+ Completed 302 Found in 61ms (Groonga: 57.5ms)
1973
+ shutdown (0.8ms) shutdown
1974
+ ----------------------------
1975
+ PostTest: test_.create(Hash)
1976
+ ----------------------------
1977
+ object_exist (3.4ms) object_exist --name "schema_versions"
1978
+ table_create (3.6ms) table_create --flags "TABLE_PAT_KEY" --key_type "UInt64" --name "schema_versions"
1979
+ table_create (3.1ms) table_create --flags "TABLE_NO_KEY" --name "posts"
1980
+ column_create (3.0ms) column_create --flags "COLUMN_SCALAR" --name "title" --table "posts" --type "ShortText"
1981
+ column_create (2.4ms) column_create --flags "COLUMN_SCALAR" --name "body" --table "posts" --type "Text"
1982
+ load (2.4ms) load --table "schema_versions" --values "[{\"_key\":20170303120517}]"
1983
+ table_create (2.4ms) table_create --default_tokenizer "TokenBigram" --flags "TABLE_PAT_KEY" --key_type "ShortText" --name "terms" --normalizer "NormalizerAuto"
1984
+ schema (4.6ms) schema
1985
+ column_create (3.3ms) column_create --flags "COLUMN_INDEX|WITH_POSITION" --name "posts_body" --source "body" --table "terms" --type "posts"
1986
+ load (2.2ms) load --table "schema_versions" --values "[{\"_key\":20170303120527}]"
1987
+ table_create (2.2ms) table_create --flags "TABLE_HASH_KEY" --key_type "UInt32" --name "ages"
1988
+ load (2.7ms) load --table "schema_versions" --values "[{\"_key\":20170303120536}]"
1989
+ load (2.4ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello\"}\n]"
1990
+ select (54.0ms) select --filter "_id == 1" --limit "1" --match_columns "body" --table "posts"
1991
+ shutdown (0.7ms) shutdown
1992
+ ------------------------------
1993
+ PostTest: test_.create([Hash])
1994
+ ------------------------------
1995
+ object_exist (2.3ms) object_exist --name "schema_versions"
1996
+ table_create (2.2ms) table_create --flags "TABLE_PAT_KEY" --key_type "UInt64" --name "schema_versions"
1997
+ table_create (2.1ms) table_create --flags "TABLE_NO_KEY" --name "posts"
1998
+ column_create (2.2ms) column_create --flags "COLUMN_SCALAR" --name "title" --table "posts" --type "ShortText"
1999
+ column_create (2.1ms) column_create --flags "COLUMN_SCALAR" --name "body" --table "posts" --type "Text"
2000
+ load (2.3ms) load --table "schema_versions" --values "[{\"_key\":20170303120517}]"
2001
+ table_create (2.2ms) table_create --default_tokenizer "TokenBigram" --flags "TABLE_PAT_KEY" --key_type "ShortText" --name "terms" --normalizer "NormalizerAuto"
2002
+ schema (4.5ms) schema
2003
+ column_create (3.3ms) column_create --flags "COLUMN_INDEX|WITH_POSITION" --name "posts_body" --source "body" --table "terms" --type "posts"
2004
+ load (2.2ms) load --table "schema_versions" --values "[{\"_key\":20170303120527}]"
2005
+ table_create (2.1ms) table_create --flags "TABLE_HASH_KEY" --key_type "UInt32" --name "ages"
2006
+ load (2.1ms) load --table "schema_versions" --values "[{\"_key\":20170303120536}]"
2007
+ load (2.4ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello1\"}\n]"
2008
+ load (2.4ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello2\"}\n]"
2009
+ select (52.6ms) select --filter "_id == 1" --limit "1" --match_columns "body" --table "posts"
2010
+ select (1.1ms) select --filter "_id == 2" --limit "1" --match_columns "body" --table "posts"
2011
+ shutdown (0.7ms) shutdown
@@ -0,0 +1,8 @@
1
+ class CreatePosts < GroongaClientModel::Migration
2
+ def change
3
+ create_table :posts,
4
+ type: :hash_table,
5
+ key_type: :short_text do |t|
6
+ end
7
+ end
8
+ end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../../../groonga-client
3
3
  specs:
4
- groonga-client (0.4.2)
4
+ groonga-client (0.4.3)
5
5
  gqtp (>= 1.0.4)
6
6
  groonga-command (>= 1.2.8)
7
7
  groonga-command-parser (>= 1.0.7)
@@ -10,7 +10,7 @@ PATH
10
10
  PATH
11
11
  remote: ../../../
12
12
  specs:
13
- groonga-client-model (1.0.1)
13
+ groonga-client-model (1.0.2)
14
14
  activemodel
15
15
  groonga-client (>= 0.4.2)
16
16
  groonga-command-parser
@@ -11075,3 +11075,250 @@ PostTest: test_.create([Hash])
11075
11075
  select (51.7ms) select --filter "_id == 1" --limit "1" --match_columns "body" --table "posts"
11076
11076
  select (0.9ms) select --filter "_id == 2" --limit "1" --match_columns "body" --table "posts"
11077
11077
  shutdown (0.6ms) shutdown
11078
+ ----------------------------
11079
+ PostTest: test_.create(Hash)
11080
+ ----------------------------
11081
+ object_exist (3.0ms) object_exist --name "schema_versions"
11082
+ table_create (2.2ms) table_create --flags "TABLE_PAT_KEY" --key_type "UInt64" --name "schema_versions"
11083
+ table_create (2.5ms) table_create --flags "TABLE_NO_KEY" --name "posts"
11084
+ column_create (2.3ms) column_create --flags "COLUMN_SCALAR" --name "title" --table "posts" --type "ShortText"
11085
+ column_create (2.2ms) column_create --flags "COLUMN_SCALAR" --name "body" --table "posts" --type "Text"
11086
+ load (2.4ms) load --table "schema_versions" --values "[{\"_key\":20170301061420}]"
11087
+ table_create (2.7ms) table_create --default_tokenizer "TokenBigram" --flags "TABLE_PAT_KEY" --key_type "ShortText" --name "terms" --normalizer "NormalizerAuto"
11088
+ schema (4.6ms) schema
11089
+ column_create (3.2ms) column_create --flags "COLUMN_INDEX|WITH_POSITION" --name "posts_body" --source "body" --table "terms" --type "posts"
11090
+ load (2.2ms) load --table "schema_versions" --values "[{\"_key\":20170303115054}]"
11091
+ table_create (2.6ms) table_create --flags "TABLE_HASH_KEY" --key_type "UInt32" --name "ages"
11092
+ load (2.2ms) load --table "schema_versions" --values "[{\"_key\":20170303115135}]"
11093
+ schema (5.1ms) schema
11094
+ load (2.7ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello\"}\n]"
11095
+ select (63.9ms) select --filter "_id == 1" --limit "1" --match_columns "body" --table "posts"
11096
+ shutdown (0.7ms) shutdown
11097
+ ------------------------------
11098
+ PostTest: test_.create([Hash])
11099
+ ------------------------------
11100
+ object_exist (2.7ms) object_exist --name "schema_versions"
11101
+ table_create (2.3ms) table_create --flags "TABLE_PAT_KEY" --key_type "UInt64" --name "schema_versions"
11102
+ table_create (2.2ms) table_create --flags "TABLE_NO_KEY" --name "posts"
11103
+ column_create (2.3ms) column_create --flags "COLUMN_SCALAR" --name "title" --table "posts" --type "ShortText"
11104
+ column_create (2.2ms) column_create --flags "COLUMN_SCALAR" --name "body" --table "posts" --type "Text"
11105
+ load (2.3ms) load --table "schema_versions" --values "[{\"_key\":20170301061420}]"
11106
+ table_create (2.3ms) table_create --default_tokenizer "TokenBigram" --flags "TABLE_PAT_KEY" --key_type "ShortText" --name "terms" --normalizer "NormalizerAuto"
11107
+ schema (4.6ms) schema
11108
+ column_create (3.3ms) column_create --flags "COLUMN_INDEX|WITH_POSITION" --name "posts_body" --source "body" --table "terms" --type "posts"
11109
+ load (2.2ms) load --table "schema_versions" --values "[{\"_key\":20170303115054}]"
11110
+ table_create (2.2ms) table_create --flags "TABLE_HASH_KEY" --key_type "UInt32" --name "ages"
11111
+ load (2.3ms) load --table "schema_versions" --values "[{\"_key\":20170303115135}]"
11112
+ load (2.5ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello1\"}\n]"
11113
+ load (2.8ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello2\"}\n]"
11114
+ select (58.4ms) select --filter "_id == 1" --limit "1" --match_columns "body" --table "posts"
11115
+ select (1.1ms) select --filter "_id == 2" --limit "1" --match_columns "body" --table "posts"
11116
+ shutdown (0.7ms) shutdown
11117
+ --------------------------------------------
11118
+ PostsControllerTest: test_should_create_post
11119
+ --------------------------------------------
11120
+ object_exist (1.6ms) object_exist --name "schema_versions"
11121
+ table_create (1.5ms) table_create --flags "TABLE_PAT_KEY" --key_type "UInt64" --name "schema_versions"
11122
+ table_create (1.4ms) table_create --flags "TABLE_NO_KEY" --name "posts"
11123
+ column_create (1.7ms) column_create --flags "COLUMN_SCALAR" --name "title" --table "posts" --type "ShortText"
11124
+ column_create (1.7ms) column_create --flags "COLUMN_SCALAR" --name "body" --table "posts" --type "Text"
11125
+ load (2.2ms) load --table "schema_versions" --values "[{\"_key\":20170301061420}]"
11126
+ table_create (2.2ms) table_create --default_tokenizer "TokenBigram" --flags "TABLE_PAT_KEY" --key_type "ShortText" --name "terms" --normalizer "NormalizerAuto"
11127
+ schema (4.8ms) schema
11128
+ column_create (3.5ms) column_create --flags "COLUMN_INDEX|WITH_POSITION" --name "posts_body" --source "body" --table "terms" --type "posts"
11129
+ load (2.4ms) load --table "schema_versions" --values "[{\"_key\":20170303115054}]"
11130
+ table_create (2.3ms) table_create --flags "TABLE_HASH_KEY" --key_type "UInt32" --name "ages"
11131
+ load (2.3ms) load --table "schema_versions" --values "[{\"_key\":20170303115135}]"
11132
+ load (3.7ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello\",\"body\":\"World\"}\n]"
11133
+ select (2.6ms) select --limit "0" --match_columns "body" --output_columns "_id" --table "posts"
11134
+ Started POST "/posts" for 127.0.0.1 at 2017-03-21 14:09:51 +0900
11135
+ Processing by PostsController#create as HTML
11136
+ Parameters: {"post"=>{"body"=>"World", "title"=>"Hello"}}
11137
+ load (1.4ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello\",\"body\":\"World\"}\n]"
11138
+ Redirected to http://www.example.com/posts/2
11139
+ Completed 302 Found in 23ms (Groonga: 1.4ms)
11140
+ select (1.2ms) select --limit "0" --match_columns "body" --output_columns "_id" --table "posts"
11141
+ select (1.2ms) select --limit "1" --match_columns "body" --sort_keys "-_id" --sortby "-_id" --table "posts"
11142
+ shutdown (1.0ms) shutdown
11143
+ -----------------------------------------
11144
+ PostsControllerTest: test_should_get_edit
11145
+ -----------------------------------------
11146
+ object_exist (2.3ms) object_exist --name "schema_versions"
11147
+ table_create (2.1ms) table_create --flags "TABLE_PAT_KEY" --key_type "UInt64" --name "schema_versions"
11148
+ table_create (2.6ms) table_create --flags "TABLE_NO_KEY" --name "posts"
11149
+ column_create (2.8ms) column_create --flags "COLUMN_SCALAR" --name "title" --table "posts" --type "ShortText"
11150
+ column_create (2.7ms) column_create --flags "COLUMN_SCALAR" --name "body" --table "posts" --type "Text"
11151
+ load (2.2ms) load --table "schema_versions" --values "[{\"_key\":20170301061420}]"
11152
+ table_create (2.8ms) table_create --default_tokenizer "TokenBigram" --flags "TABLE_PAT_KEY" --key_type "ShortText" --name "terms" --normalizer "NormalizerAuto"
11153
+ schema (5.5ms) schema
11154
+ column_create (3.9ms) column_create --flags "COLUMN_INDEX|WITH_POSITION" --name "posts_body" --source "body" --table "terms" --type "posts"
11155
+ load (2.7ms) load --table "schema_versions" --values "[{\"_key\":20170303115054}]"
11156
+ table_create (2.6ms) table_create --flags "TABLE_HASH_KEY" --key_type "UInt32" --name "ages"
11157
+ load (2.6ms) load --table "schema_versions" --values "[{\"_key\":20170303115135}]"
11158
+ load (4.2ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello\",\"body\":\"World\"}\n]"
11159
+ Started GET "/posts/1/edit" for 127.0.0.1 at 2017-03-21 14:09:51 +0900
11160
+ Processing by PostsController#edit as HTML
11161
+ Parameters: {"id"=>"1"}
11162
+ select (52.3ms) select --filter "_id == \"1\"" --limit "1" --match_columns "body" --table "posts"
11163
+ Rendering posts/edit.html.erb within layouts/application
11164
+ Rendered posts/_form.html.erb (12.9ms)
11165
+ Rendered posts/edit.html.erb within layouts/application (15.0ms)
11166
+ Completed 200 OK in 275ms (Views: 219.0ms | Groonga: 52.3ms)
11167
+ shutdown (1.2ms) shutdown
11168
+ ------------------------------------------
11169
+ PostsControllerTest: test_should_get_index
11170
+ ------------------------------------------
11171
+ object_exist (2.7ms) object_exist --name "schema_versions"
11172
+ table_create (3.0ms) table_create --flags "TABLE_PAT_KEY" --key_type "UInt64" --name "schema_versions"
11173
+ table_create (2.8ms) table_create --flags "TABLE_NO_KEY" --name "posts"
11174
+ column_create (2.6ms) column_create --flags "COLUMN_SCALAR" --name "title" --table "posts" --type "ShortText"
11175
+ column_create (2.2ms) column_create --flags "COLUMN_SCALAR" --name "body" --table "posts" --type "Text"
11176
+ load (2.5ms) load --table "schema_versions" --values "[{\"_key\":20170301061420}]"
11177
+ table_create (2.4ms) table_create --default_tokenizer "TokenBigram" --flags "TABLE_PAT_KEY" --key_type "ShortText" --name "terms" --normalizer "NormalizerAuto"
11178
+ schema (6.3ms) schema
11179
+ column_create (2.7ms) column_create --flags "COLUMN_INDEX|WITH_POSITION" --name "posts_body" --source "body" --table "terms" --type "posts"
11180
+ load (1.5ms) load --table "schema_versions" --values "[{\"_key\":20170303115054}]"
11181
+ table_create (1.4ms) table_create --flags "TABLE_HASH_KEY" --key_type "UInt32" --name "ages"
11182
+ load (1.4ms) load --table "schema_versions" --values "[{\"_key\":20170303115135}]"
11183
+ load (1.9ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello\",\"body\":\"World\"}\n]"
11184
+ Started GET "/posts" for 127.0.0.1 at 2017-03-21 14:09:52 +0900
11185
+ Processing by PostsController#index as HTML
11186
+ Rendering posts/index.html.erb within layouts/application
11187
+ select (1.4ms) select --limit "-1" --match_columns "body" --table "posts"
11188
+ Rendered posts/index.html.erb within layouts/application (3.1ms)
11189
+ Completed 200 OK in 8ms (Views: 4.7ms | Groonga: 1.4ms)
11190
+ shutdown (1.2ms) shutdown
11191
+ ----------------------------------------
11192
+ PostsControllerTest: test_should_get_new
11193
+ ----------------------------------------
11194
+ object_exist (1.5ms) object_exist --name "schema_versions"
11195
+ table_create (1.4ms) table_create --flags "TABLE_PAT_KEY" --key_type "UInt64" --name "schema_versions"
11196
+ table_create (1.0ms) table_create --flags "TABLE_NO_KEY" --name "posts"
11197
+ column_create (1.0ms) column_create --flags "COLUMN_SCALAR" --name "title" --table "posts" --type "ShortText"
11198
+ column_create (1.0ms) column_create --flags "COLUMN_SCALAR" --name "body" --table "posts" --type "Text"
11199
+ load (0.9ms) load --table "schema_versions" --values "[{\"_key\":20170301061420}]"
11200
+ table_create (0.8ms) table_create --default_tokenizer "TokenBigram" --flags "TABLE_PAT_KEY" --key_type "ShortText" --name "terms" --normalizer "NormalizerAuto"
11201
+ schema (1.7ms) schema
11202
+ column_create (1.3ms) column_create --flags "COLUMN_INDEX|WITH_POSITION" --name "posts_body" --source "body" --table "terms" --type "posts"
11203
+ load (3.6ms) load --table "schema_versions" --values "[{\"_key\":20170303115054}]"
11204
+ table_create (2.7ms) table_create --flags "TABLE_HASH_KEY" --key_type "UInt32" --name "ages"
11205
+ load (1.5ms) load --table "schema_versions" --values "[{\"_key\":20170303115135}]"
11206
+ load (1.8ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello\",\"body\":\"World\"}\n]"
11207
+ Started GET "/posts/new" for 127.0.0.1 at 2017-03-21 14:09:52 +0900
11208
+ Processing by PostsController#new as HTML
11209
+ Rendering posts/new.html.erb within layouts/application
11210
+ Rendered posts/_form.html.erb (11.4ms)
11211
+ Rendered posts/new.html.erb within layouts/application (13.7ms)
11212
+ Completed 200 OK in 21ms (Views: 19.6ms | Groonga: 0.0ms)
11213
+ shutdown (1.4ms) shutdown
11214
+ --------------------------------------------
11215
+ PostsControllerTest: test_should_update_post
11216
+ --------------------------------------------
11217
+ object_exist (3.3ms) object_exist --name "schema_versions"
11218
+ table_create (3.1ms) table_create --flags "TABLE_PAT_KEY" --key_type "UInt64" --name "schema_versions"
11219
+ table_create (3.4ms) table_create --flags "TABLE_NO_KEY" --name "posts"
11220
+ column_create (3.6ms) column_create --flags "COLUMN_SCALAR" --name "title" --table "posts" --type "ShortText"
11221
+ column_create (2.3ms) column_create --flags "COLUMN_SCALAR" --name "body" --table "posts" --type "Text"
11222
+ load (3.0ms) load --table "schema_versions" --values "[{\"_key\":20170301061420}]"
11223
+ table_create (4.4ms) table_create --default_tokenizer "TokenBigram" --flags "TABLE_PAT_KEY" --key_type "ShortText" --name "terms" --normalizer "NormalizerAuto"
11224
+ schema (6.4ms) schema
11225
+ column_create (4.5ms) column_create --flags "COLUMN_INDEX|WITH_POSITION" --name "posts_body" --source "body" --table "terms" --type "posts"
11226
+ load (3.9ms) load --table "schema_versions" --values "[{\"_key\":20170303115054}]"
11227
+ table_create (3.7ms) table_create --flags "TABLE_HASH_KEY" --key_type "UInt32" --name "ages"
11228
+ load (3.5ms) load --table "schema_versions" --values "[{\"_key\":20170303115135}]"
11229
+ load (4.7ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello\",\"body\":\"World\"}\n]"
11230
+ Started PATCH "/posts/1" for 127.0.0.1 at 2017-03-21 14:09:52 +0900
11231
+ Processing by PostsController#update as HTML
11232
+ Parameters: {"post"=>{"body"=>"World", "title"=>"Hello"}, "id"=>"1"}
11233
+ select (47.6ms) select --filter "_id == \"1\"" --limit "1" --match_columns "body" --table "posts"
11234
+ load (1.5ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"_id\":1,\"body\":\"World\",\"title\":\"Hello\"}\n]"
11235
+ Redirected to http://www.example.com/posts/1
11236
+ Completed 302 Found in 54ms (Groonga: 49.1ms)
11237
+ shutdown (1.0ms) shutdown
11238
+ ---------------------------------------------
11239
+ PostsControllerTest: test_should_destroy_post
11240
+ ---------------------------------------------
11241
+ object_exist (3.2ms) object_exist --name "schema_versions"
11242
+ table_create (3.4ms) table_create --flags "TABLE_PAT_KEY" --key_type "UInt64" --name "schema_versions"
11243
+ table_create (3.9ms) table_create --flags "TABLE_NO_KEY" --name "posts"
11244
+ column_create (3.7ms) column_create --flags "COLUMN_SCALAR" --name "title" --table "posts" --type "ShortText"
11245
+ column_create (2.9ms) column_create --flags "COLUMN_SCALAR" --name "body" --table "posts" --type "Text"
11246
+ load (3.5ms) load --table "schema_versions" --values "[{\"_key\":20170301061420}]"
11247
+ table_create (3.5ms) table_create --default_tokenizer "TokenBigram" --flags "TABLE_PAT_KEY" --key_type "ShortText" --name "terms" --normalizer "NormalizerAuto"
11248
+ schema (6.8ms) schema
11249
+ column_create (3.3ms) column_create --flags "COLUMN_INDEX|WITH_POSITION" --name "posts_body" --source "body" --table "terms" --type "posts"
11250
+ load (3.4ms) load --table "schema_versions" --values "[{\"_key\":20170303115054}]"
11251
+ table_create (3.6ms) table_create --flags "TABLE_HASH_KEY" --key_type "UInt32" --name "ages"
11252
+ load (3.1ms) load --table "schema_versions" --values "[{\"_key\":20170303115135}]"
11253
+ load (4.8ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello\",\"body\":\"World\"}\n]"
11254
+ select (3.4ms) select --limit "0" --match_columns "body" --output_columns "_id" --table "posts"
11255
+ Started DELETE "/posts/1" for 127.0.0.1 at 2017-03-21 14:09:52 +0900
11256
+ Processing by PostsController#destroy as HTML
11257
+ Parameters: {"id"=>"1"}
11258
+ select (54.0ms) select --filter "_id == \"1\"" --limit "1" --match_columns "body" --table "posts"
11259
+ delete (1.7ms) delete --filter "_id == 1" --table "posts"
11260
+ Redirected to http://www.example.com/posts
11261
+ Completed 302 Found in 59ms (Groonga: 55.7ms)
11262
+ select (1.5ms) select --limit "0" --match_columns "body" --output_columns "_id" --table "posts"
11263
+ shutdown (1.2ms) shutdown
11264
+ ------------------------------------------
11265
+ PostsControllerTest: test_should_show_post
11266
+ ------------------------------------------
11267
+ object_exist (3.1ms) object_exist --name "schema_versions"
11268
+ table_create (3.3ms) table_create --flags "TABLE_PAT_KEY" --key_type "UInt64" --name "schema_versions"
11269
+ table_create (2.3ms) table_create --flags "TABLE_NO_KEY" --name "posts"
11270
+ column_create (2.3ms) column_create --flags "COLUMN_SCALAR" --name "title" --table "posts" --type "ShortText"
11271
+ column_create (2.2ms) column_create --flags "COLUMN_SCALAR" --name "body" --table "posts" --type "Text"
11272
+ load (3.2ms) load --table "schema_versions" --values "[{\"_key\":20170301061420}]"
11273
+ table_create (3.0ms) table_create --default_tokenizer "TokenBigram" --flags "TABLE_PAT_KEY" --key_type "ShortText" --name "terms" --normalizer "NormalizerAuto"
11274
+ schema (4.7ms) schema
11275
+ column_create (3.4ms) column_create --flags "COLUMN_INDEX|WITH_POSITION" --name "posts_body" --source "body" --table "terms" --type "posts"
11276
+ load (2.4ms) load --table "schema_versions" --values "[{\"_key\":20170303115054}]"
11277
+ table_create (2.3ms) table_create --flags "TABLE_HASH_KEY" --key_type "UInt32" --name "ages"
11278
+ load (2.3ms) load --table "schema_versions" --values "[{\"_key\":20170303115135}]"
11279
+ load (3.8ms) load --command_version "3" --output_errors "yes" --output_ids "yes" --table "posts" --values "[\n{\"title\":\"Hello\",\"body\":\"World\"}\n]"
11280
+ Started GET "/posts/1" for 127.0.0.1 at 2017-03-21 14:09:52 +0900
11281
+ Processing by PostsController#show as HTML
11282
+ Parameters: {"id"=>"1"}
11283
+ select (50.5ms) select --filter "_id == \"1\"" --limit "1" --match_columns "body" --table "posts"
11284
+ Rendering posts/show.html.erb within layouts/application
11285
+ Rendered posts/show.html.erb within layouts/application (0.6ms)
11286
+ Completed 200 OK in 56ms (Views: 2.3ms | Groonga: 50.5ms)
11287
+ shutdown (0.8ms) shutdown
11288
+ ---------------------------------------------
11289
+ AgeTest: test_validate:__key:_invalid:_string
11290
+ ---------------------------------------------
11291
+ object_exist (2.5ms) object_exist --name "schema_versions"
11292
+ table_create (2.3ms) table_create --flags "TABLE_PAT_KEY" --key_type "UInt64" --name "schema_versions"
11293
+ table_create (2.3ms) table_create --flags "TABLE_NO_KEY" --name "posts"
11294
+ column_create (2.3ms) column_create --flags "COLUMN_SCALAR" --name "title" --table "posts" --type "ShortText"
11295
+ column_create (2.3ms) column_create --flags "COLUMN_SCALAR" --name "body" --table "posts" --type "Text"
11296
+ load (2.6ms) load --table "schema_versions" --values "[{\"_key\":20170301061420}]"
11297
+ table_create (2.3ms) table_create --default_tokenizer "TokenBigram" --flags "TABLE_PAT_KEY" --key_type "ShortText" --name "terms" --normalizer "NormalizerAuto"
11298
+ schema (4.7ms) schema
11299
+ column_create (3.4ms) column_create --flags "COLUMN_INDEX|WITH_POSITION" --name "posts_body" --source "body" --table "terms" --type "posts"
11300
+ load (2.6ms) load --table "schema_versions" --values "[{\"_key\":20170303115054}]"
11301
+ table_create (2.4ms) table_create --flags "TABLE_HASH_KEY" --key_type "UInt32" --name "ages"
11302
+ load (2.4ms) load --table "schema_versions" --values "[{\"_key\":20170303115135}]"
11303
+ shutdown (2.4ms) shutdown
11304
+ -----------------------------------------
11305
+ MigrationGeneratorTest: test_create_table
11306
+ -----------------------------------------
11307
+ ---------------------------------------
11308
+ MigrationGeneratorTest: test_set_config
11309
+ ---------------------------------------
11310
+ ---------------------------------------
11311
+ MigrationGeneratorTest: test_add_column
11312
+ ---------------------------------------
11313
+ ------------------------------------------
11314
+ MigrationGeneratorTest: test_remove_column
11315
+ ------------------------------------------
11316
+ -----------------------------------------------
11317
+ MigrationGeneratorTest: test_create_table:__key
11318
+ -----------------------------------------------
11319
+ ------------------------------------------
11320
+ MigrationGeneratorTest: test_delete_config
11321
+ ------------------------------------------
11322
+ ----------------------------------------------
11323
+ MigrationGeneratorTest: test_set_config:_value
11324
+ ----------------------------------------------
@@ -0,0 +1,10 @@
1
+ class SetConfigAliasColumn < GroongaClientModel::Migration
2
+ def up
3
+ set_config "alias.column", "aliases.real_name"
4
+ end
5
+
6
+ def down
7
+ # set_config "alias.column", "old value"
8
+ # delete_config "alias.column"
9
+ end
10
+ end
@@ -0,0 +1,67 @@
1
+ # Copyright (C) 2017 Yasuhiro Horimoto <horimoto@clear-code.com>
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class TestMigrationRename < Test::Unit::TestCase
18
+ include GroongaClientModel::TestHelper
19
+ include TestHelper::Migration
20
+
21
+ setup do
22
+ open_client do |client|
23
+ client.table_create(name: "posts",
24
+ flags: "TABLE_HASH_KEY",
25
+ key_type: "ShortText")
26
+ client.column_create(table: "posts",
27
+ name: "content",
28
+ flags: "COLUMN_SCALAR",
29
+ type: "Text")
30
+ values = [
31
+ {"_key" => "Groonga", "content" => "Very good!"},
32
+ {"_key" => "Ruby", "content" => "Very exciting!"},
33
+ ]
34
+ client.load(table: "posts",
35
+ values: values)
36
+ end
37
+ end
38
+
39
+ test("#rename_column") do
40
+ expected_up_report = <<-REPORT
41
+ -- rename_column(:posts, "content", "new_content")
42
+ -> 0.0s
43
+ REPORT
44
+ expected_down_report = <<-REPORT
45
+ -- rename_column(:posts, "new_content", "content")
46
+ -> 0.0s
47
+ REPORT
48
+ expected_dump = <<-DUMP.chomp
49
+ table_create posts TABLE_HASH_KEY ShortText
50
+ column_create posts new_content COLUMN_SCALAR Text
51
+
52
+ load --table posts
53
+ [
54
+ ["_key","new_content"],
55
+ ["Groonga","Very good!"],
56
+ ["Ruby","Very exciting!"]
57
+ ]
58
+ DUMP
59
+ assert_migrate(expected_up_report,
60
+ expected_down_report,
61
+ expected_dump) do |migration|
62
+ migration.instance_eval do
63
+ rename_column(:posts, "content", "new_content")
64
+ end
65
+ end
66
+ end
67
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groonga-client-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-09 00:00:00.000000000 Z
11
+ date: 2018-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: groonga-client
@@ -233,7 +233,7 @@ files:
233
233
  - test/apps/rails4/test/generators/migration_generator_test.rb
234
234
  - test/apps/rails4/test/models/post_test.rb
235
235
  - test/apps/rails4/test/test_helper.rb
236
- - test/apps/rails4/test/tmp/db/groonga/migrate/20170307045825_set_config_alias_column.rb
236
+ - test/apps/rails4/test/tmp/db/groonga/migrate/20170321050929_create_posts.rb
237
237
  - test/apps/rails4/tmp/cache/assets/sprockets/v3.0/1v/1vNbaFvqzPuMCPa9LBe2yL962Ncp7RbNREOlE_qe8Ss.cache
238
238
  - test/apps/rails4/tmp/cache/assets/sprockets/v3.0/2F/2FyDjMLF22tXYLEKS6UqrqiSZTKp2HowmRsOZfW2dQs.cache
239
239
  - test/apps/rails4/tmp/cache/assets/sprockets/v3.0/3Q/3QxCnPBwOHO-nainvNGREWb7QnMUKlPsx4AFZgNVVUI.cache
@@ -366,7 +366,7 @@ files:
366
366
  - test/apps/rails5/test/models/age_test.rb
367
367
  - test/apps/rails5/test/models/post_test.rb
368
368
  - test/apps/rails5/test/test_helper.rb
369
- - test/apps/rails5/test/tmp/db/groonga/migrate/20170307081511_remove_title_from_posts.rb
369
+ - test/apps/rails5/test/tmp/db/groonga/migrate/20170321050953_set_config_alias_column.rb
370
370
  - test/apps/rails5/tmp/cache/assets/sprockets/v3.0/-X/-XSAop9IIcSTUV_xiFS6IsrwsKgzfBrhLSIgb3alOgI.cache
371
371
  - test/apps/rails5/tmp/cache/assets/sprockets/v3.0/04/04zh1ytKDagWzWcqUyadXtzzohCn9iVvSVG4KrjpfPU.cache
372
372
  - test/apps/rails5/tmp/cache/assets/sprockets/v3.0/05/05HAjV9iJX9zqV_rpyUQjVkKEvW5kK3XsyZauoD3MGU.cache
@@ -566,6 +566,7 @@ files:
566
566
  - test/unit/migration/test_create_table.rb
567
567
  - test/unit/migration/test_exist.rb
568
568
  - test/unit/migration/test_load.rb
569
+ - test/unit/migration/test_rename_column.rb
569
570
  - test/unit/record/test_active_model.rb
570
571
  - test/unit/record/test_readers.rb
571
572
  - test/unit/record/test_timestamps.rb
@@ -594,7 +595,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
594
595
  version: '0'
595
596
  requirements: []
596
597
  rubyforge_project:
597
- rubygems_version: 2.5.2
598
+ rubygems_version: 2.5.2.2
598
599
  signing_key:
599
600
  specification_version: 4
600
601
  summary: Groonga-client-model is a model interface for groonga-client.
@@ -639,7 +640,7 @@ test_files:
639
640
  - test/apps/rails4/test/models/post_test.rb
640
641
  - test/apps/rails4/test/controllers/posts_controller_test.rb
641
642
  - test/apps/rails4/test/test_helper.rb
642
- - test/apps/rails4/test/tmp/db/groonga/migrate/20170307045825_set_config_alias_column.rb
643
+ - test/apps/rails4/test/tmp/db/groonga/migrate/20170321050929_create_posts.rb
643
644
  - test/apps/rails4/test/generators/migration_generator_test.rb
644
645
  - test/apps/rails4/config/secrets.yml
645
646
  - test/apps/rails4/config/routes.rb
@@ -767,7 +768,7 @@ test_files:
767
768
  - test/apps/rails5/test/models/age_test.rb
768
769
  - test/apps/rails5/test/controllers/posts_controller_test.rb
769
770
  - test/apps/rails5/test/test_helper.rb
770
- - test/apps/rails5/test/tmp/db/groonga/migrate/20170307081511_remove_title_from_posts.rb
771
+ - test/apps/rails5/test/tmp/db/groonga/migrate/20170321050953_set_config_alias_column.rb
771
772
  - test/apps/rails5/test/generators/migration_generator_test.rb
772
773
  - test/apps/rails5/config/secrets.yml
773
774
  - test/apps/rails5/config/routes.rb
@@ -992,6 +993,7 @@ test_files:
992
993
  - test/unit/migration/test_exist.rb
993
994
  - test/unit/migration/test_config.rb
994
995
  - test/unit/migration/test_load.rb
996
+ - test/unit/migration/test_rename_column.rb
995
997
  - test/unit/migration/test_create_table.rb
996
998
  - test/unit/fixtures/migrate/20170303115135_create_ages.rb
997
999
  - test/unit/fixtures/migrate/20170301061420_create_posts.rb
@@ -1,10 +0,0 @@
1
- class SetConfigAliasColumn < GroongaClientModel::Migration
2
- def up
3
- config_set "alias.column", "aliases.real_name"
4
- end
5
-
6
- def down
7
- # config_set "alias.column", "old value"
8
- # config_delete "alias.column"
9
- end
10
- end
@@ -1,5 +0,0 @@
1
- class RemoveTitleFromPosts < GroongaClientModel::Migration
2
- def change
3
- remove_column :posts, :title
4
- end
5
- end