activerecord-postgresql-extensions 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/Rakefile +2 -2
  2. data/VERSION +1 -1
  3. data/activerecord-postgresql-extensions.gemspec +20 -17
  4. data/lib/activerecord-postgresql-extensions.rb +2 -0
  5. data/lib/postgresql_extensions/postgresql_adapter_extensions.rb +50 -53
  6. data/lib/postgresql_extensions/postgresql_constraints.rb +142 -153
  7. data/lib/postgresql_extensions/postgresql_extensions.rb +246 -0
  8. data/lib/postgresql_extensions/postgresql_functions.rb +31 -33
  9. data/lib/postgresql_extensions/postgresql_geometry.rb +2 -2
  10. data/lib/postgresql_extensions/postgresql_indexes.rb +13 -14
  11. data/lib/postgresql_extensions/postgresql_languages.rb +4 -4
  12. data/lib/postgresql_extensions/postgresql_permissions.rb +12 -14
  13. data/lib/postgresql_extensions/postgresql_roles.rb +2 -2
  14. data/lib/postgresql_extensions/postgresql_rules.rb +11 -10
  15. data/lib/postgresql_extensions/postgresql_schemas.rb +4 -4
  16. data/lib/postgresql_extensions/postgresql_sequences.rb +15 -16
  17. data/lib/postgresql_extensions/postgresql_tables.rb +20 -21
  18. data/lib/postgresql_extensions/postgresql_text_search.rb +313 -0
  19. data/lib/postgresql_extensions/postgresql_triggers.rb +13 -14
  20. data/lib/postgresql_extensions/postgresql_types.rb +1 -1
  21. data/lib/postgresql_extensions/postgresql_views.rb +13 -14
  22. data/test/{adapter_test.rb → adapter_tests.rb} +6 -6
  23. data/test/{constraints_test.rb → constraints_tests.rb} +13 -13
  24. data/test/extensions_tests.rb +275 -0
  25. data/test/{functions_test.rb → functions_tests.rb} +10 -10
  26. data/test/{geometry_test.rb → geometry_tests.rb} +16 -16
  27. data/test/{index_test.rb → index_tests.rb} +11 -11
  28. data/test/{languages_test.rb → languages_tests.rb} +6 -6
  29. data/test/{permissions_test.rb → permissions_tests.rb} +36 -36
  30. data/test/{roles_test.rb → roles_tests.rb} +6 -6
  31. data/test/{rules_test.rb → rules_tests.rb} +3 -3
  32. data/test/{schemas_test.rb → schemas_tests.rb} +6 -6
  33. data/test/{sequences_test.rb → sequences_tests.rb} +10 -10
  34. data/test/{tables_test.rb → tables_tests.rb} +2 -2
  35. data/test/text_search_tests.rb +263 -0
  36. metadata +19 -16
  37. data/postgresql-extensions.gemspec +0 -50
@@ -28,7 +28,7 @@ class FunctionsTests < Test::Unit::TestCase
28
28
  %{CREATE FUNCTION "test"(integer) RETURNS integer AS $$
29
29
  select 10;
30
30
  $$
31
- LANGUAGE "sql"},
31
+ LANGUAGE "sql";},
32
32
 
33
33
  %{CREATE OR REPLACE FUNCTION "test"(integer) RETURNS integer AS $__$
34
34
  return 10;
@@ -38,7 +38,7 @@ LANGUAGE "sql"
38
38
  STRICT
39
39
  COST 1
40
40
  ROWS 10
41
- SET TIME ZONE "America/Halifax"}
41
+ SET TIME ZONE "America/Halifax";}
42
42
  ], statements)
43
43
  end
44
44
 
@@ -47,8 +47,8 @@ LANGUAGE "sql"
47
47
  ARBC.drop_function(:test, :integer, :if_exists => true, :cascade => true)
48
48
 
49
49
  assert_equal([
50
- "DROP FUNCTION \"test\"(integer)",
51
- "DROP FUNCTION IF EXISTS \"test\"(integer) CASCADE"
50
+ "DROP FUNCTION \"test\"(integer);",
51
+ "DROP FUNCTION IF EXISTS \"test\"(integer) CASCADE;"
52
52
  ], statements)
53
53
  end
54
54
 
@@ -56,7 +56,7 @@ LANGUAGE "sql"
56
56
  ARBC.rename_function(:test, 'integer, text', :foo)
57
57
 
58
58
  assert_equal([
59
- "ALTER FUNCTION \"test\"(integer, text) RENAME TO \"foo\""
59
+ "ALTER FUNCTION \"test\"(integer, text) RENAME TO \"foo\";"
60
60
  ], statements)
61
61
  end
62
62
 
@@ -64,7 +64,7 @@ LANGUAGE "sql"
64
64
  ARBC.alter_function_owner(:test, 'integer, text', :admin)
65
65
 
66
66
  assert_equal([
67
- "ALTER FUNCTION \"test\"(integer, text) OWNER TO \"admin\""
67
+ "ALTER FUNCTION \"test\"(integer, text) OWNER TO \"admin\";"
68
68
  ], statements)
69
69
  end
70
70
 
@@ -72,7 +72,7 @@ LANGUAGE "sql"
72
72
  ARBC.alter_function_schema(:test, 'integer, text', :geospatial)
73
73
 
74
74
  assert_equal([
75
- "ALTER FUNCTION \"test\"(integer, text) SET SCHEMA \"geospatial\""
75
+ "ALTER FUNCTION \"test\"(integer, text) SET SCHEMA \"geospatial\";"
76
76
  ], statements)
77
77
  end
78
78
 
@@ -95,8 +95,8 @@ LANGUAGE "sql"
95
95
  end
96
96
 
97
97
  assert_equal([
98
- %{ALTER FUNCTION "my_function"(integer) RENAME TO "another_function"},
99
- %{ALTER FUNCTION "another_function"(integer) OWNER TO "jdoe"},
98
+ %{ALTER FUNCTION "my_function"(integer) RENAME TO "another_function";},
99
+ %{ALTER FUNCTION "another_function"(integer) OWNER TO "jdoe";},
100
100
  %{ALTER FUNCTION "my_function"(integer) RENAME TO "another_function";
101
101
  ALTER FUNCTION "another_function"(integer) OWNER TO "jdoe";
102
102
  ALTER FUNCTION "another_function"(integer) SET SCHEMA "foo";
@@ -106,7 +106,7 @@ ALTER FUNCTION "another_function"(integer) COST 10;
106
106
  ALTER FUNCTION "another_function"(integer) ROWS 10;
107
107
  ALTER FUNCTION "another_function"(integer) SET "log_duration" TO "0.4";
108
108
  ALTER FUNCTION "another_function"(integer) RESET ALL;
109
- ALTER FUNCTION "another_function"(integer) RESET "debug_assertions" RESET "trace_notify"}
109
+ ALTER FUNCTION "another_function"(integer) RESET "debug_assertions" RESET "trace_notify";}
110
110
  ], statements)
111
111
  end
112
112
  end
@@ -16,10 +16,10 @@ class GeometryTests < Test::Unit::TestCase
16
16
  "the_geom" geometry,
17
17
  CONSTRAINT "enforce_srid_the_geom" CHECK (srid("the_geom") = (4326)),
18
18
  CONSTRAINT "enforce_dims_the_geom" CHECK (ndims("the_geom") = 2)
19
- )},
20
- %{DELETE FROM "geometry_columns" WHERE f_table_catalog = '' AND f_table_schema = 'public' AND f_table_name = 'foo' AND f_geometry_column = 'the_geom'},
21
- %{INSERT INTO "geometry_columns" VALUES ('', 'public', 'foo', 'the_geom', 2, 4326, 'GEOMETRY')},
22
- %{CREATE INDEX "foo_the_geom_gist_index" ON "foo" USING "gist"("the_geom")}
19
+ );},
20
+ %{DELETE FROM "geometry_columns" WHERE f_table_catalog = '' AND f_table_schema = 'public' AND f_table_name = 'foo' AND f_geometry_column = 'the_geom';},
21
+ %{INSERT INTO "geometry_columns" VALUES ('', 'public', 'foo', 'the_geom', 2, 4326, 'GEOMETRY');},
22
+ %{CREATE INDEX "foo_the_geom_gist_index" ON "foo" USING "gist"("the_geom");}
23
23
  ], statements)
24
24
  end
25
25
 
@@ -34,10 +34,10 @@ class GeometryTests < Test::Unit::TestCase
34
34
  "the_geom" geometry,
35
35
  CONSTRAINT "enforce_srid_the_geom" CHECK (srid("the_geom") = (4326)),
36
36
  CONSTRAINT "enforce_dims_the_geom" CHECK (ndims("the_geom") = 2)
37
- )},
38
- %{DELETE FROM "geometry_columns" WHERE f_table_catalog = '' AND f_table_schema = 'public' AND f_table_name = 'foo' AND f_geometry_column = 'the_geom'},
39
- %{INSERT INTO "geometry_columns" VALUES ('', 'public', 'foo', 'the_geom', 2, 4326, 'GEOMETRY')},
40
- %{CREATE INDEX "foo_the_geom_gist_index" ON "foo" USING "gist"("the_geom")}
37
+ );},
38
+ %{DELETE FROM "geometry_columns" WHERE f_table_catalog = '' AND f_table_schema = 'public' AND f_table_name = 'foo' AND f_geometry_column = 'the_geom';},
39
+ %{INSERT INTO "geometry_columns" VALUES ('', 'public', 'foo', 'the_geom', 2, 4326, 'GEOMETRY');},
40
+ %{CREATE INDEX "foo_the_geom_gist_index" ON "foo" USING "gist"("the_geom");}
41
41
  ], statements)
42
42
  end
43
43
 
@@ -52,10 +52,10 @@ class GeometryTests < Test::Unit::TestCase
52
52
  "the_geom" geometry NOT NULL,
53
53
  CONSTRAINT "enforce_srid_the_geom" CHECK (srid("the_geom") = (4326)),
54
54
  CONSTRAINT "enforce_dims_the_geom" CHECK (ndims("the_geom") = 2)
55
- )},
56
- %{DELETE FROM "geometry_columns" WHERE f_table_catalog = '' AND f_table_schema = 'public' AND f_table_name = 'foo' AND f_geometry_column = 'the_geom'},
57
- %{INSERT INTO "geometry_columns" VALUES ('', 'public', 'foo', 'the_geom', 2, 4326, 'GEOMETRY')},
58
- %{CREATE INDEX "foo_the_geom_gist_index" ON "foo" USING "gist"("the_geom")}
55
+ );},
56
+ %{DELETE FROM "geometry_columns" WHERE f_table_catalog = '' AND f_table_schema = 'public' AND f_table_name = 'foo' AND f_geometry_column = 'the_geom';},
57
+ %{INSERT INTO "geometry_columns" VALUES ('', 'public', 'foo', 'the_geom', 2, 4326, 'GEOMETRY');},
58
+ %{CREATE INDEX "foo_the_geom_gist_index" ON "foo" USING "gist"("the_geom");}
59
59
  ], statements)
60
60
  end
61
61
 
@@ -71,10 +71,10 @@ class GeometryTests < Test::Unit::TestCase
71
71
  CONSTRAINT "enforce_srid_the_geom" CHECK (srid("the_geom") = (4326)),
72
72
  CONSTRAINT "enforce_dims_the_geom" CHECK (ndims("the_geom") = 2),
73
73
  CONSTRAINT "enforce_geotype_the_geom" CHECK (geometrytype("the_geom") = 'POLYGON'::text OR "the_geom" IS NULL)
74
- )},
75
- %{DELETE FROM "geometry_columns" WHERE f_table_catalog = '' AND f_table_schema = 'public' AND f_table_name = 'foo' AND f_geometry_column = 'the_geom'},
76
- %{INSERT INTO "geometry_columns" VALUES ('', 'public', 'foo', 'the_geom', 2, 4326, 'POLYGON')},
77
- %{CREATE INDEX "foo_the_geom_gist_index" ON "foo" USING "gist"("the_geom")}
74
+ );},
75
+ %{DELETE FROM "geometry_columns" WHERE f_table_catalog = '' AND f_table_schema = 'public' AND f_table_name = 'foo' AND f_geometry_column = 'the_geom';},
76
+ %{INSERT INTO "geometry_columns" VALUES ('', 'public', 'foo', 'the_geom', 2, 4326, 'POLYGON');},
77
+ %{CREATE INDEX "foo_the_geom_gist_index" ON "foo" USING "gist"("the_geom");}
78
78
  ], statements)
79
79
  end
80
80
  end
@@ -29,12 +29,12 @@ class IndexTests < Test::Unit::TestCase
29
29
  })
30
30
 
31
31
  assert_equal([
32
- "CREATE INDEX \"foo_names_idx\" ON \"foo\"(\"first_name\", \"last_name\")",
33
- "CREATE INDEX \"foo_bar_id_idx\" ON \"foo\"(\"bar_id\")",
34
- "CREATE INDEX \"foo_coalesce_bar_id_idx\" ON \"foo\"((COALESCE(bar_id, 0)))",
35
- "CREATE INDEX \"foo_search_idx\" ON \"foo\" USING \"gin\"(\"search\")",
36
- "CREATE INDEX \"foo_names_idx\" ON \"foo\"(\"name\" \"text_pattern_ops\")",
37
- "CREATE UNIQUE INDEX CONCURRENTLY \"foo_bar_id_idx\" ON \"foo\"(\"bar_id\" ASC NULLS LAST) WITH (FILLFACTOR = 10) TABLESPACE \"fubar\" WHERE bar_id IS NOT NULL"
32
+ "CREATE INDEX \"foo_names_idx\" ON \"foo\"(\"first_name\", \"last_name\");",
33
+ "CREATE INDEX \"foo_bar_id_idx\" ON \"foo\"(\"bar_id\");",
34
+ "CREATE INDEX \"foo_coalesce_bar_id_idx\" ON \"foo\"((COALESCE(bar_id, 0)));",
35
+ "CREATE INDEX \"foo_search_idx\" ON \"foo\" USING \"gin\"(\"search\");",
36
+ "CREATE INDEX \"foo_names_idx\" ON \"foo\"(\"name\" \"text_pattern_ops\");",
37
+ "CREATE UNIQUE INDEX CONCURRENTLY \"foo_bar_id_idx\" ON \"foo\"(\"bar_id\" ASC NULLS LAST) WITH (FILLFACTOR = 10) TABLESPACE \"fubar\" WHERE bar_id IS NOT NULL;"
38
38
  ], statements)
39
39
  end
40
40
 
@@ -44,9 +44,9 @@ class IndexTests < Test::Unit::TestCase
44
44
  Mig.drop_index(:foo_names_idx, :cascade => true)
45
45
 
46
46
  assert_equal([
47
- "DROP INDEX \"foo_names_idx\"",
48
- "DROP INDEX IF EXISTS \"foo_names_idx\"",
49
- "DROP INDEX \"foo_names_idx\" CASCADE"
47
+ "DROP INDEX \"foo_names_idx\";",
48
+ "DROP INDEX IF EXISTS \"foo_names_idx\";",
49
+ "DROP INDEX \"foo_names_idx\" CASCADE;"
50
50
  ], statements)
51
51
  end
52
52
 
@@ -54,7 +54,7 @@ class IndexTests < Test::Unit::TestCase
54
54
  Mig.rename_index(:foo_names_idx, :foo_renamed_idx)
55
55
 
56
56
  assert_equal([
57
- "ALTER INDEX \"foo_names_idx\" RENAME TO \"foo_renamed_idx\""
57
+ "ALTER INDEX \"foo_names_idx\" RENAME TO \"foo_renamed_idx\";"
58
58
  ], statements)
59
59
  end
60
60
 
@@ -62,7 +62,7 @@ class IndexTests < Test::Unit::TestCase
62
62
  Mig.alter_index_tablespace(:foo_names_idx, :fubar)
63
63
 
64
64
  assert_equal([
65
- "ALTER INDEX \"foo_names_idx\" SET TABLESPACE \"fubar\""
65
+ "ALTER INDEX \"foo_names_idx\" SET TABLESPACE \"fubar\";"
66
66
  ], statements)
67
67
  end
68
68
  end
@@ -15,8 +15,8 @@ class LanguagesTests < Test::Unit::TestCase
15
15
  )
16
16
 
17
17
  assert_equal([
18
- "CREATE PROCEDURAL LANGUAGE \"foo\"",
19
- "CREATE TRUSTED PROCEDURAL LANGUAGE \"foo\" HANDLER \"plpgsql\" VALIDATOR test()"
18
+ "CREATE PROCEDURAL LANGUAGE \"foo\";",
19
+ "CREATE TRUSTED PROCEDURAL LANGUAGE \"foo\" HANDLER \"plpgsql\" VALIDATOR test();"
20
20
  ], statements)
21
21
  end
22
22
 
@@ -25,8 +25,8 @@ class LanguagesTests < Test::Unit::TestCase
25
25
  ARBC.drop_language(:foo, :if_exists => true, :cascade => true)
26
26
 
27
27
  assert_equal([
28
- "DROP PROCEDURAL LANGUAGE \"foo\"",
29
- "DROP PROCEDURAL LANGUAGE IF EXISTS \"foo\" CASCADE"
28
+ "DROP PROCEDURAL LANGUAGE \"foo\";",
29
+ "DROP PROCEDURAL LANGUAGE IF EXISTS \"foo\" CASCADE;"
30
30
  ], statements)
31
31
  end
32
32
 
@@ -34,7 +34,7 @@ class LanguagesTests < Test::Unit::TestCase
34
34
  ARBC.alter_language_name(:foo, :bar)
35
35
 
36
36
  assert_equal([
37
- "ALTER PROCEDURAL LANGUAGE \"foo\" RENAME TO \"bar\""
37
+ "ALTER PROCEDURAL LANGUAGE \"foo\" RENAME TO \"bar\";"
38
38
  ], statements)
39
39
  end
40
40
 
@@ -42,7 +42,7 @@ class LanguagesTests < Test::Unit::TestCase
42
42
  ARBC.alter_language_owner(:foo, :bar)
43
43
 
44
44
  assert_equal([
45
- "ALTER PROCEDURAL LANGUAGE \"foo\" OWNER TO \"bar\""
45
+ "ALTER PROCEDURAL LANGUAGE \"foo\" OWNER TO \"bar\";"
46
46
  ], statements)
47
47
  end
48
48
  end
@@ -13,11 +13,11 @@ class PermissionsTests < Test::Unit::TestCase
13
13
  Mig.grant_table_privileges(:foo, :select, :public, :cascade => true)
14
14
 
15
15
  assert_equal([
16
- "GRANT SELECT ON TABLE \"foo\" TO \"nobody\"",
17
- "GRANT SELECT, UPDATE, DELETE, INSERT ON TABLE \"foo\" TO \"nobody\", \"somebody\"",
18
- "GRANT SELECT ON TABLE \"foo\" TO \"nobody\" WITH GRANT OPTION",
19
- "GRANT SELECT ON TABLE \"foo\" TO \"nobody\"",
20
- "GRANT SELECT ON TABLE \"foo\" TO PUBLIC"
16
+ "GRANT SELECT ON TABLE \"foo\" TO \"nobody\";",
17
+ "GRANT SELECT, UPDATE, DELETE, INSERT ON TABLE \"foo\" TO \"nobody\", \"somebody\";",
18
+ "GRANT SELECT ON TABLE \"foo\" TO \"nobody\" WITH GRANT OPTION;",
19
+ "GRANT SELECT ON TABLE \"foo\" TO \"nobody\";",
20
+ "GRANT SELECT ON TABLE \"foo\" TO PUBLIC;"
21
21
  ], statements)
22
22
  end
23
23
 
@@ -29,11 +29,11 @@ class PermissionsTests < Test::Unit::TestCase
29
29
  Mig.revoke_table_privileges(:foo, :select, :public, :cascade => true)
30
30
 
31
31
  assert_equal([
32
- "REVOKE SELECT ON TABLE \"foo\" FROM \"nobody\"",
33
- "REVOKE SELECT, UPDATE, DELETE, INSERT ON TABLE \"foo\" FROM \"nobody\", \"somebody\"",
34
- "REVOKE SELECT ON TABLE \"foo\" FROM \"nobody\"",
35
- "REVOKE SELECT ON TABLE \"foo\" FROM \"nobody\" CASCADE",
36
- "REVOKE SELECT ON TABLE \"foo\" FROM PUBLIC CASCADE"
32
+ "REVOKE SELECT ON TABLE \"foo\" FROM \"nobody\";",
33
+ "REVOKE SELECT, UPDATE, DELETE, INSERT ON TABLE \"foo\" FROM \"nobody\", \"somebody\";",
34
+ "REVOKE SELECT ON TABLE \"foo\" FROM \"nobody\";",
35
+ "REVOKE SELECT ON TABLE \"foo\" FROM \"nobody\" CASCADE;",
36
+ "REVOKE SELECT ON TABLE \"foo\" FROM PUBLIC CASCADE;"
37
37
  ], statements)
38
38
  end
39
39
 
@@ -42,8 +42,8 @@ class PermissionsTests < Test::Unit::TestCase
42
42
  Mig.grant_sequence_privileges(:foo, [ :select, :update ], [ :nobody, :somebody ])
43
43
 
44
44
  assert_equal([
45
- "GRANT SELECT ON SEQUENCE \"foo\" TO \"nobody\"",
46
- "GRANT SELECT, UPDATE ON SEQUENCE \"foo\" TO \"nobody\", \"somebody\""
45
+ "GRANT SELECT ON SEQUENCE \"foo\" TO \"nobody\";",
46
+ "GRANT SELECT, UPDATE ON SEQUENCE \"foo\" TO \"nobody\", \"somebody\";"
47
47
  ], statements)
48
48
  end
49
49
 
@@ -52,8 +52,8 @@ class PermissionsTests < Test::Unit::TestCase
52
52
  Mig.revoke_sequence_privileges(:foo, [ :select, :update ], [ :nobody, :somebody ])
53
53
 
54
54
  assert_equal([
55
- "REVOKE SELECT ON SEQUENCE \"foo\" FROM \"nobody\"",
56
- "REVOKE SELECT, UPDATE ON SEQUENCE \"foo\" FROM \"nobody\", \"somebody\""
55
+ "REVOKE SELECT ON SEQUENCE \"foo\" FROM \"nobody\";",
56
+ "REVOKE SELECT, UPDATE ON SEQUENCE \"foo\" FROM \"nobody\", \"somebody\";"
57
57
  ], statements)
58
58
  end
59
59
 
@@ -62,8 +62,8 @@ class PermissionsTests < Test::Unit::TestCase
62
62
  Mig.grant_function_privileges('test(text, integer)', :all, [ :nobody, :somebody ])
63
63
 
64
64
  assert_equal([
65
- "GRANT EXECUTE ON FUNCTION test(text, integer) TO \"nobody\"",
66
- "GRANT ALL ON FUNCTION test(text, integer) TO \"nobody\", \"somebody\""
65
+ "GRANT EXECUTE ON FUNCTION test(text, integer) TO \"nobody\";",
66
+ "GRANT ALL ON FUNCTION test(text, integer) TO \"nobody\", \"somebody\";"
67
67
  ], statements)
68
68
  end
69
69
 
@@ -72,8 +72,8 @@ class PermissionsTests < Test::Unit::TestCase
72
72
  Mig.revoke_function_privileges('test(text, integer)', :all, [ :nobody, :somebody ])
73
73
 
74
74
  assert_equal([
75
- "REVOKE EXECUTE ON FUNCTION test(text, integer) FROM \"nobody\"",
76
- "REVOKE ALL ON FUNCTION test(text, integer) FROM \"nobody\", \"somebody\""
75
+ "REVOKE EXECUTE ON FUNCTION test(text, integer) FROM \"nobody\";",
76
+ "REVOKE ALL ON FUNCTION test(text, integer) FROM \"nobody\", \"somebody\";"
77
77
  ], statements)
78
78
  end
79
79
 
@@ -82,8 +82,8 @@ class PermissionsTests < Test::Unit::TestCase
82
82
  Mig.grant_language_privileges('plpgsql', :all, [ :nobody, :somebody ])
83
83
 
84
84
  assert_equal([
85
- "GRANT USAGE ON LANGUAGE \"plpgsql\" TO \"nobody\"",
86
- "GRANT ALL ON LANGUAGE \"plpgsql\" TO \"nobody\", \"somebody\""
85
+ "GRANT USAGE ON LANGUAGE \"plpgsql\" TO \"nobody\";",
86
+ "GRANT ALL ON LANGUAGE \"plpgsql\" TO \"nobody\", \"somebody\";"
87
87
  ], statements)
88
88
  end
89
89
 
@@ -92,8 +92,8 @@ class PermissionsTests < Test::Unit::TestCase
92
92
  Mig.revoke_language_privileges('plpgsql', :all, [ :nobody, :somebody ])
93
93
 
94
94
  assert_equal([
95
- "REVOKE USAGE ON LANGUAGE \"plpgsql\" FROM \"nobody\"",
96
- "REVOKE ALL ON LANGUAGE \"plpgsql\" FROM \"nobody\", \"somebody\""
95
+ "REVOKE USAGE ON LANGUAGE \"plpgsql\" FROM \"nobody\";",
96
+ "REVOKE ALL ON LANGUAGE \"plpgsql\" FROM \"nobody\", \"somebody\";"
97
97
  ], statements)
98
98
  end
99
99
 
@@ -102,8 +102,8 @@ class PermissionsTests < Test::Unit::TestCase
102
102
  Mig.grant_schema_privileges(:foo, :all, [ :nobody, :somebody ])
103
103
 
104
104
  assert_equal([
105
- "GRANT USAGE ON SCHEMA \"foo\" TO \"nobody\"",
106
- "GRANT ALL ON SCHEMA \"foo\" TO \"nobody\", \"somebody\""
105
+ "GRANT USAGE ON SCHEMA \"foo\" TO \"nobody\";",
106
+ "GRANT ALL ON SCHEMA \"foo\" TO \"nobody\", \"somebody\";"
107
107
  ], statements)
108
108
  end
109
109
 
@@ -112,8 +112,8 @@ class PermissionsTests < Test::Unit::TestCase
112
112
  Mig.revoke_schema_privileges(:foo, :all, [ :nobody, :somebody ])
113
113
 
114
114
  assert_equal([
115
- "REVOKE USAGE ON SCHEMA \"foo\" FROM \"nobody\"",
116
- "REVOKE ALL ON SCHEMA \"foo\" FROM \"nobody\", \"somebody\""
115
+ "REVOKE USAGE ON SCHEMA \"foo\" FROM \"nobody\";",
116
+ "REVOKE ALL ON SCHEMA \"foo\" FROM \"nobody\", \"somebody\";"
117
117
  ], statements)
118
118
  end
119
119
 
@@ -122,8 +122,8 @@ class PermissionsTests < Test::Unit::TestCase
122
122
  Mig.grant_tablespace_privileges(:foo, :all, [ :nobody, :somebody ])
123
123
 
124
124
  assert_equal([
125
- "GRANT CREATE ON TABLESPACE \"foo\" TO \"nobody\"",
126
- "GRANT ALL ON TABLESPACE \"foo\" TO \"nobody\", \"somebody\""
125
+ "GRANT CREATE ON TABLESPACE \"foo\" TO \"nobody\";",
126
+ "GRANT ALL ON TABLESPACE \"foo\" TO \"nobody\", \"somebody\";"
127
127
  ], statements)
128
128
  end
129
129
 
@@ -132,8 +132,8 @@ class PermissionsTests < Test::Unit::TestCase
132
132
  Mig.revoke_tablespace_privileges(:foo, :all, [ :nobody, :somebody ])
133
133
 
134
134
  assert_equal([
135
- "REVOKE CREATE ON TABLESPACE \"foo\" FROM \"nobody\"",
136
- "REVOKE ALL ON TABLESPACE \"foo\" FROM \"nobody\", \"somebody\""
135
+ "REVOKE CREATE ON TABLESPACE \"foo\" FROM \"nobody\";",
136
+ "REVOKE ALL ON TABLESPACE \"foo\" FROM \"nobody\", \"somebody\";"
137
137
  ], statements)
138
138
  end
139
139
 
@@ -143,9 +143,9 @@ class PermissionsTests < Test::Unit::TestCase
143
143
  Mig.grant_role_membership(:foo, [ :nobody, :somebody ], :with_admin_option => true)
144
144
 
145
145
  assert_equal([
146
- "GRANT \"foo\" TO \"nobody\"",
147
- "GRANT \"foo\" TO \"nobody\", \"somebody\"",
148
- "GRANT \"foo\" TO \"nobody\", \"somebody\" WITH ADMIN OPTION"
146
+ "GRANT \"foo\" TO \"nobody\";",
147
+ "GRANT \"foo\" TO \"nobody\", \"somebody\";",
148
+ "GRANT \"foo\" TO \"nobody\", \"somebody\" WITH ADMIN OPTION;"
149
149
  ], statements)
150
150
  end
151
151
 
@@ -155,9 +155,9 @@ class PermissionsTests < Test::Unit::TestCase
155
155
  Mig.revoke_role_membership(:foo, [ :nobody, :somebody ], :with_admin_option => true)
156
156
 
157
157
  assert_equal([
158
- "REVOKE \"foo\" FROM \"nobody\"",
159
- "REVOKE \"foo\" FROM \"nobody\", \"somebody\"",
160
- "REVOKE \"foo\" FROM \"nobody\", \"somebody\""
158
+ "REVOKE \"foo\" FROM \"nobody\";",
159
+ "REVOKE \"foo\" FROM \"nobody\", \"somebody\";",
160
+ "REVOKE \"foo\" FROM \"nobody\", \"somebody\";"
161
161
  ], statements)
162
162
  end
163
163
  end
@@ -23,8 +23,8 @@ class RolesTests < Test::Unit::TestCase
23
23
  })
24
24
 
25
25
  assert_equal([
26
- 'CREATE ROLE "foo"',
27
- %{CREATE ROLE "foo" SUPERUSER CREATEDB CREATEROLE NOINHERIT LOGIN CONNECTION LIMIT 10 ENCRYPTED PASSWORD 'testing' VALID UNTIL '2011-10-12' IN ROLE "bar" ROLE "baz" ADMIN "blort"}
26
+ 'CREATE ROLE "foo";',
27
+ %{CREATE ROLE "foo" SUPERUSER CREATEDB CREATEROLE NOINHERIT LOGIN CONNECTION LIMIT 10 ENCRYPTED PASSWORD 'testing' VALID UNTIL '2011-10-12' IN ROLE "bar" ROLE "baz" ADMIN "blort";}
28
28
  ], statements)
29
29
  end
30
30
 
@@ -45,7 +45,7 @@ class RolesTests < Test::Unit::TestCase
45
45
  })
46
46
 
47
47
  assert_equal([
48
- %{ALTER ROLE "foo" SUPERUSER CREATEDB CREATEROLE NOINHERIT LOGIN CONNECTION LIMIT 10 ENCRYPTED PASSWORD 'testing' VALID UNTIL '2011-10-12' IN ROLE "bar" ROLE "baz" ADMIN "blort"}
48
+ %{ALTER ROLE "foo" SUPERUSER CREATEDB CREATEROLE NOINHERIT LOGIN CONNECTION LIMIT 10 ENCRYPTED PASSWORD 'testing' VALID UNTIL '2011-10-12' IN ROLE "bar" ROLE "baz" ADMIN "blort";}
49
49
  ], statements)
50
50
  end
51
51
 
@@ -55,9 +55,9 @@ class RolesTests < Test::Unit::TestCase
55
55
  ARBC.drop_role(%w{ foo bar baz }, :if_exists => true)
56
56
 
57
57
  assert_equal([
58
- 'DROP ROLE "foo"',
59
- 'DROP ROLE "foo", "bar", "baz"',
60
- 'DROP ROLE IF EXISTS "foo", "bar", "baz"',
58
+ 'DROP ROLE "foo";',
59
+ 'DROP ROLE "foo", "bar", "baz";',
60
+ 'DROP ROLE IF EXISTS "foo", "bar", "baz";',
61
61
  ], statements)
62
62
  end
63
63
  end
@@ -17,8 +17,8 @@ class RulesTests < Test::Unit::TestCase
17
17
  )
18
18
 
19
19
  assert_equal([
20
- "CREATE RULE \"ignore_root\" AS ON UPDATE TO \"users\" WHERE user_id = 0 DO INSTEAD NOTHING",
21
- "CREATE OR REPLACE RULE \"ignore_root\" AS ON UPDATE TO \"users\" WHERE user_id > 0 DO INSTEAD SELECT * FROM non_admins"
20
+ "CREATE RULE \"ignore_root\" AS ON UPDATE TO \"users\" WHERE user_id = 0 DO INSTEAD NOTHING;",
21
+ "CREATE OR REPLACE RULE \"ignore_root\" AS ON UPDATE TO \"users\" WHERE user_id > 0 DO INSTEAD SELECT * FROM non_admins;"
22
22
  ], statements)
23
23
  end
24
24
 
@@ -26,7 +26,7 @@ class RulesTests < Test::Unit::TestCase
26
26
  ARBC.drop_rule(:foo, :bar)
27
27
 
28
28
  assert_equal([
29
- "DROP RULE \"foo\" ON \"bar\"",
29
+ "DROP RULE \"foo\" ON \"bar\";",
30
30
  ], statements)
31
31
  end
32
32
  end
@@ -10,8 +10,8 @@ class SchemasTests < Test::Unit::TestCase
10
10
  Mig.create_schema(:foo, :authorization => 'bar')
11
11
 
12
12
  assert_equal([
13
- "CREATE SCHEMA \"foo\"",
14
- "CREATE SCHEMA \"foo\" AUTHORIZATION \"bar\""
13
+ "CREATE SCHEMA \"foo\";",
14
+ "CREATE SCHEMA \"foo\" AUTHORIZATION \"bar\";"
15
15
  ], statements)
16
16
  end
17
17
 
@@ -20,8 +20,8 @@ class SchemasTests < Test::Unit::TestCase
20
20
  Mig.drop_schema(:foo, :if_exists => true, :cascade => true)
21
21
 
22
22
  assert_equal([
23
- "DROP SCHEMA \"foo\"",
24
- "DROP SCHEMA IF EXISTS \"foo\" CASCADE"
23
+ "DROP SCHEMA \"foo\";",
24
+ "DROP SCHEMA IF EXISTS \"foo\" CASCADE;"
25
25
  ], statements)
26
26
  end
27
27
 
@@ -29,7 +29,7 @@ class SchemasTests < Test::Unit::TestCase
29
29
  Mig.alter_schema_name(:foo, :bar)
30
30
 
31
31
  assert_equal([
32
- "ALTER SCHEMA \"foo\" RENAME TO \"bar\""
32
+ "ALTER SCHEMA \"foo\" RENAME TO \"bar\";"
33
33
  ], statements)
34
34
  end
35
35
 
@@ -37,7 +37,7 @@ class SchemasTests < Test::Unit::TestCase
37
37
  Mig.alter_schema_owner(:foo, :bar)
38
38
 
39
39
  assert_equal([
40
- "ALTER SCHEMA \"foo\" OWNER TO \"bar\""
40
+ "ALTER SCHEMA \"foo\" OWNER TO \"bar\";"
41
41
  ], statements)
42
42
  end
43
43
  end