Initial commit
This commit is contained in:
12
db/migrate/20230101035642_create_posts.rb
Normal file
12
db/migrate/20230101035642_create_posts.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table :posts do
|
||||
primary_key :id
|
||||
column :name, :text, null: false, default: ""
|
||||
column :content, :text, null: false
|
||||
column :published_at, :timestamp
|
||||
end
|
||||
end
|
||||
end
|
9
db/migrate/20230101113513_add_slug_to_posts.rb
Normal file
9
db/migrate/20230101113513_add_slug_to_posts.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :posts do
|
||||
add_column :slug, :text, null: false
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :posts do
|
||||
add_unique_constraint :slug
|
||||
end
|
||||
end
|
||||
end
|
13
db/migrate/20230102075558_create_bookmarks.rb
Normal file
13
db/migrate/20230102075558_create_bookmarks.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table :bookmarks do
|
||||
primary_key :id
|
||||
column :url, :text, null: false
|
||||
column :name, :text, null: false
|
||||
column :content, :text, null: false, default: ""
|
||||
column :published_at, :timestamp
|
||||
end
|
||||
end
|
||||
end
|
9
db/migrate/20230103085913_add_slug_to_bookmarks.rb
Normal file
9
db/migrate/20230103085913_add_slug_to_bookmarks.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :bookmarks do
|
||||
add_column :slug, :text, null: false, unique: true
|
||||
end
|
||||
end
|
||||
end
|
16
db/migrate/20230103215123_create_tags.rb
Normal file
16
db/migrate/20230103215123_create_tags.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table :tags do
|
||||
primary_key :id
|
||||
column :label, :text, null: false, unique: true
|
||||
column :slug, :text, null: false, unique: true
|
||||
end
|
||||
|
||||
create_table :post_tags do
|
||||
foreign_key :post_id, :posts, null: false
|
||||
foreign_key :tag_id, :tags, null: false
|
||||
end
|
||||
end
|
||||
end
|
11
db/migrate/20230103215311_combine_posts_and_bookmarks.rb
Normal file
11
db/migrate/20230103215311_combine_posts_and_bookmarks.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
drop_table :bookmarks
|
||||
alter_table :posts do
|
||||
add_column :url, :text
|
||||
add_column :post_type, :text
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :posts do
|
||||
set_column_allow_null :content
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :posts do
|
||||
set_column_allow_null :name
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user