diff --git a/db/migrate/20170423210622_change_price_price_cents_type_to_integer.rb b/db/migrate/20170423210622_change_price_price_cents_type_to_integer.rb
new file mode 100644
index 000000000..fda7c2dc1
--- /dev/null
+++ b/db/migrate/20170423210622_change_price_price_cents_type_to_integer.rb
@@ -0,0 +1,5 @@
+class ChangePricePriceCentsTypeToInteger < ActiveRecord::Migration
+ def change
+ change_column :prices, :price_cents, 'integer USING CAST(price_cents AS integer)'
+ end
+end
diff --git a/db/migrate/20170423214500_remove_price_price_currency.rb b/db/migrate/20170423214500_remove_price_price_currency.rb
new file mode 100644
index 000000000..95f492701
--- /dev/null
+++ b/db/migrate/20170423214500_remove_price_price_currency.rb
@@ -0,0 +1,5 @@
+class RemovePricePriceCurrency < ActiveRecord::Migration
+ def change
+ remove_column :prices, :price_currency, :string
+ end
+end
diff --git a/db/migrate/20170423222302_remove_price_price_cents_default.rb b/db/migrate/20170423222302_remove_price_price_cents_default.rb
new file mode 100644
index 000000000..30aa19275
--- /dev/null
+++ b/db/migrate/20170423222302_remove_price_price_cents_default.rb
@@ -0,0 +1,5 @@
+class RemovePricePriceCentsDefault < ActiveRecord::Migration
+ def change
+ change_column_default :prices, :price_cents, nil
+ end
+end
diff --git a/db/schema-read-only.rb b/db/schema-read-only.rb
index 30891b1cc..6a564eeb4 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: 20170423151046) do
+ActiveRecord::Schema.define(version: 20170423222302) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -964,14 +964,13 @@ ActiveRecord::Schema.define(version: 20170423151046) do
create_table "prices", force: :cascade do |t|
t.string "desc"
t.string "category"
- t.decimal "price_cents", precision: 10, scale: 2, default: 0.0, null: false
- t.string "price_currency", default: "EUR", null: false
+ t.integer "price_cents", null: false
t.datetime "valid_from"
t.datetime "valid_to"
t.string "creator_str"
t.string "updator_str"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.string "duration"
t.string "operation_category"
end
diff --git a/db/structure.sql b/db/structure.sql
index f4d2f0795..20ba2eee8 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -2497,8 +2497,7 @@ CREATE TABLE prices (
id integer NOT NULL,
"desc" character varying,
category character varying,
- price_cents numeric(10,2) DEFAULT 0.0 NOT NULL,
- price_currency character varying DEFAULT 'EUR'::character varying NOT NULL,
+ price_cents integer NOT NULL,
valid_from timestamp without time zone,
valid_to timestamp without time zone,
creator_str character varying,
@@ -5175,3 +5174,9 @@ INSERT INTO schema_migrations (version) VALUES ('20170423145057');
INSERT INTO schema_migrations (version) VALUES ('20170423151046');
+INSERT INTO schema_migrations (version) VALUES ('20170423210622');
+
+INSERT INTO schema_migrations (version) VALUES ('20170423214500');
+
+INSERT INTO schema_migrations (version) VALUES ('20170423222302');
+
diff --git a/doc/models_complete.svg b/doc/models_complete.svg
index a0889d72b..9c786b9c0 100644
--- a/doc/models_complete.svg
+++ b/doc/models_complete.svg
@@ -2006,8 +2006,7 @@
id :integer
desc :string
category :string
-price_cents :decimal
-price_currency :string
+price_cents :integer
valid_from :datetime
valid_to :datetime
creator_str :string