diff --git a/db/migrate/20170422162824_change_pricelist_duration_type_to_interval.rb b/db/migrate/20170422162824_change_pricelist_duration_type_to_interval.rb new file mode 100644 index 000000000..1853d9360 --- /dev/null +++ b/db/migrate/20170422162824_change_pricelist_duration_type_to_interval.rb @@ -0,0 +1,7 @@ +class ChangePricelistDurationTypeToInterval < ActiveRecord::Migration + def change + execute <<-SQL + ALTER TABLE pricelists ALTER COLUMN duration TYPE interval USING (trim(duration)::interval) + SQL + end +end diff --git a/db/schema-read-only.rb b/db/schema-read-only.rb index 5fa683be4..a9b12eb8a 100644 --- a/db/schema-read-only.rb +++ b/db/schema-read-only.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170422142116) do +ActiveRecord::Schema.define(version: 20170422162824) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" diff --git a/db/structure.sql b/db/structure.sql index c59d01b1c..f5fab5ef7 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -2542,7 +2542,7 @@ CREATE TABLE pricelists ( updator_str character varying, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, - duration character varying, + duration interval, operation_category character varying ); @@ -5221,3 +5221,5 @@ INSERT INTO schema_migrations (version) VALUES ('20170422130054'); INSERT INTO schema_migrations (version) VALUES ('20170422142116'); +INSERT INTO schema_migrations (version) VALUES ('20170422162824'); +