This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
# triggers on | |
on: | |
#push: | |
pull_request: | |
branches: | |
- main | |
jobs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
# triggers on | |
on: | |
#push: | |
pull_request: | |
branches: | |
- main | |
jobs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create_table "users", force: :cascade do |t| | |
t.string "email", limit: 200, null: false | |
t.boolean "active", default: true, null: false | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create_table "users", force: :cascade do |t| | |
t.string "email", limit: 200, null: false | |
t.boolean "active" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/generators.rb | |
Rails.application.config.generators do |g| | |
g.orm :active_record, primary_key_type: :uuid | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/models/application_record.rb | |
class ApplicationRecord < ActiveRecord::Base | |
self.abstract_class = true | |
# Sort records by date of creation instead of primary key | |
self.implicit_order_column = :created_at | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/db/migrate/create_comment_with_uuid.rb | |
class CreateComments < ActiveRecord::Migration[6.0] | |
def change | |
create_table :comments, id: :uuid do |t| | |
t.belongs_to :post, null: false, type: :uuid, foreign_key: true, index: true | |
t.text :body | |
t.timestamps | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/db/migrate/create_post_with_uuid.rb | |
class CreatePosts < ActiveRecord::Migration[6.0] | |
def change | |
create_table :posts, id: :uuid do |t| | |
t.string :title | |
t.timestamps | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/db/migrate/enable_uuid.rb | |
class EnableUuid < ActiveRecord::Migration[6.0] | |
def change | |
enable_extension 'pgcrypto' | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data": { | |
"id": "204", | |
"type": "movie", | |
"attributes": { | |
"id": 204, | |
"original_title": "Don Quixote" | |
}, | |
"relationships": { | |
"cinemas": { |
NewerOlder