Skip to content

Commit

Permalink
Fix up migrations and schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Mitchell committed Mar 16, 2017
1 parent 5b51be5 commit 3dcc285
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 44 deletions.
13 changes: 7 additions & 6 deletions db/migrate/1_create_spina_tables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ def change
t.datetime "updated_at", null: false
end

create_table "spina_colors", force: :cascade do |t|
t.text "content"
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "spina_layout_parts", force: :cascade do |t|
t.string "title"
t.string "name"
Expand All @@ -49,6 +43,7 @@ def change
end

create_table "spina_lines", force: :cascade do |t|
t.string "content"
t.datetime "created_at"
t.datetime "updated_at"
end
Expand All @@ -64,19 +59,24 @@ def change
end

create_table "spina_pages", force: :cascade do |t|
t.string "title"
t.string "menu_title"
t.string "description"
t.boolean "show_in_menu", default: true
t.string "slug"
t.boolean "deletable", default: true
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "name"
t.string "seo_title"
t.boolean "skip_to_first_child", default: false
t.string "view_template"
t.string "layout_template"
t.boolean "draft", default: false
t.string "link_url"
t.string "ancestry"
t.integer "position"
t.string "materialized_path"
t.boolean "active", default: true
end

Expand Down Expand Up @@ -125,6 +125,7 @@ def change
end

create_table "spina_texts", force: :cascade do |t|
t.text "content"
t.datetime "created_at"
t.datetime "updated_at"
end
Expand Down
31 changes: 6 additions & 25 deletions db/migrate/2_create_spina_translation_tables.rb
Original file line number Diff line number Diff line change
@@ -1,32 +1,13 @@
class CreateSpinaTranslationTables < ActiveRecord::Migration
def up
Spina::Page.create_translation_table!({
title: :string,
menu_title: :string,
description: :string,
seo_title: :string,
materialized_path: :string
}, {
migrate_data: true,
remove_source_columns: true
})
Spina::Text.create_translation_table!({
content: :text
}, {
migrate_data: true,
remove_source_columns: true
})
Spina::Line.create_translation_table!({
content: :string
}, {
migrate_data: true,
remove_source_columns: true
})
Spina::Page.create_translation_table! title: :string, menu_title: :string, description: :string, seo_title: :string, materialized_path: :string
Spina::Text.create_translation_table! content: :text
Spina::Line.create_translation_table! content: :string
end

def down
Spina::Page.drop_translation_table! migrate_data: true
Spina::Text.drop_translation_table! migrate_data: true
Spina::Line.drop_translation_table! migrate_data: true
Spina::Page.drop_translation_table!
Spina::Text.drop_translation_table!
Spina::Line.drop_translation_table!
end
end
5 changes: 0 additions & 5 deletions db/migrate/4_drop_spina_colors.rb

This file was deleted.

10 changes: 2 additions & 8 deletions test/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20161223093220) do
ActiveRecord::Schema.define(version: 20170316180538) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -47,12 +47,6 @@
t.datetime "updated_at", null: false
end

create_table "spina_colors", force: :cascade do |t|
t.text "content"
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "spina_layout_parts", force: :cascade do |t|
t.string "title"
t.string "name"
Expand Down Expand Up @@ -86,7 +80,7 @@
t.string "ancestry"
t.datetime "created_at"
t.datetime "updated_at"
t.index ["page_id", "navigation_id"], name: "index_spina_gation_items_on_page_id_and_navigation_id", unique: true, using: :btree
t.index ["page_id", "navigation_id"], name: "index_spina_navigation_items_on_page_id_and_navigation_id", unique: true, using: :btree
end

create_table "spina_navigations", force: :cascade do |t|
Expand Down

0 comments on commit 3dcc285

Please sign in to comment.