/usr/share/doc/ruby-ramaze/examples/app/blog/migrations/01_create_schema.rb is in ruby-ramaze 2012.12.08-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | # For more information on Sequel migrations see the following page:
# http://sequel.rubyforge.org/rdoc/files/doc/migration_rdoc.html
Sequel.migration do
# The up() method and block is used to update a database to the current
# migration.
up do
create_table(:users) do
primary_key :id
String :username, :null => false
String :password, :null => false
end
create_table(:posts) do
primary_key :id
String :title, :null => false
String :body , :null => false, :text => true
Time :created_at
Time :updated_at
foreign_key :user_id, :users, :on_update => :cascade,
:on_delete => :cascade, :key => :id
end
create_table(:comments) do
primary_key :id
String :username, :null => true
String :comment , :null => false, :text => true
Time :created_at
foreign_key :post_id, :posts, :on_update => :cascade,
:on_delete => :cascade, :key => :id
foreign_key :user_id, :users, :on_update => :cascade,
:on_delete => :cascade, :key => :id
end
end
# The down() method and block is used to revert the changes introduced by the
# up() block.
down do
drop_table(:comments)
drop_table(:posts)
drop_table(:users)
end
end
|