みてるぞ 4 months ago
parent
commit
c6854b7a54
12 changed files with 111 additions and 10 deletions
  1. +0
    -10
      backend/db/migrate/20250225131718_create_posts.rb
  2. +9
    -0
      backend/db/migrate/20250227205900_create_ip_addresses.rb
  3. +9
    -0
      backend/db/migrate/20250227210600_create_nico_tag_relations.rb
  4. +11
    -0
      backend/db/migrate/20250227211500_create_post_tags.rb
  5. +12
    -0
      backend/db/migrate/20250227212100_create_posts.rb
  6. +10
    -0
      backend/db/migrate/20250227212500_create_settings.rb
  7. +9
    -0
      backend/db/migrate/20250227213000_create_tag_aliases.rb
  8. +9
    -0
      backend/db/migrate/20250227213200_create_tags.rb
  9. +10
    -0
      backend/db/migrate/20250227213400_create_user_ips.rb
  10. +10
    -0
      backend/db/migrate/20250227213700_create_user_post_views.rb
  11. +11
    -0
      backend/db/migrate/20250227213900_create_users.rb
  12. +11
    -0
      backend/db/migrate/20250227214100_create_wiki_pages.rb

+ 0
- 10
backend/db/migrate/20250225131718_create_posts.rb View File

@@ -1,10 +0,0 @@
class CreatePosts < ActiveRecord::Migration[8.0]
def change
create_table :posts do |t|
t.string :title
t.text :body

t.timestamps
end
end
end

+ 9
- 0
backend/db/migrate/20250227205900_create_ip_addresses.rb View File

@@ -0,0 +1,9 @@
class CreateIpAddresses < ActiveRecord::Migration[7.0]
def change
create_table :ip_addresses do |t|
t.binary :ip_adress, limit: 16, null: false
t.boolean :banned, default: false, null: false
t.timestamps
end
end
end

+ 9
- 0
backend/db/migrate/20250227210600_create_nico_tag_relations.rb View File

@@ -0,0 +1,9 @@
class CreateNicoTagRelations < ActiveRecord::Migration[7.0]
def change
create_table :nico_tag_relations do |t|
t.references :nico_tag, null: false, foreign_key: { to_table: :tags }
t.references :tag, null: false, foreign_key: { to_table: :tags }
t.timestamps
end
end
end

+ 11
- 0
backend/db/migrate/20250227211500_create_post_tags.rb View File

@@ -0,0 +1,11 @@
class CreatePostTags < ActiveRecord::Migration[7.0]
def change
create_table :post_tags do |t|
t.references :post, null: false, foreign_key: { to_table: :posts }
t.references :tag, null: false, foreign_key: { to_table: :tags }
t.references :created_by, foreign_key: { to_table: :users }
t.references :deleted_by, foreign_key: { to_table: :users }
t.timestamps
end
end
end

+ 12
- 0
backend/db/migrate/20250227212100_create_posts.rb View File

@@ -0,0 +1,12 @@
class CreatePosts < ActiveRecord::Migration[7.0]
def change
create_table :posts do |t|
t.string :url, limit: 2000, null: false
t.string :thumbnail, limit: 255, null: false
t.string :thumbnail_base, limit: 2000, null: false
t.references :post, foreign_key: { to_table: :posts }
t.references :uploaded_by, foreign_key: { to_table: :users }
t.timestamps
end
end
end

+ 10
- 0
backend/db/migrate/20250227212500_create_settings.rb View File

@@ -0,0 +1,10 @@
class CreateSettings < ActiveRecord::Migration[7.0]
def change
create_table :settings do |t|
t.references :user, null: false, foreign_key: { to_table: :users }
t.string :key, limit: 255, null: false
t.json :value, null: false
t.timestamps
end
end
end

+ 9
- 0
backend/db/migrate/20250227213000_create_tag_aliases.rb View File

@@ -0,0 +1,9 @@
class CreateTagAliases < ActiveRecord::Migration[7.0]
def change
create_table :tag_aliases do |t|
t.references :tag, null: false, foreign_key: { to_table: :tags }
t.string :name, limit: 255, null: false
t.timestamps
end
end
end

+ 9
- 0
backend/db/migrate/20250227213200_create_tags.rb View File

@@ -0,0 +1,9 @@
class CreateTags < ActiveRecord::Migration[7.0]
def change
create_table :tags do |t|
t.string :name, limit: 255, null: false
t.string :category, limit: 255, null: false, default: 'general'
t.timestamps
end
end
end

+ 10
- 0
backend/db/migrate/20250227213400_create_user_ips.rb View File

@@ -0,0 +1,10 @@
class CreateUserIps < ActiveRecord::Migration[7.0]
def change
create_table :user_ips do |t|
t.references :user, null: false, foreign_key: { to_table: :users }
t.references :ip_address, null: false,
foreign_key: { to_table: :ip_addresses }
t.timestamps
end
end
end

+ 10
- 0
backend/db/migrate/20250227213700_create_user_post_views.rb View File

@@ -0,0 +1,10 @@
class CreateUserPostViews < ActiveRecord::Migration[7.0]
def change
create_table :user_post_views do |t|
t.references :user, null: false, foreign_key: { to_table: :users }
t.references :post, null: false, foreign_key: { to_table: :posts }
t.boolean :viewed, default: false, null: false
t.timestamps
end
end
end

+ 11
- 0
backend/db/migrate/20250227213900_create_users.rb View File

@@ -0,0 +1,11 @@
class CreateUsers < ActiveRecord::Migration[7.0]
def change
create_table :users do |t|
t.string :name, limit: 255
t.string :inheritance_code, limit: 64, null: false
t.string :role, limit: 255, null: false
t.boolean :banned, default: false, null: false
t.timestamps
end
end
end

+ 11
- 0
backend/db/migrate/20250227214100_create_wiki_pages.rb View File

@@ -0,0 +1,11 @@
class CreateWikiPages < ActiveRecord::Migration[7.0]
def change
create_table :wiki_pages do |t|
t.string :title, limit: 255, null: false
t.references :tag, foreign_key: { to_table: :tags }
t.references :created_by, null: false, foreign_key: { to_table: :users }
t.references :updated_by, null: false, foreign_key: { to_table: :users }
t.timestamps
end
end
end

Loading…
Cancel
Save