|
- class CreateWikiAssets < ActiveRecord::Migration[8.0]
- def change
- create_table :wiki_assets, primary_key: [:wiki_page_id, :no] do |t|
- t.references :wiki_page, null: false, foreign_key: true, index: false
- t.integer :no, null: false
- t.string :alt_text
- t.column :sha256, 'binary(32)', null: false
- t.references :created_by_user, null: false, foreign_key: { to_table: :users }
- t.timestamps
- end
-
- add_index :wiki_assets, [:wiki_page_id, :sha256], unique: true
-
- add_column :wiki_pages, :next_asset_no, :integer, null: false, default: 1
- end
- end
|