1
0
mirror of https://github.com/danbee/danbarberphoto synced 2025-03-04 08:49:07 +00:00

Upgrade migrations

This commit is contained in:
Daniel Barber 2021-07-16 12:58:13 -05:00
parent 955cc7f603
commit 50f1fc25aa
23 changed files with 41 additions and 41 deletions

View File

@ -1,4 +1,4 @@
class CreateCategories < ActiveRecord::Migration class CreateCategories < ActiveRecord::Migration[5.1]
def self.up def self.up
create_table :categories do |t| create_table :categories do |t|
t.string :name t.string :name

View File

@ -1,4 +1,4 @@
class CreatePhotos < ActiveRecord::Migration class CreatePhotos < ActiveRecord::Migration[5.1]
def self.up def self.up
create_table :photos do |t| create_table :photos do |t|
t.integer :category_id t.integer :category_id

View File

@ -1,4 +1,4 @@
class AddPhotoToCategory < ActiveRecord::Migration class AddPhotoToCategory < ActiveRecord::Migration[5.1]
def self.up def self.up
add_column :categories, :photo_id, :integer add_column :categories, :photo_id, :integer
end end

View File

@ -1,4 +1,4 @@
class AddDetailsToPhoto < ActiveRecord::Migration class AddDetailsToPhoto < ActiveRecord::Migration[5.1]
def self.up def self.up
add_column :photos, :title, :string add_column :photos, :title, :string
add_column :photos, :description, :text add_column :photos, :description, :text

View File

@ -1,4 +1,4 @@
class AddColourToCategory < ActiveRecord::Migration class AddColourToCategory < ActiveRecord::Migration[5.1]
def self.up def self.up
add_column :categories, :base_colour, :string add_column :categories, :base_colour, :string
end end

View File

@ -1,4 +1,4 @@
class AddSortOrders < ActiveRecord::Migration class AddSortOrders < ActiveRecord::Migration[5.1]
def self.up def self.up
add_column :photos, :sort, :integer add_column :photos, :sort, :integer
add_column :categories, :sort, :integer add_column :categories, :sort, :integer

View File

@ -1,4 +1,4 @@
class MoveToManyToMany < ActiveRecord::Migration class MoveToManyToMany < ActiveRecord::Migration[5.1]
def self.up def self.up
remove_column :photos, :category_id remove_column :photos, :category_id
create_table :categories_photos, id: false do |t| create_table :categories_photos, id: false do |t|

View File

@ -1,4 +1,4 @@
class CreateAdminUsers < ActiveRecord::Migration class CreateAdminUsers < ActiveRecord::Migration[5.1]
def self.up def self.up
create_table :admin_users do |t| create_table :admin_users do |t|
t.string :first_name, default: "", null: false t.string :first_name, default: "", null: false

View File

@ -1,4 +1,4 @@
class CreatePages < ActiveRecord::Migration class CreatePages < ActiveRecord::Migration[5.1]
def self.up def self.up
create_table :pages do |t| create_table :pages do |t|
t.string :name t.string :name

View File

@ -1,4 +1,4 @@
class PhotoShowcase < ActiveRecord::Migration class PhotoShowcase < ActiveRecord::Migration[5.1]
def self.up def self.up
add_column :photos, :featured, :boolean, default: false add_column :photos, :featured, :boolean, default: false
end end

View File

@ -1,4 +1,4 @@
class AddEnabledToPhotos < ActiveRecord::Migration class AddEnabledToPhotos < ActiveRecord::Migration[5.1]
def self.up def self.up
add_column :photos, :enabled, :boolean, default: true add_column :photos, :enabled, :boolean, default: true
end end

View File

@ -1,4 +1,4 @@
class AddTakenDateToPhoto < ActiveRecord::Migration class AddTakenDateToPhoto < ActiveRecord::Migration[5.1]
def self.up def self.up
add_column :photos, :taken_at, :datetime add_column :photos, :taken_at, :datetime
end end

View File

@ -1,4 +1,4 @@
class AddViewCountToPhotos < ActiveRecord::Migration class AddViewCountToPhotos < ActiveRecord::Migration[5.1]
def self.up def self.up
add_column :photos, :views, :integer, default: 0 add_column :photos, :views, :integer, default: 0
end end

View File

@ -1,4 +1,4 @@
class AddSessionsTable < ActiveRecord::Migration class AddSessionsTable < ActiveRecord::Migration[5.1]
def up def up
create_table :sessions do |t| create_table :sessions do |t|
t.string :session_id, null: false t.string :session_id, null: false

View File

@ -1,4 +1,4 @@
class RemoveAdminUsers < ActiveRecord::Migration class RemoveAdminUsers < ActiveRecord::Migration[5.1]
def self.up def self.up
drop_table :admin_users drop_table :admin_users
end end

View File

@ -1,4 +1,4 @@
class CreateDeviseAdminUsers < ActiveRecord::Migration class CreateDeviseAdminUsers < ActiveRecord::Migration[5.1]
def up def up
create_table(:admin_users) do |t| create_table(:admin_users) do |t|
# Database authenticatable # Database authenticatable

View File

@ -1,4 +1,4 @@
class AddSlugToCategories < ActiveRecord::Migration class AddSlugToCategories < ActiveRecord::Migration[5.1]
def change def change
add_column :categories, :slug, :string add_column :categories, :slug, :string
end end

View File

@ -1,4 +1,4 @@
class AddDragonflyImageToPhotos < ActiveRecord::Migration class AddDragonflyImageToPhotos < ActiveRecord::Migration[5.1]
def change def change
add_column :photos, :image_uid, :string add_column :photos, :image_uid, :string
add_column :photos, :image_name, :string add_column :photos, :image_name, :string

View File

@ -1,4 +1,4 @@
class RemovePaperclipColumnsFromPhotos < ActiveRecord::Migration class RemovePaperclipColumnsFromPhotos < ActiveRecord::Migration[5.1]
def change def change
remove_column :photos, :photo_file_name remove_column :photos, :photo_file_name
remove_column :photos, :photo_content_type remove_column :photos, :photo_content_type

View File

@ -1,4 +1,4 @@
class AddIndexToCategoriesPhotos < ActiveRecord::Migration class AddIndexToCategoriesPhotos < ActiveRecord::Migration[5.1]
def change def change
add_index :categories_photos, [:category_id, :photo_id], unique: true add_index :categories_photos, [:category_id, :photo_id], unique: true
end end

View File

@ -1,4 +1,4 @@
class RemoveDeviseAdminUsers < ActiveRecord::Migration class RemoveDeviseAdminUsers < ActiveRecord::Migration[5.1]
def up def up
drop_table :admin_users drop_table :admin_users
end end

View File

@ -1,4 +1,4 @@
class CreateUsers < ActiveRecord::Migration class CreateUsers < ActiveRecord::Migration[5.1]
def change def change
create_table :users do |t| create_table :users do |t|
t.string :email, null: false t.string :email, null: false

View File

@ -10,20 +10,20 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20151028124718) do ActiveRecord::Schema.define(version: 2015_10_23_165644) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
create_table "categories", force: :cascade do |t| create_table "categories", force: :cascade do |t|
t.string "name", limit: 255 t.string "name"
t.text "description" t.text "description"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
t.integer "photo_id" t.integer "photo_id"
t.string "base_colour", limit: 255 t.string "base_colour"
t.integer "sort" t.integer "sort"
t.string "slug", limit: 255 t.string "slug"
end end
create_table "categories_photos", id: false, force: :cascade do |t| create_table "categories_photos", id: false, force: :cascade do |t|
@ -33,33 +33,33 @@ ActiveRecord::Schema.define(version: 20151028124718) do
end end
create_table "pages", force: :cascade do |t| create_table "pages", force: :cascade do |t|
t.string "name", limit: 255 t.string "name"
t.string "title", limit: 255 t.string "title"
t.text "content" t.text "content"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
end end
create_table "photos", force: :cascade do |t| create_table "photos", force: :cascade do |t|
t.string "flickr_url", limit: 255 t.string "flickr_url"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
t.string "title", limit: 255 t.string "title"
t.text "description" t.text "description"
t.integer "sort" t.integer "sort"
t.boolean "featured", default: false t.boolean "featured", default: false
t.boolean "enabled", default: true t.boolean "enabled", default: true
t.datetime "taken_at" t.datetime "taken_at"
t.integer "views", default: 0 t.integer "views", default: 0
t.string "image_uid", limit: 255 t.string "image_uid"
t.string "image_name", limit: 255 t.string "image_name"
end end
create_table "sessions", force: :cascade do |t| create_table "sessions", force: :cascade do |t|
t.string "session_id", limit: 255, null: false t.string "session_id", null: false
t.text "data" t.text "data"
t.datetime "created_at" t.datetime "created_at", null: false
t.datetime "updated_at" t.datetime "updated_at", null: false
t.index ["session_id"], name: "index_sessions_on_session_id" t.index ["session_id"], name: "index_sessions_on_session_id"
t.index ["updated_at"], name: "index_sessions_on_updated_at" t.index ["updated_at"], name: "index_sessions_on_updated_at"
end end