From eb9d5b9b84bc106cc2a5eac24b5daca4ddc06ef1 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Tue, 4 Jul 2017 12:55:36 +0200 Subject: [PATCH] Add slug string column to Budget, Budget::Heading and Budget::Group Why: * We're still using id's on routes and other parts of the app, using slugs are more friendly and nice How: * Just a migration with a slug column with string type --- .../20170704105112_add_slugs_to_budget_heading_group.rb | 7 +++++++ db/schema.rb | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20170704105112_add_slugs_to_budget_heading_group.rb diff --git a/db/migrate/20170704105112_add_slugs_to_budget_heading_group.rb b/db/migrate/20170704105112_add_slugs_to_budget_heading_group.rb new file mode 100644 index 000000000..85c94e66f --- /dev/null +++ b/db/migrate/20170704105112_add_slugs_to_budget_heading_group.rb @@ -0,0 +1,7 @@ +class AddSlugsToBudgetHeadingGroup < ActiveRecord::Migration + def change + add_column :budgets, :slug, :string + add_column :budget_groups, :slug, :string + add_column :budget_headings, :slug, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index cb9a015e9..0787b5ed1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170703120055) do +ActiveRecord::Schema.define(version: 20170704105112) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -103,6 +103,7 @@ ActiveRecord::Schema.define(version: 20170703120055) do create_table "budget_groups", force: :cascade do |t| t.integer "budget_id" t.string "name", limit: 50 + t.string "slug" end add_index "budget_groups", ["budget_id"], name: "index_budget_groups_on_budget_id", using: :btree @@ -112,6 +113,7 @@ ActiveRecord::Schema.define(version: 20170703120055) do t.string "name", limit: 50 t.integer "price", limit: 8 t.integer "population" + t.string "slug" end add_index "budget_headings", ["group_id"], name: "index_budget_headings_on_group_id", using: :btree @@ -196,6 +198,7 @@ ActiveRecord::Schema.define(version: 20170703120055) do t.text "description_balloting" t.text "description_reviewing_ballots" t.text "description_finished" + t.string "slug" end create_table "campaigns", force: :cascade do |t|