repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/foreign_keys/drop_foreign_key_spec.rb | spec/operations/foreign_keys/drop_foreign_key_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#drop_foreign_key" do
before_all do
run_migration <<~RUBY
create_table :roles do |t|
t.string :name, index: { unique: true }
end
create_table :users do |t|
t.string :role
end
RUBY
end
context "when ... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/composite_types/create_composite_type_spec.rb | spec/operations/composite_types/create_composite_type_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#create_composite_type" do
before_all { run_migration "create_schema :paint" }
context "with a full definition" do
let(:migration) do
<<~RUBY
create_composite_type "paint.colored_point" do |t|
t.column "x", "integer"
... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/composite_types/drop_composite_type_spec.rb | spec/operations/composite_types/drop_composite_type_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#drop_composite_type" do
before_all { run_migration "create_schema :paint" }
before { run_migration(snippet) }
let(:snippet) do
<<~RUBY
create_composite_type "paint.colored_point" do |t|
t.column "x", "integer"
t.column "... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/composite_types/change_composite_type_spec.rb | spec/operations/composite_types/change_composite_type_spec.rb | # frozen_string_literal: true
# frozen_text_literal: true
describe ActiveRecord::Migration, "#change_composite_type" do
before_all { run_migration "create_schema :paint" }
before { run_migration(old_snippet) }
let(:old_snippet) do
<<~RUBY
create_composite_type "paint.colored_point" do |t|
t.c... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/composite_types/rename_composite_type_spec.rb | spec/operations/composite_types/rename_composite_type_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#rename_composite_type" do
before_all { run_migration "create_schema :paint" }
before { run_migration(old_snippet) }
let(:old_snippet) do
<<~RUBY
create_composite_type "paint.colored_point" do |t|
t.column "x", "integer"
... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/triggers/drop_trigger_spec.rb | spec/operations/triggers/drop_trigger_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#drop_trigger" do
before_all do
run_migration <<~RUBY
create_table "users", force: :cascade do |t|
t.string "name"
t.boolean "admin"
end
create_function "do_nothing() trigger" do |f|
f.language "plpgsql"
... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/triggers/rename_trigger_spec.rb | spec/operations/triggers/rename_trigger_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#rename_trigger" do
before_all do
run_migration <<~RUBY
create_table :foo
create_function "avoid() trigger", language: :plpgsql, body: "BEGIN END;"
RUBY
end
before { run_migration(old_snippet) }
context "when a trigger had an... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/triggers/change_trigger_spec.rb | spec/operations/triggers/change_trigger_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#change_trigger" do
before_all do
run_migration <<~RUBY
create_table "users", force: :cascade do |t|
t.string "name"
t.boolean "admin"
end
create_function "do_nothing() trigger" do |f|
f.language "plpgsql"... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/triggers/create_trigger_spec.rb | spec/operations/triggers/create_trigger_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#create_trigger" do
before_all do
run_migration <<~RUBY
create_table "users", force: :cascade do |t|
t.string "name"
t.boolean "admin"
end
create_function "do_nothing() trigger" do |f|
f.language "plpgsql"... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/rules/create_rule_spec.rb | spec/operations/rules/create_rule_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#create_rule" do
before_all do
run_migration <<~RUBY
create_table :users do |t|
t.string :name
end
create_table :user_updates do |t|
t.timestamps
end
RUBY
end
context "with a minimal definition" do
... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/rules/drop_rule_spec.rb | spec/operations/rules/drop_rule_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#drop_rule" do
before_all do
run_migration <<~RUBY
create_table :users do |t|
t.string :name
end
RUBY
end
before { run_migration(snippet) }
context "when a rule was named" do
let(:snippet) do
<<~RUBY
... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/rules/rename_rule_spec.rb | spec/operations/rules/rename_rule_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#rename_rule" do
before_all do
run_migration <<~RUBY
create_table :users do |t|
t.string :name
end
RUBY
end
before { run_migration(old_snippet) }
context "when a rule was named" do
let(:old_snippet) do
<<~RU... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/sequences/rename_sequence_spec.rb | spec/operations/sequences/rename_sequence_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#rename_sequence" do
before_all { run_migration "create_schema :seq" }
before { run_migration(old_snippet) }
let(:old_snippet) do
<<~RUBY
create_sequence "global_num" do |s|
s.increment_by 2
s.min_value 0
s.max_va... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/sequences/change_sequence_spec.rb | spec/operations/sequences/change_sequence_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#change_sequence" do
before { run_migration(old_snippet) }
let(:old_snippet) do
<<~RUBY
create_sequence "global_num", as: "integer" do |s|
s.increment_by 2
s.min_value 0
s.max_value 2000
s.start_with 1
... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/sequences/create_sequence_spec.rb | spec/operations/sequences/create_sequence_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#create_sequence" do
before_all do
run_migration <<~RUBY
create_schema :app
create_table :customers do |t|
t.bigint :global_num
end
RUBY
end
context "with a minimal definition" do
let(:migration) do
<<~... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/sequences/drop_sequence_spec.rb | spec/operations/sequences/drop_sequence_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#drop_sequence" do
before_all { run_migration("create_schema :app") }
before { run_migration(old_snippet) }
let(:old_snippet) do
<<~RUBY
create_sequence "app.global_num", as: "integer" do |s|
s.increment_by 2
s.min_value ... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/domains/rename_domain_spec.rb | spec/operations/domains/rename_domain_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#rename_domain" do
before_all { run_migration "create_schema :dict" }
before { run_migration(old_snippet) }
let(:old_snippet) do
<<~RUBY
create_domain "existing_string", as: "text" do |d|
d.null false
end
RUBY
end
l... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/domains/create_domain_spec.rb | spec/operations/domains/create_domain_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#create_domain" do
before_all { run_migration "create_schema :dict" }
context "with a full definition" do
let(:migration) do
<<~RUBY
create_domain "dict.us_postal_code", as: "text" do |d|
d.collation "en_US"
d.d... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/domains/change_domain_spec.rb | spec/operations/domains/change_domain_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#change_domain" do
before_all { run_migration "create_schema :dict" }
before { run_migration(old_snippet) }
let(:old_snippet) do
<<~RUBY
create_domain "dict.us_postal_code", as: "text" do |d|
d.collation "en_US"
d.default... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/domains/drop_domain_spec.rb | spec/operations/domains/drop_domain_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#drop_domain" do
before_all { run_migration "create_schema :dict" }
before { run_migration(snippet) }
let(:snippet) do
<<~RUBY
create_domain "dict.us_postal_code", as: "text" do |d|
d.collation "en_US"
d.default_sql "'000... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/views/drop_view_spec.rb | spec/operations/views/drop_view_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#drop_view" do
before_all do
run_migration <<~RUBY
create_table "users", force: :cascade do |t|
t.string "name"
t.boolean "admin"
end
create_table "weird"
RUBY
end
before { run_migration(snippet) }
let(... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/views/rename_view_spec.rb | spec/operations/views/rename_view_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#rename_view" do
before_all do
run_migration <<~RUBY
create_table :users do |t|
t.string :name
t.boolean :admin
end
RUBY
end
before { run_migration(old_snippet) }
let(:old_snippet) do
<<~RUBY
create_... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/views/change_view_spec.rb | spec/operations/views/change_view_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#change_view" do
before_all do
run_migration <<~RUBY
create_table "users", force: :cascade do |t|
t.string "name"
t.boolean "admin"
end
RUBY
end
before { run_migration(old_snippet) }
let(:old_snippet) do
<... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/views/create_view_spec.rb | spec/operations/views/create_view_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#create_view" do
before_all do
run_migration <<~RUBY
create_table "users", force: :cascade do |t|
t.string "name"
t.boolean "admin"
end
RUBY
end
# from /spec/dummy/db/views/admin_users_v01.sql
let(:snippet) do... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/materialized_views/create_materialized_view_spec.rb | spec/operations/materialized_views/create_materialized_view_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#create_materialized_view" do
before_all do
run_migration <<~RUBY
create_table "users", force: :cascade do |t|
t.string "name"
t.boolean "admin"
end
RUBY
end
let(:query) { "SELECT * FROM admin_users;" }
conte... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/materialized_views/rename_materialized_view_spec.rb | spec/operations/materialized_views/rename_materialized_view_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#rename_materialized_view" do
before_all do
run_migration <<~RUBY
create_table :users do |t|
t.string :name
t.boolean :admin
end
RUBY
end
before { run_migration(old_snippet) }
let(:old_snippet) do
<<~RUBY
... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/materialized_views/refresh_materialized_view_spec.rb | spec/operations/materialized_views/refresh_materialized_view_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#refresh_materialized_view" do
before_all do
run_migration <<~RUBY
create_table :users do |t|
t.string :name
t.boolean :admin
end
RUBY
end
before { run_migration(old_snippet) }
let(:query) { "SELECT * FROM adm... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/materialized_views/drop_materialized_view_spec.rb | spec/operations/materialized_views/drop_materialized_view_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#drop_materialized_view" do
before_all do
run_migration <<~RUBY
create_table "users", force: :cascade do |t|
t.string "name"
t.boolean "admin"
end
create_table "weird"
RUBY
end
before { run_migration(snipp... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/materialized_views/change_materialized_view_spec.rb | spec/operations/materialized_views/change_materialized_view_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#change_materialized_view" do
before_all do
run_migration <<~RUBY
create_table "users" do |t|
t.string "name"
t.boolean "admin"
end
RUBY
end
before do
run_migration <<~RUBY
create_materialized_view "ad... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/tables/create_table_spec.rb | spec/operations/tables/create_table_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#create_table" do
context "with indexes and check constraints" do
let(:migration) do
<<~RUBY
create_table :roles
create_table :users do |t|
t.integer :role_id, index: true
t.string :name
t.check_c... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/tables/rename_table_spec.rb | spec/operations/tables/rename_table_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#rename_table" do
let(:migration) do
<<~RUBY
create_table :roles
create_table :users do |t|
t.integer :role_id, index: true
t.string :name
t.foreign_key :roles
t.check_constraint "length(name) > 1"
... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/functions/rename_function_spec.rb | spec/operations/functions/rename_function_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#rename_function" do
before do
run_migration <<~RUBY
create_schema :math
RUBY
run_migration(old_snippet)
end
let(:new_snippet) do
<<~RUBY
create_function "math.multiply(a integer, b integer) integer" do |f|
f.b... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/functions/change_function_spec.rb | spec/operations/functions/change_function_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#change_function" do
before do
run_migration <<~RUBY
create_function "mult(a integer, b integer) integer" do |f|
f.volatility :immutable
f.body "SELECT a * b"
end
# Overload the function to ensure a proper one is ... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/functions/drop_function_spec.rb | spec/operations/functions/drop_function_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#drop_function" do
before { run_migration(snippet) }
let(:snippet) do
<<~RUBY
create_function "mult(a integer, b integer) integer" do |f|
f.body "SELECT a * b"
end
RUBY
end
let(:query) { "SELECT mult(6, 7);" }
cont... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/functions/create_function_spec.rb | spec/operations/functions/create_function_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#create_function" do
context "with a minimal definition" do
let(:migration) do
<<~RUBY
create_function "mult(a integer, b integer) integer", body: "SELECT a * b"
RUBY
end
let(:snippet) do
<<~RUBY
create_fun... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/check_constraints/rename_check_constraint_spec.rb | spec/operations/check_constraints/rename_check_constraint_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#rename_check_constraint" do
before_all do
run_migration <<~RUBY
create_table :users do |t|
t.string :name
end
RUBY
end
before { run_migration(old_snippet) }
context "when the constraint was anonymous" do
let(:old... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/check_constraints/add_check_constraint_spec.rb | spec/operations/check_constraints/add_check_constraint_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#add_check_constraint" do
before_all do
run_migration <<~RUBY
create_table "users" do |t|
t.string :name
end
RUBY
end
let(:valid_query) { "INSERT INTO users (name) VALUES ('xx');" }
# breaks the constraint 'length(n... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/check_constraints/drop_check_constraint_spec.rb | spec/operations/check_constraints/drop_check_constraint_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#drop_check_constraint" do
before_all do
run_migration <<~RUBY
create_table "users" do |t|
t.string :name
end
RUBY
end
# satisfy the constraint 'length(name) > 1'
let(:valid_query) { "INSERT INTO users (name) VALUES (... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/statistics/create_statistics_spec.rb | spec/operations/statistics/create_statistics_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#create_statistics" do
before_all do
run_migration <<~RUBY
create_table :users do |t|
t.string :name
t.string :family
end
RUBY
end
context "with an explicit name" do
let(:migration) do
<<~RUBY
... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/statistics/drop_statistics_spec.rb | spec/operations/statistics/drop_statistics_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#drop_statistics" do
before_all do
run_migration <<~RUBY
create_table :users do |t|
t.string :name
t.string :family
end
RUBY
end
before { run_migration(snippet) }
context "when the statistics was anonymous" do... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/statistics/rename_statistics_spec.rb | spec/operations/statistics/rename_statistics_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#rename_statistics" do
before_all do
run_migration <<~RUBY
create_table :users do |t|
t.string :name
t.string :family
end
RUBY
end
before { run_migration(old_snippet) }
context "when the constraint was anonymo... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/indexes/add_index_spec.rb | spec/operations/indexes/add_index_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#add_index" do
context "when index added inside a table definition" do
let(:migration) do
<<~RUBY
create_table :users do |t|
t.string "name", index: true
end
RUBY
end
let(:snippet) do
<<~RUBY
... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/procedures/rename_procedure_spec.rb | spec/operations/procedures/rename_procedure_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#rename_procedure", since_version: 11 do
before do
run_migration <<~RUBY
create_schema "meta"
create_procedure "set_foo(a int)", body: "SET custom.foo = a"
RUBY
end
let(:old_query) { "CALL set_foo(42);" }
let(:old_snippet) do... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/procedures/drop_procedure_spec.rb | spec/operations/procedures/drop_procedure_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#drop_procedure", since_version: 11 do
context "when a procedure was present" do
before { run_migration(snippet) }
let(:snippet) do
<<~RUBY
create_procedure "set_foo(a integer)" do |p|
p.body "SET custom.foo = a"
... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/procedures/change_procedure_spec.rb | spec/operations/procedures/change_procedure_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#change_procedure", since_version: 11 do
before do
run_migration <<~RUBY
create_procedure "set_foo(a integer)" do |p|
p.language "plpgsql"
p.body "BEGIN set custom.foo = a; END;"
p.comment "Set foo"
end
# ... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/procedures/create_procedure_spec.rb | spec/operations/procedures/create_procedure_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#create_procedure", since_version: 11 do
context "with a minimal definition" do
let(:migration) do
<<~RUBY
create_procedure "set_foo(a integer)", body: "SET custom.foo = a"
RUBY
end
let(:snippet) do
<<~RUBY
... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/enums/change_enum_spec.rb | spec/operations/enums/change_enum_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#change_enum" do
before_all { run_migration "create_schema :finances" }
before { run_migration(old_snippet) }
let(:old_snippet) do
<<~RUBY
create_enum "currency" do |e|
e.values "eur", "usd"
e.comment "Supported currencie... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/enums/drop_enum_spec.rb | spec/operations/enums/drop_enum_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#drop_enum" do
before_all { run_migration "create_schema :finances" }
before { run_migration(snippet) }
let(:snippet) do
<<~RUBY
create_enum "currency" do |e|
e.values "CHF", "EUR", "GBP", "USD", "JPY"
e.comment "Supporte... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/enums/rename_enum_spec.rb | spec/operations/enums/rename_enum_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#rename_enum" do
before_all { run_migration "create_schema :finances" }
before { run_migration(old_snippet) }
let(:old_snippet) do
<<~RUBY
create_enum "currency" do |e|
e.values "CHF", "EUR", "GBP", "USD", "JPY"
e.comment... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/operations/enums/create_enum_spec.rb | spec/operations/enums/create_enum_spec.rb | # frozen_string_literal: true
describe ActiveRecord::Migration, "#create_enum" do
before_all { run_migration "create_schema :finances" }
context "with a full definition" do
let(:migration) do
<<~RUBY
create_enum "finances.currency" do |e|
e.values "EUR", "USD"
e.comment "Supp... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/dummy/db/schema.rb | spec/dummy/db/schema.rb | # frozen_string_literal: true
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the operations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define yo... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/dummy/config/application.rb | spec/dummy/config/application.rb | # frozen_string_literal: true
require File.expand_path("boot", __dir__)
# Pick the frameworks you want:
require "active_record/railtie"
# noinspection RubyResolve
Bundler.require(*Rails.groups)
module Dummy
# noinspection RubyResolve
class Application < Rails::Application
config.cache_classes = true
con... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/dummy/config/environment.rb | spec/dummy/config/environment.rb | # frozen_string_literal: true
# Load the Rails application.
require File.expand_path("application", __dir__)
# Initialize the Rails application.
Rails.application.initialize!
| ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/dummy/config/boot.rb | spec/dummy/config/boot.rb | # frozen_string_literal: true
# Set up gems listed in the Gemfile.
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
$LOAD_PATH.unshift File.expand_path("../../../lib", __dir__)
| ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/spec/pg_trunk/dependencies_resolver_spec.rb | spec/pg_trunk/dependencies_resolver_spec.rb | # frozen_string_literal: true
# noinspection RubyResolve
require "spec_helper"
RSpec.describe PGTrunk::DependenciesResolver do
subject { described_class.resolve(input).map(&:oid) }
let(:input) { (1..10).map { |oid| object.new(oid) }.freeze }
# For simplicity we presume objects are sorted by oid
let(:object) ... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk.rb | lib/pg_trunk.rb | # frozen_string_literal: true
require "active_record"
require "active_record/connection_adapters/postgresql_adapter"
require "active_record/migration"
require "pg"
require "rails/railtie"
# @private
# PGTrunk adds methods to `ActiveRecord::Migration`
# to create and manage PostgreSQL objects
# in Rails applications.
... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core.rb | lib/pg_trunk/core.rb | # frozen_string_literal: true
# This class loads the base mechanics of the gem
# isolated in the corresponding folder.
# nodoc
module PGTrunk
require_relative "core/adapters/postgres"
require_relative "core/railtie"
require_relative "core/qualified_name"
require_relative "core/registry"
require_relative "co... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/version.rb | lib/pg_trunk/version.rb | # frozen_string_literal: true
module PGTrunk
# @private
VERSION = "0.2.0"
end
| ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations.rb | lib/pg_trunk/operations.rb | # frozen_string_literal: true
# @private
module PGTrunk
# Namespace for creator definitions and their fetchers
module Operations
# The order of requirements is essential:
# in this order independent objects will be dumped to the schema.
require_relative "operations/enums"
require_relative "operatio... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/generators.rb | lib/pg_trunk/generators.rb | # frozen_string_literal: true
require_relative "version"
require_relative "core/serializers"
require_relative "core/operation"
require_relative "core/generators"
require_relative "operations"
| ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/foreign_keys.rb | lib/pg_trunk/operations/foreign_keys.rb | # frozen_string_literal: true
# nodoc
module PGTrunk::Operations
# @private
# Definitions for foreign keys
#
# We overload only add/drop operations to support features
# like composite keys along with anonymous key deletion.
module ForeignKeys
require_relative "foreign_keys/base"
require_relative "... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/materialized_views.rb | lib/pg_trunk/operations/materialized_views.rb | # frozen_string_literal: true
# nodoc
module PGTrunk::Operations
# @private
# Namespace for operations with materialized views
module MaterializedViews
require_relative "materialized_views/column"
require_relative "materialized_views/base"
require_relative "materialized_views/change_materialized_vie... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/statistics.rb | lib/pg_trunk/operations/statistics.rb | # frozen_string_literal: true
# nodoc
module PGTrunk::Operations
# @private
# Namespace for operations with functions
module Statistics
require_relative "statistics/base"
require_relative "statistics/create_statistics"
require_relative "statistics/drop_statistics"
require_relative "statistics/ren... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/composite_types.rb | lib/pg_trunk/operations/composite_types.rb | # frozen_string_literal: true
# nodoc
module PGTrunk::Operations
# @private
# Definitions for composite types
module CompositeTypes
require_relative "composite_types/column"
require_relative "composite_types/base"
require_relative "composite_types/change_composite_type"
require_relative "composit... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/sequences.rb | lib/pg_trunk/operations/sequences.rb | # frozen_string_literal: true
# nodoc
module PGTrunk::Operations
# @private
# Namespace for operations with sequences
module Sequences
require_relative "sequences/base"
require_relative "sequences/change_sequence"
require_relative "sequences/create_sequence"
require_relative "sequences/drop_seque... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/views.rb | lib/pg_trunk/operations/views.rb | # frozen_string_literal: true
# nodoc
module PGTrunk::Operations
# @private
# Namespace for operations with views
module Views
require_relative "views/base"
require_relative "views/change_view"
require_relative "views/create_view"
require_relative "views/drop_view"
require_relative "views/ren... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/rules.rb | lib/pg_trunk/operations/rules.rb | # frozen_string_literal: true
# nodoc
module PGTrunk::Operations
# @private
# Namespace for operations with rules
module Rules
require_relative "rules/base"
require_relative "rules/create_rule"
require_relative "rules/drop_rule"
require_relative "rules/rename_rule"
end
end
| ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/triggers.rb | lib/pg_trunk/operations/triggers.rb | # frozen_string_literal: true
# nodoc
module PGTrunk::Operations
# @private
# Namespace for operations with triggers
module Triggers
require_relative "triggers/base"
require_relative "triggers/change_trigger"
require_relative "triggers/create_trigger"
require_relative "triggers/drop_trigger"
... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/tables.rb | lib/pg_trunk/operations/tables.rb | # frozen_string_literal: true
# nodoc
module PGTrunk::Operations
# @private
# Namespace for operations with tables
module Tables
require_relative "tables/create_table"
end
end
| ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/enums.rb | lib/pg_trunk/operations/enums.rb | # frozen_string_literal: true
# nodoc
module PGTrunk::Operations
# @private
# Namespace for operations with functions
module Enums
require_relative "enums/change"
require_relative "enums/base"
require_relative "enums/change_enum"
require_relative "enums/create_enum"
require_relative "enums/dr... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/indexes.rb | lib/pg_trunk/operations/indexes.rb | # frozen_string_literal: true
# nodoc
module PGTrunk::Operations
# @private
# Namespace for operations with indexes
module Indexes
require_relative "indexes/add_index"
end
end
| ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/procedures.rb | lib/pg_trunk/operations/procedures.rb | # frozen_string_literal: true
# nodoc
module PGTrunk::Operations
# @private
# Namespace for operations with procedures
module Procedures
require_relative "procedures/base"
require_relative "procedures/change_procedure"
require_relative "procedures/create_procedure"
require_relative "procedures/dr... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/functions.rb | lib/pg_trunk/operations/functions.rb | # frozen_string_literal: true
# nodoc
module PGTrunk::Operations
# @private
# Namespace for operations with functions
module Functions
require_relative "functions/base"
require_relative "functions/create_function"
require_relative "functions/change_function"
require_relative "functions/drop_funct... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/check_constraints.rb | lib/pg_trunk/operations/check_constraints.rb | # frozen_string_literal: true
# nodoc
module PGTrunk::Operations
# @private
# Definitions for check constraints
module CheckConstraints
require_relative "check_constraints/base"
require_relative "check_constraints/add_check_constraint"
require_relative "check_constraints/drop_check_constraint"
re... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/domains.rb | lib/pg_trunk/operations/domains.rb | # frozen_string_literal: true
# nodoc
module PGTrunk::Operations
# @private
# Namespace for operations with functions
module Domains
require_relative "domains/constraint"
require_relative "domains/base"
require_relative "domains/change_domain"
require_relative "domains/create_domain"
require_... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/foreign_keys/rename_foreign_key.rb | lib/pg_trunk/operations/foreign_keys/rename_foreign_key.rb | # frozen_string_literal: false
# @!parse
# class ActiveRecord::Migration
# # Rename a foreign key
# #
# # @param [#to_s] table (nil) The qualified name of the table
# # @param [#to_s] reference (nil) The qualified name of the reference table
# # @option options [#to_s] :name (nil) The current nam... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/foreign_keys/drop_foreign_key.rb | lib/pg_trunk/operations/foreign_keys/drop_foreign_key.rb | # frozen_string_literal: false
# @!parse
# class ActiveRecord::Migration
# # Drops a foreign key constraint
# #
# # @param [#to_s] table (nil) The qualified name of the table
# # @param [#to_s] reference (nil) The qualified name of the reference table
# # @option options [#to_s] :name (nil) The c... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/foreign_keys/base.rb | lib/pg_trunk/operations/foreign_keys/base.rb | # frozen_string_literal: false
module PGTrunk::Operations::ForeignKeys
# @abstract
# @private
# Base class for operations with foreign keys
class Base < PGTrunk::Operation
# All attributes that can be used by fk-related commands
attribute :columns, :pg_trunk_array_of_strings, aliases: :column, default:... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/foreign_keys/add_foreign_key.rb | lib/pg_trunk/operations/foreign_keys/add_foreign_key.rb | # frozen_string_literal: false
# @!parse
# class ActiveRecord::Migration
# # Create a foreign key constraint
# #
# # @param [#to_s] table (nil) The qualified name of the table
# # @param [#to_s] reference (nil) The qualified name of the reference table
# # @option options [#to_s] :name (nil) The ... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/composite_types/change_composite_type.rb | lib/pg_trunk/operations/composite_types/change_composite_type.rb | # frozen_string_literal: false
# @!parse
# class ActiveRecord::Migration
# # Modify a composite type
# #
# # @param [#to_s] name (nil) The qualified name of the type
# # @option options [Symbol] :force (:restrict) How to process dependent objects (`:cascade` or `:restrict`)
# # @option options [#... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/composite_types/create_composite_type.rb | lib/pg_trunk/operations/composite_types/create_composite_type.rb | # frozen_string_literal: false
# @!parse
# class ActiveRecord::Migration
# # Create a composite type
# #
# # @param [#to_s] name (nil) The qualified name of the type
# # @option options [#to_s] :comment (nil) The comment describing the constraint
# # @yield [t] the block with the type's definitio... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/composite_types/base.rb | lib/pg_trunk/operations/composite_types/base.rb | # frozen_string_literal: false
module PGTrunk::Operations::CompositeTypes
# @abstract
# @private
# Base class for operations with composite types
class Base < PGTrunk::Operation
# All columns that can be used by type-related commands
attribute :columns, :pg_trunk_array_of_hashes, default: []
# Pop... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/composite_types/drop_composite_type.rb | lib/pg_trunk/operations/composite_types/drop_composite_type.rb | # frozen_string_literal: false
# @!parse
# class ActiveRecord::Migration
# # Drop a composite type
# #
# # @param [#to_s] name (nil) The qualified name of the type
# # @option options [Boolean] :if_exists (false) Suppress the error when the type is absent
# # @option options [Symbol] :force (:res... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/composite_types/rename_composite_type.rb | lib/pg_trunk/operations/composite_types/rename_composite_type.rb | # frozen_string_literal: false
# @!parse
# class ActiveRecord::Migration
# # Change the name and/or schema of a composite type
# #
# # @param [#to_s] name (nil) The qualified name of the type
# # @option options [#to_s] :to (nil) The new qualified name for the type
# # @return [void]
# #
# ... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/composite_types/column.rb | lib/pg_trunk/operations/composite_types/column.rb | # frozen_string_literal: false
module PGTrunk::Operations::CompositeTypes
# @private
# Definition for an column of a composite type
class Column
include ActiveModel::Model
include ActiveModel::Attributes
include ActiveModel::Validations
def self.build(data)
data.is_a?(self) ? data : new(**... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/triggers/drop_trigger.rb | lib/pg_trunk/operations/triggers/drop_trigger.rb | # frozen_string_literal: false
# @!parse
# class ActiveRecord::Migration
# # Drop a trigger for a table
# #
# # @param [#to_s] table (nil) The qualified name of the table
# # @param [#to_s] name (nil) The name of the trigger
# # @option options [Boolean] :if_exists (false) Suppress the error when... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/triggers/base.rb | lib/pg_trunk/operations/triggers/base.rb | # frozen_string_literal: false
module PGTrunk::Operations::Triggers
# @abstract
# @private
# Base class for operations with triggers
class Base < PGTrunk::Operation
# All attributes that can be used by trigger-related commands
attribute :columns, :pg_trunk_array_of_strings, default: []
attribute :c... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/triggers/rename_trigger.rb | lib/pg_trunk/operations/triggers/rename_trigger.rb | # frozen_string_literal: false
# @!parse
# class ActiveRecord::Migration
# # Rename a trigger
# #
# # @param [#to_s] table (nil) The qualified name of the table
# # @param [#to_s] name (nil) The name of the trigger
# # @option options [#to_s] :to (nil) The new name of the trigger
# # @param [... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/triggers/change_trigger.rb | lib/pg_trunk/operations/triggers/change_trigger.rb | # frozen_string_literal: false
# @!parse
# class ActiveRecord::Migration
# # Create a trigger for a table
# #
# # @param [#to_s] table (nil) The qualified name of the table
# # @param [#to_s] name (nil) The name of the trigger
# # @option options [Boolean] :if_exists (false) Suppress the error wh... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/triggers/create_trigger.rb | lib/pg_trunk/operations/triggers/create_trigger.rb | # frozen_string_literal: false
# @!parse
# class ActiveRecord::Migration
# # Create a trigger for a table
# #
# # @param [#to_s] table (nil) The qualified name of the table
# # @param [#to_s] name (nil) The name of the trigger
# # @option options [Boolean] :replace_existing (false) If the trigger... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/rules/create_rule.rb | lib/pg_trunk/operations/rules/create_rule.rb | # frozen_string_literal: false
# @!parse
# class ActiveRecord::Migration
# # Create a rule
# #
# # @param [#to_s] table (nil) The qualified name of the table
# # @param [#to_s] name (nil) The name of the rule (unique within the table)
# # @option options [Boolean] :replace_existing (false) If the... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/rules/rename_rule.rb | lib/pg_trunk/operations/rules/rename_rule.rb | # frozen_string_literal: false
# @!parse
# class ActiveRecord::Migration
# # Rename a rule
# #
# # @param [#to_s] table (nil) The qualified name of the table
# # @param [#to_s] name (nil) The current name of the rule
# # @option options [#to_s] :to (nil) The new name for the rule
# # @yield [... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/rules/base.rb | lib/pg_trunk/operations/rules/base.rb | # frozen_string_literal: false
module PGTrunk::Operations::Rules
# @abstract
# @private
# Base class for operations with rules
class Base < PGTrunk::Operation
attribute :command, :string
attribute :event, :pg_trunk_symbol
attribute :kind, :pg_trunk_symbol
attribute :replace_existing, :boolean
... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/rules/drop_rule.rb | lib/pg_trunk/operations/rules/drop_rule.rb | # frozen_string_literal: false
# @!parse
# class ActiveRecord::Migration
# # Drop a rule
# #
# # @param [#to_s] table (nil) The qualified name of the table
# # @param [#to_s] name (nil) The name of the rule (unique within the table)
# # @option options [Boolean] :if_exists (false) Suppress the er... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/sequences/change_sequence.rb | lib/pg_trunk/operations/sequences/change_sequence.rb | # frozen_string_literal: false
# @!parse
# class ActiveRecord::Migration
# # Modify a sequence
# #
# # @param [#to_s] name (nil) The qualified name of the sequence.
# # @option options [Boolean] :if_exists (false) Suppress the error when the sequence is absent.
# # @yield [s] the block with the s... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/sequences/base.rb | lib/pg_trunk/operations/sequences/base.rb | # frozen_string_literal: false
module PGTrunk::Operations::Sequences
# @abstract
# @private
# Base class for operations with sequences
class Base < PGTrunk::Operation
attribute :type, :string, aliases: :as
attribute :increment_by, :integer
attribute :min_value, :integer
attribute :max_value, :i... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/sequences/rename_sequence.rb | lib/pg_trunk/operations/sequences/rename_sequence.rb | # frozen_string_literal: false
# @!parse
# class ActiveRecord::Migration
# # Rename a sequence
# #
# # @param [#to_s] name (nil) The current qualified name of the sequence
# # @option options [#to_s] :to (nil) The new qualified name for the sequence
# # @option options [Boolean] :if_exists (false... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/sequences/create_sequence.rb | lib/pg_trunk/operations/sequences/create_sequence.rb | # frozen_string_literal: false
# @!parse
# class ActiveRecord::Migration
# # Create a sequence
# #
# # @param [#to_s] name (nil) The qualified name of the sequence
# # @option options [#to_s] :as ("bigint") The type of the sequence's value
# # Supported values: "bigint" (or "int8", default), "i... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/sequences/drop_sequence.rb | lib/pg_trunk/operations/sequences/drop_sequence.rb | # frozen_string_literal: false
# @!parse
# class ActiveRecord::Migration
# # Drop a sequence
# #
# # @param [#to_s] name (nil) The qualified name of the sequence
# # @option options [#to_s] :as ("bigint") The type of the sequence's value
# # Supported values: "bigint" (or "int8", default), "int... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
nepalez/pg_trunk | https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/domains/create_domain.rb | lib/pg_trunk/operations/domains/create_domain.rb | # frozen_string_literal: false
# @!parse
# class ActiveRecord::Migration
# # Create a domain type
# #
# # @param [#to_s] name (nil) The qualified name of the type
# # @option options [#to_s] :as (nil) The base type for the domain (alias: :type)
# # @option options [#to_s] :collation (nil) The col... | ruby | MIT | d8d55e53121d01885da55c384c0ed6e23ac79386 | 2026-01-04T17:41:54.025977Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.