feat(migrate): add AddCoverToPosts, down and CreateComments
This commit is contained in:
1 parent
e29580f149
commit
56b040c2ad
12 files changed
+126
No files matched your search
@@ -0,0 +1,9 @@
|
||||
class AddCoverToPosts < Prism::Orm::Migration
|
||||
def up
|
||||
add_column :posts, :cover, default: nil
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :posts, :cover
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
class CreateComments < Prism::Orm::Migration
|
||||
def up
|
||||
create_table :comments do |t|
|
||||
t.integer :post_id
|
||||
t.string :author
|
||||
t.text :body
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :comments
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
class CreateUsers < Prism::Orm::Migration
|
||||
def up
|
||||
create_table :users do |t|
|
||||
t.string :email
|
||||
t.string :password_digest
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :users
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
class AddUserIdToPostsAndComments < Prism::Orm::Migration
|
||||
def up
|
||||
add_column :posts, :user_id
|
||||
add_column :comments, :user_id
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :posts, :user_id
|
||||
remove_column :comments, :user_id
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class AddLockVersionToPosts < Prism::Orm::Migration
|
||||
def up
|
||||
add_column :posts, :lock_version, :integer, default: 0
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :posts, :lock_version
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class AddLockVersionToComments < Prism::Orm::Migration
|
||||
def up
|
||||
add_column :comments, :lock_version, :integer, default: 0
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :comments, :lock_version
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
class CreateLikes < Prism::Orm::Migration
|
||||
def up
|
||||
create_table :likes do |t|
|
||||
t.integer :user_id
|
||||
t.integer :likeable_id
|
||||
t.string :likeable_type
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :likes
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class AddCommentsCountToPosts < Prism::Orm::Migration
|
||||
def up
|
||||
add_column :posts, :comments_count, :integer, default: 0
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :posts, :comments_count
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class AddStatusToPosts < Prism::Orm::Migration
|
||||
def up
|
||||
add_column :posts, :status, :integer, default: 0
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :posts, :status
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class AddStatusToComments < Prism::Orm::Migration
|
||||
def up
|
||||
add_column :comments, :status, :integer, default: 0
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :comments, :status
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class AddDeletedAtToPosts < Prism::Orm::Migration
|
||||
def up
|
||||
add_column :posts, :deleted_at, :datetime, default: nil
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :posts, :deleted_at
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
class AddDeletedAtToCommentsAndLikes < Prism::Orm::Migration
|
||||
def up
|
||||
add_column :comments, :deleted_at, :datetime, default: nil
|
||||
add_column :likes, :deleted_at, :datetime, default: nil
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :comments, :deleted_at
|
||||
remove_column :likes, :deleted_at
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user