Initial commit
This commit is contained in:
commit
0cec39413f
116 changed files with 9683 additions and 0 deletions
12
db/migrate/20210319142051_create_authors.rb
Normal file
12
db/migrate/20210319142051_create_authors.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
class CreateAuthors < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :authors do |t|
|
||||
t.string :first_name
|
||||
t.string :last_name
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :authors, [ :first_name, :last_name ]
|
||||
end
|
||||
end
|
13
db/migrate/20210319142054_create_books.rb
Normal file
13
db/migrate/20210319142054_create_books.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
class CreateBooks < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :books do |t|
|
||||
t.string :title
|
||||
t.decimal :price, precision: 10, scale: 2
|
||||
t.boolean :published
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :books, :published
|
||||
end
|
||||
end
|
10
db/migrate/20210319142059_create_authors_books.rb
Normal file
10
db/migrate/20210319142059_create_authors_books.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class CreateAuthorsBooks < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :authors_books do |t|
|
||||
t.belongs_to :book
|
||||
t.belongs_to :author
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue