Change pricelists.duration column type to interval

#475
This commit is contained in:
Artur Beljajev 2017-04-23 17:59:17 +03:00
parent 8e90769366
commit 2ff05c4b00
3 changed files with 11 additions and 2 deletions

View file

@ -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

View file

@ -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"

View file

@ -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');