aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorYannick Schutz <yannick.schutz@gmail.com>2018-07-27 03:09:00 +0200
committerRyuta Kamizono <kamipo@gmail.com>2018-07-27 10:09:00 +0900
commit36f28fd8184a999f82bd8b0388e31798bd856ae0 (patch)
treeca844634a01fa7be91aa0f974c080be19858a076 /activerecord/test/cases
parentb4d91bb41f9cc555d80d0cb6b0a41179d26fa252 (diff)
downloadrails-36f28fd8184a999f82bd8b0388e31798bd856ae0.tar.gz
rails-36f28fd8184a999f82bd8b0388e31798bd856ae0.tar.bz2
rails-36f28fd8184a999f82bd8b0388e31798bd856ae0.zip
PostgreSQL 10 new relkind for partitioned tables (#31336)
* PostgreSQL 10 new relkind for partitioned tables Starting with PostgreSQL 10, we can now have partitioned tables natively * Add comment * Remove extra space * Add test for partition table in postgreSQL10 * Select 'p' for "BASE TABLE" and add a test case to support PostgreSQL 10 partition tables * Address RuboCop offense * Addressed incorrect `postgresql_version` Fixes #33008. [Yannick Schutz & Yasuo Honda & Ryuta Kamizono]
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/adapters/postgresql/partitions_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/partitions_test.rb b/activerecord/test/cases/adapters/postgresql/partitions_test.rb
new file mode 100644
index 0000000000..0ac9ca1200
--- /dev/null
+++ b/activerecord/test/cases/adapters/postgresql/partitions_test.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+require "cases/helper"
+
+class PostgreSQLPartitionsTest < ActiveRecord::PostgreSQLTestCase
+ def setup
+ @connection = ActiveRecord::Base.connection
+ end
+
+ def teardown
+ @connection.drop_table "partitioned_events", if_exists: true
+ end
+
+ def test_partitions_table_exists
+ skip unless ActiveRecord::Base.connection.postgresql_version >= 100000
+ @connection.create_table :partitioned_events, force: true, id: false,
+ options: "partition by range (issued_at)" do |t|
+ t.timestamp :issued_at
+ end
+ assert @connection.table_exists?("partitioned_events")
+ end
+end