Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
SchemaPlus
Search
Michał Łomnicki
November 21, 2012
Technology
51
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SchemaPlus
Michał Łomnicki
November 21, 2012
More Decks by Michał Łomnicki
See All by Michał Łomnicki
DDD, Rails and persistence
mlomnicki
1
290
Forget Ruby. Forget CoffeeScript. Do SOA
mlomnicki
1
130
Having fun with legacy apps
mlomnicki
1
81
CAP Theorem
mlomnicki
2
150
[PL] Transakcje w bazach danych
mlomnicki
1
300
Ruby Tricks 2
mlomnicki
3
84
Other Decks in Technology
See All in Technology
自律型 AI をセキュアに実装!Gemini と MIG で作る動的コード実行環境
recruitengineers
PRO
1
230
TinyGoでオブザーバビリティ?OpenTelemetryはTinyGoで使えるのか / Is OpenTelemetry available in TinyGo environment?
ymotongpoo
2
110
LLM機能を自作して分かるSnowflake Cortex AIの強み
nayuts
0
330
組み立てて楽しむ AWS Blocks 入門
kmiya84377
0
220
OpenSharing について熱く語る〜AI アセットの共有について〜
kameitomohiro
0
240
freeeらしさをAIとともに作る / Creating the freee Experience with AI
ymrl
0
210
生成AIを使って「人が」考える技術 ― AI時代の人機共想と実践ノウハウ|UNITT AC2026
ishiirikie
0
570
あなたの知らないAmazon VPC Route Server/Amazon VPC Route Server you don't know about
masakiokuda
2
240
SREでアラート疲れを 解決しよう!
kairim0
1
210
今さら理解するウェブフォントver.2026
takanorip
3
410
Snapshot Testing in Practice: Predictable and Reliable SwiftUI Views
fespinoza
0
160
Codex概要
ymiya55
0
470
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1369
210k
The agentic SEO stack - context over prompts
schlessera
0
970
Code Reviewing Like a Champion
maltzj
529
40k
How to make the Groovebox
asonas
2
2.5k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
5
780
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
300
Between Models and Reality
mayunak
4
490
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
760
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Transcript
SchemaPlus enhanced capabilities for schema definition and querying Ronen Barzel
& Michał Łomnicki
History Simon Harris / harukizaemon redhillonrails_core (2006, 2009) foreign_key_migrations =>
automatic_foreign_key schema_plus (2011)
Goals solid base well-tested well-documented better name :)
Plain ActiveRecord create_table :comments do |t| t.text :body t.integer :post_id
t.integer :author_id end execute "ALTER TABLE comments ADD FOREIGN KEY (post_id) \ REFERENCES (posts)" execute "ALTER TABLE comments ADD FOREIGN KEY (author_id) \ REFERENCES (users)" add_index :comments, :post_id
With schema_plus create_table :comments do |t| t.text :body t.integer :post_id,
:index => true t.integer :author_id, :references => :users end
auto-index foreign keys # without auto_index t.integer :post_id, :index =>
true # with auto_index t.integer :post_id
index t.string :area_code t.string :local_number, :index => { :unique =>
true, :with => :area_code }
Other features global, per table and per statement config expressional
indexes views
SchemaAssociations # without schema_associations class Post < ActiveRecord::Base belongs_to :author
has_many :comments end
SchemaAssociations # without schema_associations class Post < ActiveRecord::Base # associations
auto-created from foreign keys end
SchemaValidations create_table :posts do |t| t.integer :author_id, :null => false,
:references => :users t.integer :likes_count t.string :content, :limit => 5_000 end
SchemaValidations # without schema_validations class Post < ActiveRecord::Base validates :author,
:presence => true validates :likes_count, :numericality => true validates :content, :length => { :maximum => 5_000 } end
SchemaValidations # with schema_validations class Post < ActiveRecord::Base end
Schema Family Scary? ...but that's next step for active record
pattern
Questions http://github.com/lomba